Skip to content

Commit d6f270d

Browse files
authored
feat: e2e demo script (#667)
* feat: initial setup for e2e demo script * feat: e2e demo setup complete * feat: e2e demo setup cleanup * fix: reset default image of archway * fix: ensure that the Docker container remains running unless an error occurs * fix: rename IBCOwnerAccoun to IBCOwnerAccount
1 parent c597775 commit d6f270d

30 files changed

+730
-332
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,6 @@ lcov.info
196196

197197

198198
vendor/**
199-
scripts/download_buf.sh
199+
scripts/download_buf.sh
200+
201+
test/e2e-demo/ibc-config/**

Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,13 @@ optimize-build:
6262
gobuild:
6363
go build .
6464

65+
e2e-demo-setup:
66+
@echo "Configuring e2e demo..."
67+
export PRESERVE_DOCKER=true && \
68+
go test -v ./test/e2e-demo -testify.m TestSetup
69+
70+
e2e-demo-clean:
71+
go test -v ./test/e2e-demo -testify.m TestCleanup
72+
73+
6574
.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps gobuild

docs/e2e-integration-test-setup.md

+55-29
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,33 @@ To run the demo, the following software needs to be installed.
4040
### Additional steps for Apple Silicon 
4141

4242
* Build an `icon-chain` image
43-
43+
4444
```bash
4545
git clone https://github.com/icon-project/goloop.git
4646
cd goloop
4747
make gochain-icon-image
4848
```
49-
49+
5050
* Build a `goloop` image
51-
51+
5252
```bash
5353
git clone https://github.com/icon-project/goloop/
5454
cd goloop/
5555
make goloop-icon-image
5656
```
57-
57+
5858
* Build an `archway` or `neutron` image
5959

60-
**For Archway:**
61-
60+
**For Archway:**
61+
6262
```bash
6363
git clone https://github.com/archway-network/archway/
6464
cd archway
6565
docker build -f Dockerfile.deprecated -t archway . --build-arg arch=aarch64
6666
```
67-
68-
**For Neutron:**
69-
67+
68+
**For Neutron:**
69+
7070
```bash
7171
git clone https://github.com/neutron-org/neutron.git
7272
cd neutron
@@ -75,28 +75,54 @@ To run the demo, the following software needs to be installed.
7575

7676
ℹ️ Change the image name and version of Archway/Neutron in `e2e-config.yaml` or `e2e-config-neutron.yaml`.
7777

78-
### Running the End-to-End Tests
78+
### Running IBC Integration System Tests
7979

80-
1. Export the following system variables:
80+
To conduct tests for IBC integration system, carefully adhere to the provided instructions:
8181

82-
- `E2E_CONFIG_PATH`: Absolute path to the config file (`e2e-config.yaml` for Archway or `e2e-config-neutron.yaml` for Neutron).
83-
- `GOLOOP_IMAGE_ENV`: Goloop image name.
84-
- `GOLOOP_IMAGE_TAG_ENV`: Goloop image version.
82+
#### 1. Configure Environment Variables
8583

86-
Example:
84+
Prior to initiating the tests, ensure proper configuration of essential environment variables, which play a pivotal role in the testing process:
8785

88-
```bash
89-
export TEST_CONFIG_PATH=/home/User/IBC-integration/sample-config-archway.yaml
90-
export GOLOOP_IMAGE_ENV=goloop
91-
export GOLOOP_IMAGE_TAG_ENV=latest
92-
```
86+
- **`E2E_CONFIG_PATH`**: Set this variable to the absolute path of your chosen configuration file. For Archway, utilize `sample-config-archway.yaml`, and for Neutron, employ `sample-config-neutron.yaml`.
87+
- **`GOLOOP_IMAGE_ENV`**: Indicate the name of the Goloop image.
88+
- **`GOLOOP_IMAGE_TAG_ENV`**: Specify the version of the Goloop image.
89+
90+
Here's an example of environment variable configuration:
91+
92+
```bash
93+
export E2E_CONFIG_PATH=/home/User/IBC-integration/sample-config-archway.yaml
94+
export GOLOOP_IMAGE_ENV=goloop-icon
95+
export GOLOOP_IMAGE_TAG_ENV=latest
96+
```
97+
98+
#### 2. Execute the Test Suite
99+
100+
Depending on your specific testing requirements, employ the appropriate commands to run the test suite:
101+
102+
- To execute the end-to-end tests:
103+
```bash
104+
go test -v ./test/e2e -timeout 0
105+
```
106+
107+
- To run the integration tests:
108+
```bash
109+
go test -v ./test/integration -timeout 0
110+
```
111+
112+
#### 3. Set Up the Demo Test Environment (Optional)
113+
114+
If necessary, establish the e2e demo test environment by executing the following command:
115+
116+
```bash
117+
make e2e-demo-setup
118+
```
119+
120+
During the setup process, distinct configuration files are generated in the `test/e2e-demo/ibc-config` directory. These files include contract addresses, along with wallets containing mnemonic/private keys. These keys are essential for conducting subsequent tests.
121+
122+
#### 4. Clean Up the Demo Test Environment (Optional)
123+
124+
Upon completion of the testing process, if you've set up the e2e demo environment, you can execute the following command to perform a cleanup:
93125

94-
2. Run the Tests:
95-
- for e2e test
96-
```bash
97-
go test -v ./test/e2e
98-
```
99-
- for integration test
100-
```bash
101-
go test -v ./test/integration
102-
```
126+
```bash
127+
make e2e-demo-clean
128+
```

go.mod

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ require (
1111
github.com/cosmos/cosmos-sdk v0.47.4
1212
github.com/cosmos/gogoproto v1.4.10
1313
github.com/cosmos/ibc-go/v7 v7.2.0
14-
github.com/cucumber/godog v0.12.6
1514
github.com/docker/docker v24.0.4+incompatible
1615
github.com/docker/go-connections v0.4.0
1716
github.com/gdamore/tcell/v2 v2.6.0
@@ -25,6 +24,7 @@ require (
2524
github.com/stretchr/testify v1.8.4
2625
go.uber.org/multierr v1.11.0
2726
go.uber.org/zap v1.24.0
27+
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
2828
golang.org/x/sync v0.3.0
2929
modernc.org/sqlite v1.24.0
3030
)
@@ -78,8 +78,6 @@ require (
7878
github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect
7979
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
8080
github.com/creachadair/taskgroup v0.4.2 // indirect
81-
github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect
82-
github.com/cucumber/messages-go/v16 v16.0.1 // indirect
8381
github.com/danieljoos/wincred v1.1.2 // indirect
8482
github.com/davecgh/go-spew v1.1.1 // indirect
8583
github.com/deckarep/golang-set v1.8.0 // indirect
@@ -133,8 +131,8 @@ require (
133131
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
134132
github.com/hashicorp/go-getter v1.7.1 // indirect
135133
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
136-
github.com/hashicorp/go-memdb v1.3.2 // indirect
137134
github.com/hashicorp/go-safetemp v1.0.0 // indirect
135+
github.com/hashicorp/go-uuid v1.0.2 // indirect
138136
github.com/hashicorp/go-version v1.6.0 // indirect
139137
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
140138
github.com/hashicorp/hcl v1.0.0 // indirect
@@ -226,7 +224,6 @@ require (
226224
go.opencensus.io v0.24.0 // indirect
227225
go.uber.org/atomic v1.10.0 // indirect
228226
golang.org/x/crypto v0.11.0 // indirect
229-
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
230227
golang.org/x/mod v0.12.0 // indirect
231228
golang.org/x/net v0.12.0 // indirect
232229
golang.org/x/oauth2 v0.8.0 // indirect

go.sum

-17
Original file line numberDiff line numberDiff line change
@@ -470,21 +470,13 @@ github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzU
470470
github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4=
471471
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
472472
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
473-
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
474473
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
475474
github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8=
476475
github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM=
477476
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
478477
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
479478
github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0=
480479
github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts=
481-
github.com/cucumber/gherkin-go/v19 v19.0.3 h1:mMSKu1077ffLbTJULUfM5HPokgeBcIGboyeNUof1MdE=
482-
github.com/cucumber/gherkin-go/v19 v19.0.3/go.mod h1:jY/NP6jUtRSArQQJ5h1FXOUgk5fZK24qtE7vKi776Vw=
483-
github.com/cucumber/godog v0.12.6 h1:3IToXviU45G7FgijwTk/LdB4iojn8zUFDfQLj4MMiHc=
484-
github.com/cucumber/godog v0.12.6/go.mod h1:Y02TTpimPXDb70PnG6M3zpODXm1+bjCsuZzcW76xAww=
485-
github.com/cucumber/messages-go/v16 v16.0.0/go.mod h1:EJcyR5Mm5ZuDsKJnT2N9KRnBK30BGjtYotDKpwQ0v6g=
486-
github.com/cucumber/messages-go/v16 v16.0.1 h1:fvkpwsLgnIm0qugftrw2YwNlio+ABe2Iu94Ap8GMYIY=
487-
github.com/cucumber/messages-go/v16 v16.0.1/go.mod h1:EJcyR5Mm5ZuDsKJnT2N9KRnBK30BGjtYotDKpwQ0v6g=
488480
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
489481
github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0=
490482
github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0=
@@ -696,7 +688,6 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
696688
github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
697689
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
698690
github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
699-
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
700691
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
701692
github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc=
702693
github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
@@ -857,7 +848,6 @@ github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cU
857848
github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI=
858849
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
859850
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
860-
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
861851
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
862852
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
863853
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
@@ -918,11 +908,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/S
918908
github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY=
919909
github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
920910
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
921-
github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
922911
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
923912
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
924-
github.com/hashicorp/go-memdb v1.3.2 h1:RBKHOsnSszpU6vxq80LzC2BaQjuuvoyaQbkLTf7V7g8=
925-
github.com/hashicorp/go-memdb v1.3.2/go.mod h1:Mluclgwib3R93Hk5fxEfiRhB+6Dar64wWh71LpNSe3g=
926913
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
927914
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
928915
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
@@ -1070,7 +1057,6 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
10701057
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
10711058
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
10721059
github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o=
1073-
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
10741060
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
10751061
github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
10761062
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
@@ -1690,9 +1676,7 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf
16901676
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
16911677
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
16921678
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
1693-
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
16941679
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
1695-
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
16961680
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
16971681
github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY=
16981682
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
@@ -1713,7 +1697,6 @@ github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
17131697
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
17141698
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
17151699
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
1716-
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
17171700
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
17181701
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
17191702
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=

test/chains/chain.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"context"
66
"encoding/hex"
77
"fmt"
8+
"github.com/strangelove-ventures/interchaintest/v7/ibc"
89
"os"
910
"strings"
1011

@@ -29,7 +30,7 @@ type Chain interface {
2930
GetLastBlock(ctx context.Context) (context.Context, error)
3031
GetBlockByHeight(ctx context.Context) (context.Context, error)
3132
FindTxs(ctx context.Context, height uint64) ([]blockdb.Tx, error)
32-
BuildWallets(ctx context.Context, keyName string) error
33+
BuildWallets(ctx context.Context, keyName string) (ibc.Wallet, error)
3334
SetupIBC(ctx context.Context, keyName string) (context.Context, error)
3435
SetupXCall(ctx context.Context, portId, keyName string) error
3536
FindTargetXCallMessage(ctx context.Context, target Chain, height uint64, to string) (*XCallResponse, error)
@@ -58,6 +59,8 @@ type Chain interface {
5859
UnpauseNode(context.Context) error
5960
InitEventListener(ctx context.Context, contract string) EventListener
6061

62+
BackupConfig() ([]byte, error)
63+
RestoreConfig([]byte) error
6164
//integration test specific
6265
SendPacketMockDApp(ctx context.Context, targetChain Chain, keyName string, params map[string]interface{}) (PacketTransferResponse, error)
6366
}

0 commit comments

Comments
 (0)