Skip to content

Commit

Permalink
simplify configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov committed Oct 24, 2024
1 parent 2ddc36c commit 1a42ebb
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 108 deletions.
7 changes: 7 additions & 0 deletions e2e/capabilities/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export CTF_CONFIGS=smoke.toml,smoke-another-network.toml
```
Changes will be applied right to left

## Default CLNode credentials
UI login/password:
```
[email protected]
fj293fbBnlQ!f9vNs
```

### Caching
You can re-use already deployed environment and contracts like this
1. Run your test once
Expand Down
7 changes: 4 additions & 3 deletions e2e/capabilities/components/onchain/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import (
)

type Input struct {
URL string `toml:"url" validate:"required"`
URL string `toml:"url"`
Out *Output `toml:"out"`
}

type Output struct {
Use bool `toml:"use"`
UseCache bool `toml:"use_cache"`
Addresses []common.Address `toml:"addresses"`
}

func NewProductOnChainDeployment(in *Input) (*Output, error) {
if in.Out.Use {
if in.Out.UseCache {
return in.Out, nil
}

Expand Down Expand Up @@ -49,6 +49,7 @@ func NewProductOnChainDeployment(in *Input) (*Output, error) {
}

out := &Output{
UseCache: true,
// save all the addresses to output, so it can be cached
Addresses: []common.Address{addr},
}
Expand Down
91 changes: 6 additions & 85 deletions e2e/capabilities/smoke.toml
Original file line number Diff line number Diff line change
@@ -1,100 +1,21 @@
[contracts]
url = 'placeholder'

[blockchain_a]
chain_id = "31337"
docker_cmd_params = ["--block-time=1"]
type = "anvil"
image = "f4hrenh9it/foundry"
port = "8500"
tag = "latest"
type = "anvil"
pull_image = true

[data_provider]
port = 9111

[don]
nodes = 5

[[don.nodes]]
[don.node_spec]
data_provider_url = "http://host.docker.internal:9111"

[don.nodes.db]
database = "chainlink"
password = "thispasswordislongenough"
port = "5432"
user = "chainlink"
image = "postgres"
tag = "15.6"
pull_image = true

[don.nodes.node]
image = "public.ecr.aws/chainlink/chainlink"
port = "6688"
tag = "v2.17.0"
test_config_overrides = "\n\t[[EVM]]\n\tChainID = '31337'\n\tMinIncomingConfirmations = 1\n\tMinContractPayment = '0.0001 link'\n\n\t\n\t[[EVM.Nodes]]\n\tName = 'default'\n\tWsUrl = 'ws://anvil-c0b98:8500'\n\tHttpUrl = 'http://anvil-c0b98:8500'\n\t\n\t"
test_secrets_overrides = ""
user_config_overrides = "[Pyroscope]\nServerAddress = 'http://host.docker.internal:4040'\nEnvironment = 'mainnet'\n[Log]\nLevel = 'debug'"
user_secrets_overrides = ""

[[don.nodes]]
data_provider_url = "http://host.docker.internal:9111"

[don.nodes.db]
database = "chainlink"
password = "thispasswordislongenough"
port = "5432"
user = "chainlink"
image = "postgres"
tag = "15.6"
pull_image = true

[don.nodes.node]
image = "public.ecr.aws/chainlink/chainlink"
port = "6688"
tag = "v2.17.0"
test_config_overrides = "\n\t[[EVM]]\n\tChainID = '31337'\n\tMinIncomingConfirmations = 1\n\tMinContractPayment = '0.0001 link'\n\n\t\n\t[[EVM.Nodes]]\n\tName = 'default'\n\tWsUrl = 'ws://anvil-c0b98:8500'\n\tHttpUrl = 'http://anvil-c0b98:8500'\n\t\n\t"
test_secrets_overrides = ""
user_config_overrides = "[Pyroscope]\nServerAddress = 'http://host.docker.internal:4040'\nEnvironment = 'mainnet'\n[Log]\nLevel = 'debug'"
user_secrets_overrides = ""

[[don.nodes]]
data_provider_url = "http://host.docker.internal:9111"

[don.nodes.db]
database = "chainlink"
password = "thispasswordislongenough"
port = "5432"
user = "chainlink"
image = "postgres"
tag = "15.6"
pull_image = true

[don.nodes.node]
image = "public.ecr.aws/chainlink/chainlink"
port = "6688"
tag = "v2.17.0"
test_config_overrides = "\n\t[[EVM]]\n\tChainID = '31337'\n\tMinIncomingConfirmations = 1\n\tMinContractPayment = '0.0001 link'\n\n\t\n\t[[EVM.Nodes]]\n\tName = 'default'\n\tWsUrl = 'ws://anvil-c0b98:8500'\n\tHttpUrl = 'http://anvil-c0b98:8500'\n\t\n\t"
test_secrets_overrides = ""
user_config_overrides = "[Pyroscope]\nServerAddress = 'http://host.docker.internal:4040'\nEnvironment = 'mainnet'\n[Log]\nLevel = 'debug'"
user_secrets_overrides = ""

[[don.nodes]]
data_provider_url = "http://host.docker.internal:9111"

[don.nodes.db]
database = "chainlink"
password = "thispasswordislongenough"
port = "5432"
user = "chainlink"
image = "postgres"
tag = "15.6"
pull_image = true

[don.nodes.node]
[don.node_spec.node]
image = "public.ecr.aws/chainlink/chainlink"
port = "6688"
tag = "v2.17.0"
test_config_overrides = "\n\t[[EVM]]\n\tChainID = '31337'\n\tMinIncomingConfirmations = 1\n\tMinContractPayment = '0.0001 link'\n\n\t\n\t[[EVM.Nodes]]\n\tName = 'default'\n\tWsUrl = 'ws://anvil-c0b98:8500'\n\tHttpUrl = 'http://anvil-c0b98:8500'\n\t\n\t"
test_secrets_overrides = ""
user_config_overrides = "[Pyroscope]\nServerAddress = 'http://host.docker.internal:4040'\nEnvironment = 'mainnet'\n[Log]\nLevel = 'debug'"
user_secrets_overrides = ""
user_config_overrides = """
"""
22 changes: 5 additions & 17 deletions e2e/capabilities/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/clclient"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/don"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/fake"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/simple_don"
burn_mint_erc677 "github.com/smartcontractkit/chainlink/e2e/capabilities/components/gethwrappers"
"github.com/smartcontractkit/chainlink/e2e/capabilities/components/onchain"
"github.com/smartcontractkit/seth"
Expand All @@ -19,7 +19,7 @@ type Config struct {
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
Contracts *onchain.Input `toml:"contracts" validate:"required"`
MockerDataProvider *fake.Input `toml:"data_provider" validate:"required"`
DONInput *don.Input `toml:"don" validate:"required"`
DON *simple_don.Input `toml:"don" validate:"required"`
}

func TestDON(t *testing.T) {
Expand All @@ -31,9 +31,8 @@ func TestDON(t *testing.T) {
require.NoError(t, err)
dp, err := fake.NewFakeDataProvider(in.MockerDataProvider)
require.NoError(t, err)
out, err := don.NewBasicDON(in.DONInput, bc, dp.BaseURLDocker)
require.NoError(t, err)
for i, n := range out.Nodes {
out, err := simple_don.NewSimpleDON(in.DON, bc, dp.BaseURLDocker)
for i, n := range out.CLNodes {
fmt.Printf("Node %d --> %s\n", i, n.Node.HostURL)
}

Expand All @@ -48,7 +47,7 @@ func TestDON(t *testing.T) {
Build()
require.NoError(t, err)

c, err := clclient.NewCLCDefaultlients(out.Nodes, framework.L)
c, err := clclient.NewCLCDefaultlients(out.CLNodes, framework.L)
require.NoError(t, err)

t.Run("smoke test", func(t *testing.T) {
Expand Down Expand Up @@ -81,15 +80,4 @@ func TestDON(t *testing.T) {
fmt.Printf("error: %v", err)
fmt.Println(r)
})

//t.Run("can access mockserver", func(t *testing.T) {
// // on the host, locally
// client := resty.New()
// _, err := client.R().
// Get(fmt.Sprintf("%s/mock1", dp.BaseURLHost))
// require.NoError(t, err)
// // other components can access inside docker like this
// err = components.NewDockerFakeTester(fmt.Sprintf("%s/mock1", dp.BaseURLDocker))
// require.NoError(t, err)
//})
}
2 changes: 1 addition & 1 deletion e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ go 1.22.8

require (
github.com/ethereum/go-ethereum v1.14.11
github.com/smartcontractkit/chainlink-testing-framework/framework v0.1.1-0.20241023180024-1e79db929d1b
github.com/smartcontractkit/chainlink-testing-framework/framework v0.1.1-0.20241024102847-2b5f94e7169e
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.4
github.com/smartcontractkit/seth v1.2.1-0.20240827060008-860f949fcb26
github.com/stretchr/testify v1.9.0
Expand Down
5 changes: 3 additions & 2 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartcontractkit/chainlink-testing-framework/framework v0.1.1-0.20241023180024-1e79db929d1b h1:vBQ5AKMd/i2COawuvcI6vCuh2EIMtrftGa4cD+0fadM=
github.com/smartcontractkit/chainlink-testing-framework/framework v0.1.1-0.20241023180024-1e79db929d1b/go.mod h1:yn9pctizXEn8Y06IJ1RwAUH8eDKXuNOPMm13wqyWlUo=
github.com/smartcontractkit/chainlink-testing-framework/framework v0.1.1-0.20241024093214-dbfa846cbaf5/go.mod h1:yn9pctizXEn8Y06IJ1RwAUH8eDKXuNOPMm13wqyWlUo=
github.com/smartcontractkit/chainlink-testing-framework/framework v0.1.1-0.20241024102847-2b5f94e7169e h1:5RRfTpA0sQ6DpmQb2uqZwaOPjxj9qoA3ifx6w5kFVHE=
github.com/smartcontractkit/chainlink-testing-framework/framework v0.1.1-0.20241024102847-2b5f94e7169e/go.mod h1:yn9pctizXEn8Y06IJ1RwAUH8eDKXuNOPMm13wqyWlUo=
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.4 h1:hPI9GhHE1RmIG1oyPeFjED0AhWnNb9JzD74Oq2bO+IQ=
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.4/go.mod h1:afY3QmNgeR/VI1pRbGH8g3YXGy7C2RrFOwUzEFvL3L8=
github.com/smartcontractkit/seth v1.2.1-0.20240827060008-860f949fcb26 h1:9c3dbd38M8T/Hkc9LKOSRf3wxfXAFNJcLnEPOBOctNk=
Expand Down

0 comments on commit 1a42ebb

Please sign in to comment.