From 869283242a8e9e248820c1e9dd08454a07e6d13c Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 8 Jan 2025 11:33:09 +0100 Subject: [PATCH] Fix `mapping` + `events` tests --- .github/workflows/ci.yml | 26 +++++++++++++++++++++- integration-tests/public/events/Cargo.toml | 4 ++-- integration-tests/public/mapping/lib.rs | 5 ++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3466b5004f..eed1aee512 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -502,9 +502,33 @@ jobs: with: # run all tests with --all-features, which will run the e2e-tests feature if present args: - /bin/bash -c "scripts/for_all_contracts_exec.sh --path integration-tests --ignore public/static-buffer --partition ${{ matrix.partition }}/6 -- \ + /bin/bash -c "scripts/for_all_contracts_exec.sh --path integration-tests --ignore public/static-buffer --ignore public/mapping --partition ${{ matrix.partition }}/6 -- \ cargo +nightly test --all-features --all --manifest-path {}" + examples-test-mapping: + runs-on: ubuntu-latest + needs: [clippy] + strategy: + matrix: + partition: [1, 2, 3, 4, 5, 6] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Cache + uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 + with: + cache-directories: ${{ env.CARGO_TARGET_DIR }} + + - name: Test Examples + env: + # needed for `mapping::e2e_tests::fallible_storage_methods_work` + INK_STATIC_BUFFER_SIZE: 256 + run: + cargo +nightly test --all-features --all --manifest-path integration-tests/public/mapping/Cargo.toml + examples-custom-test: # todo if: false diff --git a/integration-tests/public/events/Cargo.toml b/integration-tests/public/events/Cargo.toml index 6d8842a534..47b7c78a1a 100644 --- a/integration-tests/public/events/Cargo.toml +++ b/integration-tests/public/events/Cargo.toml @@ -29,7 +29,7 @@ std = [ ink-as-dependency = [] e2e-tests = [] -[profile.test] +#[profile.test] # Need this for linkme crate to work for the event metadata unit test. # See https://github.com/dtolnay/linkme/issues/61#issuecomment-1503653702 -lto = "thin" +#lto = "thin" diff --git a/integration-tests/public/mapping/lib.rs b/integration-tests/public/mapping/lib.rs index 4c2034b315..552d642efc 100755 --- a/integration-tests/public/mapping/lib.rs +++ b/integration-tests/public/mapping/lib.rs @@ -367,7 +367,10 @@ mod mapping { mut client: Client, ) -> E2EResult<()> { // Makes testing the fallible storage methods more efficient - std::env::set_var("INK_STATIC_BUFFER_SIZE", "256"); + const ERR: &str = "For this test the env variable `INK_STATIC_BUFFER_SIZE` needs to be set to `256`"; + let buffer_size = std::env::var("INK_STATIC_BUFFER_SIZE") + .unwrap_or_else(|err| panic!("{} {}", ERR, err)); + assert_eq!(buffer_size, "256", "{}", ERR); // given eprintln!("----1");