|
1 | 1 | # Node |
| 2 | + |
| 3 | +Here we provide *full* configuration parameters for `Node` |
| 4 | + |
| 5 | +<div class="warning"> |
| 6 | +Here we provide full configuration reference, if you want to copy and run it, please remove all .out fields before! |
| 7 | +</div> |
| 8 | + |
| 9 | + |
| 10 | +## Configuration |
| 11 | +```toml |
| 12 | +[cl_node] |
| 13 | + # Optional URL for fake data provider URL |
| 14 | + # usually set up in test with local mock server |
| 15 | + data_provider_url = "http://example.com" |
| 16 | + |
| 17 | + [cl_node.db] |
| 18 | + # PostgreSQL image version and tag |
| 19 | + image = "postgres:15.6" |
| 20 | + # Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs |
| 21 | + pull_image = true |
| 22 | + |
| 23 | + [cl_node.node] |
| 24 | + # A list of paths to capability binaries |
| 25 | + capabilities = ["./capability_1", "./capability_2"] |
| 26 | + # Default capabilities directory inside container |
| 27 | + capabilities_container_dir = "/home/capabilities" |
| 28 | + # Image to use, you can either provide "image" or "docker_file" + "docker_ctx" fields |
| 29 | + image = "public.ecr.aws/chainlink/chainlink:v2.17.0" |
| 30 | + # Path to your Chainlink Dockerfile |
| 31 | + docker_file = "../../core/chainlink.Dockerfile" |
| 32 | + # Path to docker context that should be used to build from |
| 33 | + docker_ctx = "../.." |
| 34 | + # Optional name for image we build, default is "ctftmp" |
| 35 | + docker_image_name = "ctftmp" |
| 36 | + # Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs |
| 37 | + pull_image = true |
| 38 | + # Overrides Chainlink node TOML configuration |
| 39 | + # can be multiline, see example |
| 40 | + user_config_overrides = """ |
| 41 | + [Log] |
| 42 | + level = 'info' |
| 43 | + """ |
| 44 | + # Overrides Chainlink node secrets TOML configuration |
| 45 | + # you can only add fields, overriding existing fields is prohibited by Chainlink node |
| 46 | + user_secrets_overrides = """ |
| 47 | + [AnotherSecret] |
| 48 | + mySecret = 'a' |
| 49 | + """ |
| 50 | + |
| 51 | + # Outputs are the results of deploying a component that can be used by another component |
| 52 | + [cl_node.out] |
| 53 | + # If 'use_cache' equals 'true' we skip component setup when we run the test and return the outputs |
| 54 | + use_cache = true |
| 55 | + # Describes deployed or external Chainlink node |
| 56 | + [cl_node.out.node] |
| 57 | + # Host Docker URLs the test uses |
| 58 | + # in case of using external component you can replace these URLs with another deployment |
| 59 | + p2p_url = "http://127.0.0.1:32812" |
| 60 | + url = "http://127.0.0.1:32847" |
| 61 | + |
| 62 | + # Describes deployed or external Chainlink node |
| 63 | + [cl_node.out.postgresql] |
| 64 | + # PostgreSQL connection string |
| 65 | + # in case of using external database can be overriden |
| 66 | + url = "postgresql://chainlink:[email protected]:32846/chainlink?sslmode=disable" |
| 67 | +``` |
| 68 | + |
| 69 | +## Usage |
| 70 | +```golang |
| 71 | +package yourpackage_test |
| 72 | + |
| 73 | +import ( |
| 74 | + "fmt" |
| 75 | + "github.com/smartcontractkit/chainlink-testing-framework/framework" |
| 76 | + "github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" |
| 77 | + "github.com/smartcontractkit/chainlink-testing-framework/framework/components/clnode" |
| 78 | + "github.com/stretchr/testify/require" |
| 79 | + "testing" |
| 80 | +) |
| 81 | + |
| 82 | +type Step2Cfg struct { |
| 83 | + BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"` |
| 84 | + CLNode *clnode.Input `toml:"cl_node" validate:"required"` |
| 85 | +} |
| 86 | + |
| 87 | +func TestMe(t *testing.T) { |
| 88 | + in, err := framework.Load[Step2Cfg](t) |
| 89 | + require.NoError(t, err) |
| 90 | + |
| 91 | + bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA) |
| 92 | + require.NoError(t, err) |
| 93 | + |
| 94 | + networkCfg, err := clnode.NewNetworkCfgOneNetworkAllNodes(bc) |
| 95 | + require.NoError(t, err) |
| 96 | + in.CLNode.Node.TestConfigOverrides = networkCfg |
| 97 | + |
| 98 | + output, err := clnode.NewNodeWithDB(in.CLNode) |
| 99 | + require.NoError(t, err) |
| 100 | + |
| 101 | + t.Run("test something", func(t *testing.T) { |
| 102 | + fmt.Printf("node url: %s\n", output.Node.HostURL) |
| 103 | + require.NotEmpty(t, output.Node.HostURL) |
| 104 | + }) |
| 105 | +} |
| 106 | +``` |
0 commit comments