Skip to content

Conversation

katexochen
Copy link
Contributor

No description provided.

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
@@ -203,6 +203,8 @@ func TestEmptyRootList(t *testing.T) {
}

func TestClientTransport(t *testing.T) {
skipCheck(t)
Copy link
Member

@milosgajdos milosgajdos Dec 26, 2023

Choose a reason for hiding this comment

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

This isn't needed here. This is a unit test, we only skip integration tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fails downstream with

       > --- FAIL: TestClientTransport (0.00s)
       >     --- FAIL: TestClientTransport/SkipVerify_true (0.00s)
       >         s3_test.go:225: failed to create driver: no region parameter provided
       >     --- FAIL: TestClientTransport/SkipVerify_false (0.00s)
       >         s3_test.go:225: failed to create driver: no region parameter provided

Would be nice if we could run unit tests without setting any required environment variables.

Copy link
Member

Choose a reason for hiding this comment

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

We probably might want to change the test params to avoid reading env vars in unit tests instead of skipping the test completely if they're not set.

		params := map[string]interface{}{
			"region":     os.Getenv("AWS_REGION"),
			"bucket":     os.Getenv("S3_BUCKET"),
			"skipverify": tc.skipverify,
		}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the test to use constant strings instead, removed test skipping.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, you know what. I'm being completely silly here. We should aim to be consistent -- I noticed there are some other unit tests like TestStorageClass that skip tests...can we revert this to your original change? I'm so sorry, xmas holidays fatigue took over my thinking 😵‍💫

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, no problem. :)

Copy link
Member

Choose a reason for hiding this comment

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

We probably might want to change the test params to avoid reading env vars in unit tests instead of skipping the test completely if they're not set.

Also wondering indeed if (as a follow-up) these unit-tests should ultimately get a t.SetEnv (if these env-vars are needed (but not actually make connections)) or otherwise some setupTest(t) if something actually needs to be set up (from a quick test, it looks like these may not be very 'unit" tests"

Copy link
Member

Choose a reason for hiding this comment

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

using t.Setenv is complicated because we construct the driver in the init func 🤔 something to think about for sure

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, not a huge fan of init() but also haven't looked closely

@katexochen katexochen changed the title fix: add missing skip in s3 driver test fix: don't read env vars in s3 driver unit test Dec 26, 2023
@katexochen katexochen changed the title fix: don't read env vars in s3 driver unit test fix: add missing skip in s3 driver test Dec 27, 2023
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

but I feel there's something to look into if these tests need setting up (see my comment above)

@milosgajdos milosgajdos merged commit 316e409 into distribution:main Dec 27, 2023
@katexochen katexochen deleted the s3/missingskip branch December 27, 2023 13:25
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.

3 participants