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

chore(sdk): improve bucket tests readability with assertThrows #3900

Merged
merged 2 commits into from
Sep 4, 2023

Conversation

garysassano
Copy link
Collaborator

Updating the bucket tests following the same standard used in the other resources.

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@garysassano garysassano requested a review from a team as a code owner August 21, 2023 00:44
@garysassano garysassano changed the title chore(sdk): improve bucket tests readibility with assertthrows chore(sdk): improve bucket tests readability with assertthrows Aug 21, 2023
@garysassano
Copy link
Collaborator Author

@tsuf239 I tried to remove this:

// TODO: works in aws, doesn't work in sim since publicUrl is returning a path to the file, remove condition when #2833 is resolved.
if (util.env("WING_TARGET") != "sim") {
assert(http.get(publicUrl).body == "Foo");
}

But the http.get(publicUrl).body operation throws an error for the sim target:

fail ┌ public_url.wsim » root/env0/test:publicUrl
     │ TypeError: fetch failed
     │     at Object.fetch (node:internal/deps/undici/undici:11457:11)
     │     at async Util.fetch (/tmp/wing-bundles-NFD9aL/index.js:1768:21)
     │     at async $Closure1.handle (/tmp/wing-bundles-NFD9aL/index.js:114:26)
     │     at async exports.handler (/tmp/wing-bundles-NFD9aL/index.js:5713:10)
     │     at async Object.withTrace (/home/user/github/wing/libs/wingsdk/lib/testing/simulator.js:256:34)
     │     at async TestRunnerClient.runTest (/home/user/github/wing/libs/wingsdk/lib/target-sim/test-runner.inflight.js:31:13)
     │     at async testSimulator (/home/user/github/wing/apps/wing/dist/commands/test.js:214:22)
     │     at async testOne (/home/user/github/wing/apps/wing/dist/commands/test.js:125:20)
     │     at async testFile (/home/user/github/wing/apps/wing/dist/commands/test.js:55:39)
     │     at async Promise.all (index 0)
     │     at async Object.test (/home/user/github/wing/apps/wing/dist/commands/test.js:66:5)
     └     at async Command.<anonymous> (/home/user/github/wing/apps/wing/dist/cli.js:46:30)

Signed-off-by: monada-bot[bot] <monabot@monada.co>
@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Aug 21, 2023
@tsuf239
Copy link
Contributor

tsuf239 commented Aug 21, 2023

#2833

Reopened the issue, thanks for reporting @garysassano!

@garysassano garysassano changed the title chore(sdk): improve bucket tests readability with assertthrows chore(sdk): improve bucket tests readability with assertThrows Aug 26, 2023
@staycoolcall911 staycoolcall911 removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Sep 4, 2023
@mergify
Copy link
Contributor

mergify bot commented Sep 4, 2023

Thanks for contributing, @garysassano! This PR will now be added to the merge queue, or immediately merged if garysassano/update-bucket-sdk-tests is up-to-date with main and the queue is empty.

mergify bot added a commit that referenced this pull request Sep 4, 2023
@mergify mergify bot merged commit a6e4130 into main Sep 4, 2023
@mergify mergify bot deleted the garysassano/update-bucket-sdk-tests branch September 4, 2023 10:22
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.29.1.

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.

6 participants