Skip to content

Commit

Permalink
Merge pull request #71 from smartcontractkit/update_image_CI
Browse files Browse the repository at this point in the history
Fix relay/contracts changes
  • Loading branch information
skudasov authored Feb 3, 2022
2 parents d206947 + 2831de2 commit 10a4b07
Show file tree
Hide file tree
Showing 20 changed files with 799 additions and 199 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/chaos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: chaos
on:
schedule:
- cron: '0 */3 * * *'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/[email protected]
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/[email protected]
with:
path: ~/.cargo/git
key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Build Artifacts
run: |
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer:0.12.4
- uses: actions/upload-artifact@master
with:
name: artifacts
path: artifacts
chaos:
runs-on: ubuntu-latest
needs: build
env:
CGO_ENABLED: 1
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: 1.17
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.QA_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.QA_AWS_SECRET_KEY }}
aws-region: ${{ secrets.QA_AWS_REGION }}
role-to-assume: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 3600
- name: Set Kubernetes Context
uses: azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.QA_KUBECONFIG }}
- name: Cache Vendor Packages
uses: actions/cache@v2
id: cache-packages
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download Go Vendor Packages
if: steps.cache-packages.outputs.cache-hit != 'true'
run: go mod download
- name: Install Ginkgo CLI
run: |
go get github.com/onsi/ginkgo/v2/ginkgo/[email protected]
go get github.com/onsi/ginkgo/v2/ginkgo/[email protected]
go get github.com/onsi/ginkgo/v2/ginkgo/[email protected]
go install github.com/onsi/ginkgo/v2/ginkgo
- uses: actions/download-artifact@master
with:
name: artifacts
path: artifacts
- name: Run Tests
env:
SELECTED_NETWORKS: localterra
NETWORK_SETTINGS: /home/runner/work/chainlink-terra/chainlink-terra/tests/e2e/networks.yaml
run: |
export PATH=$PATH:$(go env GOPATH)/bin
ginkgo tests/e2e/chaos
- name: Publish Test Results
uses: mikepenz/action-junit-report@v2
if: always()
with:
report_paths: "./tests-chaos-report.xml"
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: Chaos Test Results
- name: Publish Artifacts
if: failure()
uses: actions/[email protected]
with:
name: test-logs
path: /home/runner/work/chainlink-terra/chainlink-terra/tests/e2e/logs
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ jobs:
uses: actions/[email protected]
with:
name: test-logs
path: ./logs
path: /home/runner/work/chainlink-terra/chainlink-terra/tests/e2e/logs
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ issues:
text: "^G404:"
linters:
- gosec
- path: tests
linters:
- revive
include:
# Enable GoDoc comment checks.
- EXC0002
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/rs/zerolog v1.26.1
github.com/satori/go.uuid v1.2.0
github.com/smartcontractkit/chainlink v1.0.1-0.20220114200720-95a78cb9fc2b
github.com/smartcontractkit/helmenv v1.0.27
github.com/smartcontractkit/helmenv v1.0.32
github.com/smartcontractkit/integrations-framework v1.0.42
github.com/smartcontractkit/libocr v0.0.0-20220121130134-5d2b1d5f424b
github.com/smartcontractkit/terra.go v1.0.3-0.20220108002221-62b39252ee16
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2346,8 +2346,9 @@ github.com/smartcontractkit/chainlink-terra v0.0.0-20220114184203-9ed72d62eaac/g
github.com/smartcontractkit/ed25519consensus v0.0.1 h1:Ta23Y6YJTACLCpKWSWAwgHCtkmWrGGfrUAV8Ns5r4z0=
github.com/smartcontractkit/ed25519consensus v0.0.1/go.mod h1:8Wf0F4mu3B5DdEOFKMMLgSoZ8EyaA2Cmf4YMUsNHXzE=
github.com/smartcontractkit/helmenv v1.0.20/go.mod h1:oFDq/QeOcHMJ8Cl+UEOA3tAmYMHo2ONxOsMYvbzg91E=
github.com/smartcontractkit/helmenv v1.0.27 h1:BVxTQZQlFElh6YVK8mY9LSljX7uyx4jyImmHh/fMqEo=
github.com/smartcontractkit/helmenv v1.0.27/go.mod h1:ef0doolSZf8ckqaWMIK2M+EPXdIKYVzttd6EXaCgCK4=
github.com/smartcontractkit/helmenv v1.0.32 h1:CX8bcmZOsAPbhwdUbaD4AJxqgJV6R1CfgEb0YjT8CAc=
github.com/smartcontractkit/helmenv v1.0.32/go.mod h1:ef0doolSZf8ckqaWMIK2M+EPXdIKYVzttd6EXaCgCK4=
github.com/smartcontractkit/integrations-framework v1.0.21/go.mod h1:mceWG89OYgDkqIVD64Ocp2pn1utqoHAC4ycVV33JOTo=
github.com/smartcontractkit/integrations-framework v1.0.24/go.mod h1:yFgbE88F6+om0jo5mFskgKEQBnxqfYg6H1OL2dCIekk=
github.com/smartcontractkit/integrations-framework v1.0.42 h1:3AGYdYz86Jl10eXagmhFGvIyDZdDPcZ/JwqkUlCzXTE=
Expand Down
6 changes: 6 additions & 0 deletions ops/Pulumi.localterra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ config:
- FEATURE_OFFCHAIN_REPORTING2
- P2P_NETWORKING_STACK
- P2P_LISTEN_PORT
- EVM_ENABLED
- EVM_RPC_ENABLED
- TERRA_ENABLED
terra-env:CL-CHAINLINK_DEV: true
terra-env:CL-EVM_ENABLED: false
terra-env:CL-EVM_RPC_ENABLED: false
terra-env:CL-TERRA_ENABLED: true
terra-env:CL-LOG_LEVEL: "debug"
terra-env:CL-ETH_DISABLED: true
terra-env:CL-USE_LEGACY_ETH_ENV_VARS: false
Expand Down
13 changes: 13 additions & 0 deletions tests/e2e/chaos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Persistent K8s env chaos test run
In order to deploy contracts and env only once and then run chaos suite:
1. Paste version of image you want to run in `chainlink-relay-terra.yaml`
2. Spin up an environment
```shell
envcli new --preset chainlink-relay-terra.yaml
```
3. Run initial test
```shell
SELECTED_NETWORKS="localterra" NETWORK_SETTINGS="${YOUR_NETWORKS_FILE}" ENVIRONMENT_FILE="${YOUR_ENV_YAML}" ginkgo tests/e2e/chaos
```
4. Set `contracts_deployed: true` in `networks.yaml`
5. Run tests again
33 changes: 33 additions & 0 deletions tests/e2e/chaos/chainlink-relay-terra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace_prefix: chainlink
charts:
localterra:
index: 1
mockserver-config:
index: 2
mockserver:
index: 3
chainlink:
index: 4
values:
replicas: 5
chainlink:
image:
image: "public.ecr.aws/z0b1w9r9/chainlink"
version: "candidate-develop-terr-qa-test-feb-02.ea461a08f1927b99f37fac4b078cd4b42a88995a"
db:
stateful: true
capacity: 2Gi
env:
EVM_ENABLED: "false"
EVM_RPC_ENABLED: "false"
TERRA_ENABLED: "true"
eth_disabled: "true"
CHAINLINK_DEV: "true"
USE_LEGACY_ETH_ENV_VARS: "true"
feature_external_initiators: "true"
FEATURE_OFFCHAIN_REPORTING2: "true"
P2P_NETWORKING_STACK: "V2"
P2PV2_LISTEN_ADDRESSES: "0.0.0.0:6690"
P2PV2_DELTA_DIAL: "5s"
P2PV2_DELTA_RECONCILE: "5s"
p2p_listen_port: "0"
51 changes: 51 additions & 0 deletions tests/e2e/chaos/chaos_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package chaos

