-
Notifications
You must be signed in to change notification settings - Fork 3
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
iah integration tests #37
Conversation
…integration-tests-with-rust
contracts/tests/Cargo.toml
Outdated
near-units.workspace = true | ||
tokio.workspace = true | ||
anyhow.workspace = true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be a separate workspace crate, but instead it should be in /oracle/tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it should. This is not unit tests, but integration tests for multiple crates inside workspace. To test multiple crates inside a workspace a recommended way is to have a tests crate in workspace instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the example you could check https://github.com/rust-lang/futures-rs, https://github.com/tokio-rs/tokio or https://github.com/serde-rs/serde
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of that we already have in oracle integration tests, we can use contracts/tests
crate to provide common functionality to other integrtation tests (eg registry/test
etc...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact tokio
also have integration tests in each sub crate.
contracts/tests/src/workspaces.rs
Outdated
let wasm = std::fs::read(contract_path)?; | ||
let (id, sk) = worker.dev_generate().await; | ||
|
||
let contract = worker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just use dev_deploy
here and replace the dev_generate
and create_tla_and_deploy
with one line. We are not using the account later in here
contracts/tests/src/workspaces.rs
Outdated
} | ||
|
||
let (id, sk) = worker.dev_generate().await; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as below
&sec_key, | ||
)?; | ||
|
||
// TODO: add check for specific error text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is done already
contracts/Makefile
Outdated
@@ -5,7 +5,8 @@ add-deps: | |||
rustup target add wasm32-unknown-unknown | |||
|
|||
build: | |||
@RUSTFLAGS='-C link-arg=-s' cargo build --all --target wasm32-unknown-unknown --release | |||
@RUSTFLAGS='-C link-arg=-s' cargo build --workspace --exclude tests --target wasm32-unknown-unknown --release | |||
@mkdir -p res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be rollback , we have `res: entry in the Makefile
contracts/Makefile-common.mk
Outdated
@cp ../target/wasm32-unknown-unknown/release/*.wasm ../res/ | ||
|
||
|
||
build-all: | ||
@RUSTFLAGS='-C link-arg=-s' cargo build --all --target wasm32-unknown-unknown --release | ||
@mkdir -p ../res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
contracts/community-sbt/Cargo.toml
Outdated
@@ -5,7 +5,7 @@ authors = ["Robert Zaremba 'https://zaremba.ch/'"] | |||
edition = "2021" | |||
|
|||
[lib] | |||
crate-type = ["cdylib"] | |||
crate-type = ["cdylib", "lib"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rlib
should be used (we already have it in master for few months)
contracts/tests/Cargo.toml
Outdated
near-units.workspace = true | ||
tokio.workspace = true | ||
anyhow.workspace = true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of that we already have in oracle integration tests, we can use contracts/tests
crate to provide common functionality to other integrtation tests (eg registry/test
etc...)
Co-authored-by: Robert Zaremba <[email protected]>
…com/near-ndc/i-am-human into feature/integration-tests-with-rust
The changes were merged in this PR #90. Since it was left for so long it was easier to create a new one |
Add basic integration tests