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 wasms should be loaded via namada_test_utils crate #893

Merged
merged 8 commits into from
Apr 13, 2023

Conversation

james-chf
Copy link
Contributor

@james-chf james-chf commented Dec 14, 2022

Relates to #102 - this PR lays some groundwork for moving our wasm_for_tests directory into the single wasm workspace.

We use wasm_for_tests wasms in tests across multiple crates (namada_apps, namada, namada_tests, namada_wasm) - but we duplicate logic for getting the relative paths to and reading test wasms. This PR consolidates that logic to one place, so that it will be easier to migrate the directory later on.

  • adds a TestWasms enum to test_utils/src/lib.rs
  • updates all usages of hardcoded paths to test wasms (i.e. "wasm_for_tests/") to start using this TestWasms enum instead

@juped
Copy link
Member

juped commented Feb 7, 2023

I have taken the simpler #894 for 0.14.0 - let's rebase this

@james-chf james-chf force-pushed the james/mainline/namada-test-utils-wasms branch from 63f3a21 to 0a18a60 Compare February 7, 2023 12:19
Comment on lines +52 to +64
// crudely find the root of the repo, we can't rely on the `.git`
// directory being present, so look instead for the presence of a
// CHANGELOG.md file
let repo_root = cwd
.ancestors()
.find(|path| path.join("CHANGELOG.md").exists())
.unwrap_or_else(|| {
panic!(
"Couldn't find the root of the repository for the current \
working directory {}",
cwd.to_string_lossy()
)
});
Copy link
Contributor Author

@james-chf james-chf Feb 7, 2023

Choose a reason for hiding this comment

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

We don't have the .git directory when running tests in CI, so this code crudely looks for the ancestor directory which has a CHANGELOG.md file, there is probably a better way to do this.

@james-chf james-chf changed the title Add namada_test_utils crate enumerating test wasms Test wasms should be loaded via namada_test_wasms crate Feb 7, 2023
@james-chf
Copy link
Contributor Author

pls update wasm

@james-chf
Copy link
Contributor Author

I've redone this PR on top of 0.14

@james-chf james-chf marked this pull request as ready for review February 8, 2023 11:36
@james-chf james-chf requested a review from juped February 8, 2023 11:36
@tzemanovic tzemanovic modified the milestones: 0.14, 0.15 Feb 8, 2023
@james-chf james-chf changed the title Test wasms should be loaded via namada_test_wasms crate Test wasms should be loaded via namada_test_utils crate Feb 8, 2023
@james-chf
Copy link
Contributor Author

pls update wasm

tzemanovic added a commit that referenced this pull request Mar 31, 2023
* james/mainline/namada-test-utils-wasms:
  Update shared crate to use test utils
  Update namada_tests crate to use test utils
  Don't rely on the presence of .git directory
  Test that all test wasm files are present
  Update wasm crate to use test utils
  Update namada_apps to use test wasm utility code
  Add changelog
  Add test wasm utility code to test_utils
@tzemanovic tzemanovic mentioned this pull request Mar 31, 2023
@juped juped merged commit 31dd7cf into main Apr 13, 2023
@juped juped deleted the james/mainline/namada-test-utils-wasms branch April 13, 2023 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants