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

test: check output during CLI integration tests #2249

Merged
merged 1 commit into from Sep 30, 2022
Merged

Conversation

bstrie
Copy link
Contributor

@bstrie bstrie commented Sep 29, 2022

This also:

  • makes the OIDC mock server return 401 on unauthorized, rather than panicking, so we can test the authorization failure mode
  • makes the mock OIDC server use our hardcoded OIDC client key, rather than a dummy token
  • allows setting an option to enarx user register via an env var
  • improves the integration test helper, by making it easier to use and read, and making the error output more useful and readable

Signed-off-by: bstrie 865233+bstrie@users.noreply.github.com

@enarxbot enarxbot enabled auto-merge (rebase) September 29, 2022 11:30
@github-actions github-actions bot added client Issues related to the Enarx client testing Issues related to testing Enarx labels Sep 29, 2022
tests/client/util.rs Show resolved Hide resolved
tests/client/util.rs Show resolved Hide resolved
@bstrie
Copy link
Contributor Author

bstrie commented Sep 29, 2022

Pushed a minor fix to address a test failure: on some machines the directory traversal would happen differently, causing the expected output of some should-fail tests to slightly differ from the received output based on which files exist/were visited first, so I've added a new directory under tests/client/data rather than hackily using the workspace root itself as test input.

This also slightly improves the OIDC mock server to fix a test,
and allows setting an option to `enarx user register`
via an env var.

Signed-off-by: bstrie <865233+bstrie@users.noreply.github.com>
@bstrie
Copy link
Contributor Author

bstrie commented Sep 29, 2022

One of the tests is testing JSON output, which was causing test failures to due the nondeterministic order of array elements. I've pushed a fix for that, moving that test to earlier in the script to a point where there's only one element in the returned array, making the output deterministic.

@haraldh
Copy link
Member

haraldh commented Sep 29, 2022

One of the tests is testing JSON output, which was causing test failures to due the nondeterministic order of array elements. I've pushed a fix for that, moving that test to earlier in the script to a point where there's only one element in the returned array, making the output deterministic.

Seems like we could use a JSON normalizer for comparison.

@bstrie
Copy link
Contributor Author

bstrie commented Sep 29, 2022

Seems like we could use a JSON normalizer for comparison.

We may need that in the future, as we begin more aggressively testing CLI output. But for now it should be fine.

@codecov
Copy link

codecov bot commented Sep 29, 2022

Codecov Report

Merging #2249 (fef4278) into main (68d713c) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2249      +/-   ##
==========================================
- Coverage   61.05%   61.04%   -0.01%     
==========================================
  Files         197      197              
  Lines       12313    12313              
==========================================
- Hits         7518     7517       -1     
- Misses       4795     4796       +1     
Impacted Files Coverage Δ
src/cli/user/register.rs 93.87% <ø> (ø)
src/cli/package/publish.rs 91.17% <0.00%> (-2.95%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@enarxbot enarxbot merged commit 6a78284 into enarx:main Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Issues related to the Enarx client testing Issues related to testing Enarx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants