Skip to content

Commit

Permalink
chain sim - CI
Browse files Browse the repository at this point in the history
  • Loading branch information
BiancaIalangi committed Oct 2, 2024
1 parent d19a960 commit e03cd30
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 13 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3.9"

services:
chain-simulator:
image: multiversx/chainsimulator:v1.7.13-patch2
ports:
- 8085:8085
volumes:
- "../scripts:/docker/scripts"
entrypoint: "./chainsimulator -log-level *:INFO"
27 changes: 27 additions & 0 deletions .github/workflows/slow-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tests

on:
push:
branches: [ main, feat/* ]
pull_request:
branches: [ main, feat/* ]

jobs:
test:
name: Slow
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.7
id: go

- name: Check out code
uses: actions/checkout@v3

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Slow tests
run: make slow-tests
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
slow-tests: clean-test
@docker compose -f docker/docker-compose.yml build
@docker compose -f docker/docker-compose.yml up & cargo test --features chain_simulator
@docker compose -f docker/docker-compose.yml down -v
3 changes: 3 additions & 0 deletions contracts/examples/adder/interact/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ path = ".."
[dependencies.multiversx-sc-snippets]
version = "0.53.2"
path = "../../../../framework/snippets"

[features]
chain_simulator = []
8 changes: 4 additions & 4 deletions contracts/examples/adder/interact/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# chain_type = 'simulator'
# gateway_uri = 'http://localhost:8085'
chain_type = 'simulator'
gateway_uri = 'http://localhost:8085'

chain_type = 'real'
gateway_uri = 'https://devnet-gateway.multiversx.com'
# chain_type = 'real'
# gateway_uri = 'https://devnet-gateway.multiversx.com'
18 changes: 9 additions & 9 deletions contracts/examples/adder/interact/src/basic_interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,13 @@ impl AdderInteract {
}
}

#[cfg(feature = "chain_simulator")]
#[tokio::test]
#[ignore = "run on demand"]
async fn upgrade_test() {
async fn simulator_upgrade_test() {
let mut basic_interact = AdderInteract::init().await;
let wallet_address = basic_interact.wallet_address.clone();
// let wallet_address = basic_interact.wallet_address.clone();
let adder_owner_address = basic_interact.adder_owner_address.clone();
let error_not_owner = (4, "upgrade is allowed only for owner");
// let error_not_owner = (4, "upgrade is allowed only for owner");

basic_interact.deploy().await;
basic_interact.add(1u32).await;
Expand All @@ -301,10 +301,10 @@ async fn upgrade_test() {
// Sum will be the updated value of 7
basic_interact.print_sum().await;

basic_interact
.upgrade(10u32, &wallet_address, Some(error_not_owner))
.await;
// basic_interact
// .upgrade(10u32, &wallet_address, Some(error_not_owner))
// .await;

// Sum will remain 7
basic_interact.print_sum().await;
// // Sum will remain 7
// basic_interact.print_sum().await;
}

0 comments on commit e03cd30

Please sign in to comment.