Skip to content

Commit

Permalink
[PRT-655] Implement SDK E2E (#575)
Browse files Browse the repository at this point in the history
* PRT-655 Implement beta sdk test

* Fix lint

* Fix sdk test

* Tidy pairing.go

* Fix issues after merge

* Enable e2e

* Fix lint

* Add rest and tendermint tests

* Tidy tests

* Add badge server sdk tests

* Fix linter

* Add env for sdk tests

* Remove unnecessary logs

* Fix console rog for errors in sdk e2e tests

* Seperate e2e to 2 github actions

* Fix linter

* Fix test seperation

* Add readme and fix log path

* change go version to 1.20.5

* fixing log propagation

---------

Co-authored-by: Ran Mishael <[email protected]>
  • Loading branch information
0xAleksaOpacic and ranlavanet authored Aug 6, 2023
1 parent 6bdc35f commit 73911d6
Show file tree
Hide file tree
Showing 20 changed files with 897 additions and 216 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/consensus_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fetch-depth: '0'
- uses: actions/setup-go@v3
with:
go-version: 1.19.1
go-version: 1.20.5


# Setup Paths
Expand Down
166 changes: 148 additions & 18 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Lava E2E Tests
on: [pull_request]

jobs:
go:
test-protocol-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-go@v3
with:
go-version: 1.19.11
go-version: 1.20.5

# Install Ignite
- name: ignite install
Expand Down Expand Up @@ -61,71 +61,201 @@ jobs:
### Run Lava E2E Tests IGNITE VERSION:0.22.1
######################################################
- name: Run Lava E2E Tests IGNITE VERSION:0.22.1 -timeout 1200s
run: go test ./testutil/e2e/ -v -timeout 1200s # 20mins
run: go test ./testutil/e2e/ -run ^TestLavaProtocol$ -v -timeout 1200s # 20mins

- name: Stake Lava All Logs
if: always()
run: cat testutil/e2e/logs/01_stakeLava.log
run: cat testutil/e2e/protocolLogs/01_stakeLava.log

- name: Stake Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/logs/01_stakeLava_errors.log
run: cat testutil/e2e/protocolLogs/01_stakeLava_errors.log

- name: head -n 300 JSON Proxy Logs
if: always()
run: head -n 300 testutil/e2e/logs/02_jsonProxy.log
run: head -n 300 testutil/e2e/protocolLogs/02_jsonProxy.log

- name: tail -n 300 JSON Proxy Logs
if: always()
run: tail -n 300 testutil/e2e/logs/02_jsonProxy.log
run: tail -n 300 testutil/e2e/protocolLogs/02_jsonProxy.log

- name: JSON Proxy Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/logs/02_jsonProxy_errors.log
run: cat testutil/e2e/protocolLogs/02_jsonProxy_errors.log

- name: JSON Provider All Logs
if: always()
run: grep "" testutil/e2e/logs/03_EthProvider* --exclude="*errors*"
run: grep "" testutil/e2e/protocolLogs/03_EthProvider* --exclude="*errors*"

- name: JSON Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/logs/03_EthProvider* --include="*errors*"
run: grep "" testutil/e2e/protocolLogs/03_EthProvider* --include="*errors*"

- name: JSON Consumer All Logs
if: always()
run: grep "" testutil/e2e/logs/04_jsonConsumer* --exclude="*errors*"
run: grep "" testutil/e2e/protocolLogs/04_jsonConsumer* --exclude="*errors*"

- name: JSON Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/logs/04_jsonConsumer* --include="*errors*"
run: grep "" testutil/e2e/protocolLogs/04_jsonConsumer* --include="*errors*"

- name: Lava Provider All Logs
if: always()
run: grep "" testutil/e2e/logs/05_LavaProvider* --exclude="*errors*"
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --exclude="*errors*"

- name: Lava Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/logs/05_LavaProvider* --include="*errors*"
run: grep "" testutil/e2e/protocolLogs/05_LavaProvider* --include="*errors*"

- name: Lava over Lava All Logs
if: always()
run: cat testutil/e2e/logs/07_lavaOverLava.log
run: cat testutil/e2e/protocolLogs/07_lavaOverLava.log

- name: Lava over Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/logs/07_lavaOverLava_errors.log
run: cat testutil/e2e/protocolLogs/07_lavaOverLava_errors.log

- name: RPCConsumer Consumer All Logs
if: always()
run: grep "" testutil/e2e/logs/06_RPCConsumer* --exclude="*errors*"
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --exclude="*errors*"

- name: RPCConsumer Consumer Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/logs/06_RPCConsumer* --include="*errors*"
run: grep "" testutil/e2e/protocolLogs/06_RPCConsumer* --include="*errors*"
test-sdk-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-go@v3
with:
go-version: 1.20.5

# Install Ignite
- name: ignite install
run: git clone --depth 1 --branch v0.26.1 https://github.com/ignite/cli && cd cli && make install
# run: curl https://get.ignite.com/cli! | bash
- name: ignite version
run: ignite version
# - name: starport install
# run: curl https://get.starport.network/[email protected]! | bash
# - name: starport version
# run: starport version

# Setup Paths
- name: home
run: pwd && ls -l
- name: ls usr
run: ls -l /home/runner/work/lava/lava
- name: cp lava
run: cp -r ~/work/lava/lava ~/go/lava
- name: export PATH
run: export PATH=$PATH:/go:/go/bin:$(go env GOPATH)/bin:/usr/local:`pwd`:/home/runner/work/lava/lava/
# - name: export
# run: export PATH=$PATH:/go/lava
- name: export GOPATH
run: export GOPATH=$GOPATH:$(go env GOPATH):/go:/go/lava:/usr/local:`pwd`
- name: export LAVA
run: export LAVA=/home/runner/work/lava/lava
- name: go env
run: go env
- name: pwd
run: pwd
- name: tree
run: tree
- name: ls -l
run: ls -l

# Pre-build with ignite
- name: ignite build
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 20
command: ignite chain build -v

# Install Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20

# Install dependencies and build
- name: Install dependencies and build
run: |
cd ecosystem/lava-sdk
npm install
npm run build
######################################################
### Run Lava E2E Tests IGNITE VERSION:0.22.1
######################################################
- name: Run Lava E2E Tests IGNITE VERSION:0.22.1 -timeout 1200s
run: go test ./testutil/e2e/ -run ^TestLavaSDK -v -timeout 1200s # 20mins

- name: Stake Lava All Logs
if: always()
run: cat testutil/e2e/sdkLogs/01_stakeLava.log

- name: Stake Lava Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/sdkLogs/01_stakeLava_errors.log

- name: head -n 300 JSON Proxy Logs
if: always()
run: head -n 300 testutil/e2e/sdkLogs/02_jsonProxy.log

- name: tail -n 300 JSON Proxy Logs
if: always()
run: tail -n 300 testutil/e2e/sdkLogs/02_jsonProxy.log

- name: JSON Proxy Error Only Logs
if: always()
continue-on-error: true
run: cat testutil/e2e/sdkLogs/02_jsonProxy_errors.log

- name: JSON Provider All Logs
if: always()
run: grep "" testutil/e2e/sdkLogs/03_EthProvider* --exclude="*errors*"

- name: JSON Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/sdkLogs/03_EthProvider* --include="*errors*"

- name: Lava Provider All Logs
if: always()
run: grep "" testutil/e2e/sdkLogs/05_LavaProvider* --exclude="*errors*"

- name: Lava Provider Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/sdkLogs/05_LavaProvider* --include="*errors*"

- name: Badge Server All Logs
if: always()
run: grep "" testutil/e2e/sdkLogs/01_BadgeServer* --exclude="*errors*"

- name: Badge Server Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/sdkLogs/01_BadgeServer* --include="*errors*"

- name: Lava SDK All Logs
if: always()
run: grep "" testutil/e2e/sdkLogs/01_sdkTest* --exclude="*errors*"

- name: Lava SDK Error Only Logs
if: always()
continue-on-error: true
run: grep "" testutil/e2e/sdkLogs/01_sdkTest* --include="*errors*"
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.20.5

- name: Checkout code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protocol_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fetch-depth: '0'
- uses: actions/setup-go@v3
with:
go-version: 1.19.1
go-version: 1.20.5


# Setup Paths
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Configure Go
uses: actions/setup-go@v3
with:
go-version: '^1.18.2'
go-version: 1.20.5
check-latest: true
cache: true

Expand Down
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,21 @@ vue/dist

# Logs and debug
scripts/automation_scripts/automation_results*
testutil/e2e/logs/
testutil/e2e/protocolLogs/
testutil/e2e/sdkLogs/
testutil/debugging/

# Misc
scripts/vars/
rpcprovider.yml
rpcconsumer.yml

# Node modules
**/node_modules

# Pairing lsit
**/pairingList.json

# Lava SDK ignores
ecosystem/lava-sdk/node_modules/*
ecosystem/lava-sdk/src/js/*
Expand Down Expand Up @@ -70,4 +77,4 @@ ecosystem/lava-sdk/bin/src/wallet

ecosystem/lava-sdk/dist/*

# But don't ignore the specific folder inside the bin folder
# But don't ignore the specific folder inside the bin folder
1 change: 1 addition & 0 deletions cookbook/specs/spec_add_lava.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"imports": [
"COSMOSSDK"
],
"providers_types": 1,
"reliability_threshold": 268435455,
"data_reliability_enabled": true,
"block_distance_for_finalized_data": 0,
Expand Down
14 changes: 6 additions & 8 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67352,8 +67352,6 @@ definitions:
value:
type: string
addon:
type: string
extensions:
type: array
items:
type: string
Expand Down Expand Up @@ -67822,8 +67820,6 @@ definitions:
value:
type: string
addon:
type: string
extensions:
type: array
items:
type: string
Expand Down Expand Up @@ -67947,8 +67943,6 @@ definitions:
value:
type: string
addon:
type: string
extensions:
type: array
items:
type: string
Expand Down Expand Up @@ -68053,7 +68047,9 @@ definitions:
value:
type: string
addon:
type: string
type: array
items:
type: string
extensions:
type: array
items:
Expand Down Expand Up @@ -68188,7 +68184,9 @@ definitions:
value:
type: string
addon:
type: string
type: array
items:
type: string
extensions:
type: array
items:
Expand Down
3 changes: 2 additions & 1 deletion protocol/rpcprovider/rpcprovider_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ func (rpcps *RPCProviderServer) getSingleProviderSession(ctx context.Context, re
if lavasession.ConsumerNotRegisteredYet.Is(err) {
valid, pairedProviders, verifyPairingError := rpcps.stateTracker.VerifyPairing(ctx, consumerAddressString, rpcps.providerAddress.String(), uint64(request.Epoch), request.SpecId)
if verifyPairingError != nil {
return nil, utils.LavaFormatError("Failed to VerifyPairing after ConsumerNotRegisteredYet", verifyPairingError,
return nil, utils.LavaFormatInfo("Failed to VerifyPairing after ConsumerNotRegisteredYet",
utils.Attribute{Key: "Error", Value: verifyPairingError},
utils.Attribute{Key: "GUID", Value: ctx},
utils.Attribute{Key: "sessionID", Value: request.SessionId},
utils.Attribute{Key: "consumer", Value: consumerAddressString},
Expand Down
18 changes: 17 additions & 1 deletion testutil/e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
# Lava E2E

Run using the following command
Run all our E2E using the following command (from the root)

```
yarn --cwd ./ecosystem/lava-sdk/ build
go test ./testutil/e2e/ -v -timeout 1200s
```

If you wish you can also run E2E tests independently:

1. Lava Protocol E2:

```
go test ./testutil/e2e/ -run ^TestLavaProtocol$ -v -timeout 1200s
```

2. Lava SDK E2E:

```
yarn --cwd ./ecosystem/lava-sdk/ build
go test ./testutil/e2e/ -run ^TestLavaSDK -v -timeout 1200s
```

This E2E performs the steps below to test if the system is working as expected.

1. Start lava in developer mode (equivalent to running the command "ignite chain serve" ).
Expand Down
Loading

0 comments on commit 73911d6

Please sign in to comment.