import (
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
tc "github.com/smartcontractkit/chainlink-terra/tests/e2e/common"
"github.com/smartcontractkit/chainlink-terra/tests/e2e/smoke/common"
"github.com/smartcontractkit/integrations-framework/actions"
)

var _ = Describe("Solana chaos suite", func() {
var state = &common.OCRv2State{}
BeforeEach(func() {
By("Deploying OCRv2 cluster", func() {
state.DeployCluster(5, true)
state.LabelChaosGroups()
tc.ImitateSource(state.MockServer, common.SourceChangeInterval, 2, 10)
})
})
It("Can tolerate chaos experiments", func() {
By("Stable and working", func() {
state.ValidateRoundsAfter(time.Now(), 10)
})
By("Can work with faulty nodes offline", func() {
state.CanWorkWithFaultyNodesOffline()
})
By("Can't work when more than faulty nodes are offline", func() {
state.CantWorkWithMoreThanFaultyNodesSplit()
})
By("Can't work with two parts network split, restored after", func() {
state.RestoredAfterNetworkSplit()
})
By("Can recover from yellow group loss connection to validator", func() {
state.CanWorkYellowGroupNoValidatorConnection()
})
By("Can recover after all nodes lost connection to validator", func() {
state.CanRecoverAllNodesValidatorConnectionLoss()
})
By("Can work after all nodes restarted", func() {
state.CanWorkAfterAllNodesRestarted()
})
})
AfterEach(func() {
By("Tearing down the environment", func() {
err := actions.TeardownSuite(state.Env, nil, "logs")
Expect(err).ShouldNot(HaveOccurred())
})
})
})
13 changes: 13 additions & 0 deletions tests/e2e/chaos/suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package chaos_test

