Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conformance: check response status before checking location #420

Merged

Conversation

rogpeppe
Copy link
Contributor

I noticed that when these tests are running against a server that returns the wrong status code (an error, for example), the failure that we see doesn't mention the status code, but only that the returned location is empty.

This change checks the status code first, as if that's wrong, the location is very unlikely to be relevant.

I noticed that when these tests are running against a server
that returns the wrong status code (an error, for example),
the failure that we see doesn't mention the status code, but
only that the returned location is empty.

This change checks the status code first, as if that's wrong, the
location is very unlikely to be relevant.

Signed-off-by: Roger Peppe <[email protected]>
@sudo-bmitch sudo-bmitch added this to the v1.1.0 milestone May 27, 2023
@@ -233,8 +233,8 @@ var test02Push = func() {
resp, err := client.Do(req)
Expect(err).To(BeNil())
location := resp.Header().Get("Location")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why not colocate this line with the Expect line itself? interrupts readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is the way it's done in every other test and this PR is about changing exactly one property of a couple of tests, not changing things which are technically fine the way they are now and might have been done for good reason.

If we were to change other aspects of these tests, there are way more important things to do, in my view (see #416 for an example).

@jdolitsky jdolitsky merged commit a1eadff into opencontainers:main Jun 21, 2023
@jdolitsky jdolitsky mentioned this pull request Jun 27, 2023
8 tasks
@jdolitsky jdolitsky mentioned this pull request Jul 6, 2023
8 tasks
sudo-bmitch pushed a commit to sudo-bmitch/distribution-spec that referenced this pull request Aug 18, 2023
…ainers#420)

I noticed that when these tests are running against a server
that returns the wrong status code (an error, for example),
the failure that we see doesn't mention the status code, but
only that the returned location is empty.

This change checks the status code first, as if that's wrong, the
location is very unlikely to be relevant.

Signed-off-by: Roger Peppe <[email protected]>
@sudo-bmitch sudo-bmitch mentioned this pull request Feb 1, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants