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

e2e/util_test: enable tests to work using external endpoint #506

Merged
merged 30 commits into from
Sep 16, 2022

Conversation

boraberke
Copy link
Contributor

@boraberke boraberke commented Sep 2, 2022

With this PR, e2e tests can now be tested using external endpoint.

To do so, following environment variables need to be set:

S5CMD_ACCESS_KEY_ID
S5CMD_SECRET_ACCESS_KEY
S5CMD_ENDPOINT_URL
S5CMD_IS_VIRTUAL_HOST
S5CMD_REGION
S5CMD_I_KNOW_WHAT_IM_DOING

s5cmd will use S5CMD_ENDPOINT_URL with credentials S5CMD_ACCESS_KEY_ID, S5CMD_SECRET_ACCESS_KEY and S5CMD_REGION to run all e2e tests instead of local gofakess3 server. Additionally, if the endpoint tested uses virtual host style S5CMD_IS_VIRTUAL_HOST needs to be a truthy value and control env variable S5CMD_I_KNOW_WHAT_IM_DOING needs to be set to 1. If any of those environment variables is empty, tests will fallback to use gofakess3 instead.

Additionally, tests are refactored to have the following characteristics:

  1. Every test cleanup the bucket(s) after the test is done.
  2. Each created test bucket has a unique bucket name.

@boraberke boraberke changed the title e2e/util_test: enable tests to work in external endpoint e2e/util_test: enable tests to work using external endpoint Sep 2, 2022
boraberke added a commit to boraberke/s5cmd that referenced this pull request Sep 2, 2022
in v0.7.0, SlowDown was a retryable error. https://github.com/peak/s5cmd/blob/v0.7.0/core/error.go#L49

Add that again as retryable because with peak#506, one might get slowdown errors while testing with other endpoint urls.
igungor pushed a commit that referenced this pull request Sep 2, 2022
in [v0.7.0](https://github.com/peak/s5cmd/blob/v0.7.0/core/error.go#L49), SlowDown was a retryable error. 

Add that again as retryable because with #506, one might get slowdown errors while testing with other endpoint urls.
boraberke and others added 6 commits September 2, 2022 19:08
Realized TestCopySingleFileToS3 was a faulty test. gofakess3 never reads/assigns content-type. By fixing that with following pr on @igungor's fork, it works as expected.

p.s.: this commit will fail TestCopySingleFileToS3 as it depends on this change:
igungor/gofakes3#7
@boraberke boraberke marked this pull request as ready for review September 6, 2022 15:15
@boraberke boraberke requested a review from a team as a code owner September 6, 2022 15:15
@boraberke boraberke removed the request for review from a team September 6, 2022 15:15
@igungor
Copy link
Member

igungor commented Sep 6, 2022

@boraberke igungor/gofakes3#7 is merged. v0.0.13 release is ready.

Copy link
Member

@igungor igungor left a comment

Choose a reason for hiding this comment

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

This change will be very useful for us to be confident about the tool for certain s3 compatible services. Thank you.

e2e/cp_test.go Outdated Show resolved Hide resolved
e2e/cp_test.go Outdated Show resolved Hide resolved
e2e/ls_test.go Outdated Show resolved Hide resolved
e2e/run_test.go Outdated Show resolved Hide resolved
e2e/util_test.go Outdated Show resolved Hide resolved
e2e/util_test.go Outdated Show resolved Hide resolved
e2e/util_test.go Outdated Show resolved Hide resolved
e2e/util_test.go Outdated Show resolved Hide resolved
e2e/util_test.go Outdated Show resolved Hide resolved
e2e/util_test.go Show resolved Hide resolved
there was no way of understanding if a specific endpoint uses virtual host style or path style when testing. Add another environment variable to get that information.
e2e/cat_test.go Outdated Show resolved Hide resolved
e2e/cat_test.go Outdated Show resolved Hide resolved
e2e/rm_test.go Outdated Show resolved Hide resolved
e2e/rm_test.go Outdated Show resolved Hide resolved
e2e/rm_test.go Outdated Show resolved Hide resolved
e2e/run_test.go Outdated Show resolved Hide resolved
e2e/sync_test.go Outdated Show resolved Hide resolved
storage/s3.go Outdated Show resolved Hide resolved
seruman
seruman previously approved these changes Sep 15, 2022
Copy link
Member

@seruman seruman left a comment

Choose a reason for hiding this comment

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

🚀 Thank you!

There's a merge conflict though.

@boraberke
Copy link
Contributor Author

🚀 Thank you!

There's a merge conflict though.

Just resolved the merge conflict 🏁

@seruman
Copy link
Member

seruman commented Sep 16, 2022

For the records, I did try to run tests with Backblaze B2 and there are a couple things to consider -and there might be more-;

  • B2 limits maximum buckets per account to 100.
  • Versioning is enabled by default. To delete a bucket, all versions of the files had to be deleted.
  • Looks like it does not keep spaces between media-type and parameters in Content-Type header;
    • Tests sets and expects text/html; charset=utf-8 but B2 responds with text/html;charset=utf-8.

Do not think these are blockers for this PR. We might update the tests as we start add more compatible services.

@boraberke
Copy link
Contributor Author

For the records, I did try to run tests with Backblaze B2 and there are a couple things to consider -and there might be more-;

  • B2 limits maximum buckets per account to 100.

  • Versioning is enabled by default. To delete a bucket, all versions of the files had to be deleted.

  • Looks like it does not keep spaces between media-type and parameters in Content-Type header;

    • Tests sets and expects text/html; charset=utf-8 but B2 responds with text/html;charset=utf-8.

Do not think these are blockers for this PR. We might update the tests as we start add more compatible services.

Thanks for testing Backblaze and pointing these out! As you said, after this PR, additional compatible services can be added and tests can be updated accordingly 👍

@igungor igungor merged commit d949fe0 into peak:master Sep 16, 2022
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