import (
"github.com/smartcontractkit/chainlink-terra/tests/e2e/utils"
"testing"

. "github.com/onsi/ginkgo/v2"
)

func Test_Suite(t *testing.T) {
utils.GinkgoSuite()
RunSpecs(t, "Chaos")
}
4 changes: 2 additions & 2 deletions tests/e2e/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
)

type NetworkConfig struct {
ContractDeployed bool `mapstructure:"contracts_deployed" yaml:"contract_deployed"`
ContractDeployed bool `mapstructure:"contracts_deployed" yaml:"contracts_deployed"`
External bool `mapstructure:"external" yaml:"external"`
Currency string `mapstructure:"currency" yaml:"currency"`
Name string `mapstructure:"name" yaml:"name"`
Expand Down Expand Up @@ -116,7 +116,7 @@ func ClientInitFunc() func(networkName string, networkConfig map[string]interfac
return nil, err
}
var cfg *NetworkConfig
if err := yaml.Unmarshal(d, &cfg); err != nil {
if err = yaml.Unmarshal(d, &cfg); err != nil {
return nil, err
}
cfg.ID = networkName
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"golang.org/x/crypto/curve25519"
)

// TODO: those should be moved as a common part of integrations-framework

const (
ChainName = "terra"
)
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func (t *ContractDeployer) DeployOCRv2(paymentControllerAddr string, requesterCo
return nil, err
}
return &OCRv2{
client: t.client,
address: addr,
Client: t.client,
Addr: addr,
}, nil
}

Expand Down
20 changes: 15 additions & 5 deletions tests/e2e/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package e2e
import "github.com/smartcontractkit/helmenv/environment"

// NewChainlinkTerraEnv returns a cluster config with LocalTerra node
func NewChainlinkTerraEnv() *environment.Config {
return &environment.Config{
func NewChainlinkTerraEnv(nodes int, stateful bool) *environment.Config {
env := &environment.Config{
NamespacePrefix: "chainlink-terra",
Charts: environment.Charts{
"localterra": {
Expand All @@ -19,14 +19,17 @@ func NewChainlinkTerraEnv() *environment.Config {
"chainlink": {
Index: 4,
Values: map[string]interface{}{
"replicas": 5,
"replicas": nodes,
"chainlink": map[string]interface{}{
"image": map[string]interface{}{
"image": "public.ecr.aws/z0b1w9r9/chainlink",
"version": "develop.3abacbfc0761b4f6cf4d4d897bb4f94d05a4f793",
"image": "795953128386.dkr.ecr.us-west-2.amazonaws.com/chainlink",
"version": "develop.latest",
},
},
"env": map[string]interface{}{
"EVM_ENABLED": "false",
"EVM_RPC_ENABLED": "false",
"TERRA_ENABLED": "true",
"eth_disabled": "true",
"CHAINLINK_DEV": "true",
"USE_LEGACY_ETH_ENV_VARS": "false",
Expand All @@ -42,4 +45,11 @@ func NewChainlinkTerraEnv() *environment.Config {
},
},
}
if stateful {
env.Charts["chainlink"].Values["db"] = map[string]interface{}{
"stateful": true,
"capacity": "2Gi",
}
}
return env
}
1 change: 1 addition & 0 deletions tests/e2e/networks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ networks:
name: "localterra"
type: terra
currency: uluna
contracts_deployed: false
mnemonics:
# prefunded default LocalTerra mnemonics
- satisfy adjust timber high purchase tuition stool faith fine install that you unaware feed domain license impose boss human eager hat rent enjoy dawn
Expand Down
Loading

0 comments on commit 10a4b07

Please sign in to comment.