@@ -10,28 +10,31 @@ import (
1010 tc "github.com/testcontainers/testcontainers-go"
1111 "github.com/testcontainers/testcontainers-go/wait"
1212 "os"
13+ "path/filepath"
1314 "text/template"
1415 "time"
1516)
1617
1718// Input represents Chainlink node input
1819type Input struct {
19- DataProviderURL string `toml:"data_provider_url" validate:"required"`
20+ DataProviderURL string `toml:"data_provider_url" validate:"required" default:"http://host.docker.internal:9111" `
2021 DbInput * postgres.Input `toml:"db" validate:"required"`
2122 Node * NodeInput `toml:"node" validate:"required"`
2223 Out * Output `toml:"out"`
2324}
2425
2526// NodeInput is CL nod container inputs
2627type NodeInput struct {
27- Image string `toml:"image" validate:"required"`
28- Tag string `toml:"tag" validate:"required"`
29- PullImage bool `toml:"pull_image" default:"true"`
30- Port string `toml:"port" validate:"required" default:"6688"`
31- TestConfigOverrides string `toml:"test_config_overrides"`
32- UserConfigOverrides string `toml:"user_config_overrides"`
33- TestSecretsOverrides string `toml:"test_secrets_overrides"`
34- UserSecretsOverrides string `toml:"user_secrets_overrides"`
28+ Image string `toml:"image" validate:"required"`
29+ Tag string `toml:"tag" validate:"required"`
30+ PullImage bool `toml:"pull_image" default:"true"`
31+ Port string `toml:"port" validate:"required" default:"6688"`
32+ CapabilitiesBinaryPaths []string `toml:"capabilities"`
33+ CapabilityContainerDir string `toml:"capabilities_container_dir" default:"/capabilities"`
34+ TestConfigOverrides string `toml:"test_config_overrides"`
35+ UserConfigOverrides string `toml:"user_config_overrides"`
36+ TestSecretsOverrides string `toml:"test_secrets_overrides"`
37+ UserSecretsOverrides string `toml:"user_secrets_overrides"`
3538}
3639
3740// Output represents Chainlink node output, nodes and databases connection URLs
@@ -123,50 +126,60 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
123126 "/bin/sh" , "-c" ,
124127 "chainlink -c /config/config -c /config/overrides -c /config/user-overrides -s /config/secrets -s /config/secrets-overrides -s /config/user-secrets-overrides node start -d -p /config/node_password -a /config/apicredentials" ,
125128 },
126- Files : []tc.ContainerFile {
127- {
128- HostFilePath : cfgPath .Name (),
129- ContainerFilePath : "/config/config" ,
130- FileMode : 0644 ,
131- },
132- {
133- HostFilePath : secretsPath .Name (),
134- ContainerFilePath : "/config/secrets" ,
135- FileMode : 0644 ,
136- },
137- {
138- HostFilePath : overridesFile .Name (),
139- ContainerFilePath : "/config/overrides" ,
140- FileMode : 0644 ,
141- },
142- {
143- HostFilePath : userOverridesFile .Name (),
144- ContainerFilePath : "/config/user-overrides" ,
145- FileMode : 0644 ,
146- },
147- {
148- HostFilePath : secretsOverridesFile .Name (),
149- ContainerFilePath : "/config/secrets-overrides" ,
150- FileMode : 0644 ,
151- },
152- {
153- HostFilePath : userSecretsOverridesFile .Name (),
154- ContainerFilePath : "/config/user-secrets-overrides" ,
155- FileMode : 0644 ,
156- },
157- {
158- HostFilePath : passwordPath .Name (),
159- ContainerFilePath : "/config/node_password" ,
160- FileMode : 0644 ,
161- },
162- {
163- HostFilePath : apiCredentialsPath .Name (),
164- ContainerFilePath : "/config/apicredentials" ,
165- FileMode : 0644 ,
166- },
167- },
168129 WaitingFor : wait .ForLog ("Listening and serving HTTP" ).WithStartupTimeout (2 * time .Minute ),
169130 }
131+ files := []tc.ContainerFile {
132+ {
133+ HostFilePath : cfgPath .Name (),
134+ ContainerFilePath : "/config/config" ,
135+ FileMode : 0644 ,
136+ },
137+ {
138+ HostFilePath : secretsPath .Name (),
139+ ContainerFilePath : "/config/secrets" ,
140+ FileMode : 0644 ,
141+ },
142+ {
143+ HostFilePath : overridesFile .Name (),
144+ ContainerFilePath : "/config/overrides" ,
145+ FileMode : 0644 ,
146+ },
147+ {
148+ HostFilePath : userOverridesFile .Name (),
149+ ContainerFilePath : "/config/user-overrides" ,
150+ FileMode : 0644 ,
151+ },
152+ {
153+ HostFilePath : secretsOverridesFile .Name (),
154+ ContainerFilePath : "/config/secrets-overrides" ,
155+ FileMode : 0644 ,
156+ },
157+ {
158+ HostFilePath : userSecretsOverridesFile .Name (),
159+ ContainerFilePath : "/config/user-secrets-overrides" ,
160+ FileMode : 0644 ,
161+ },
162+ {
163+ HostFilePath : passwordPath .Name (),
164+ ContainerFilePath : "/config/node_password" ,
165+ FileMode : 0644 ,
166+ },
167+ {
168+ HostFilePath : apiCredentialsPath .Name (),
169+ ContainerFilePath : "/config/apicredentials" ,
170+ FileMode : 0644 ,
171+ },
172+ }
173+ for _ , cp := range in .Node .CapabilitiesBinaryPaths {
174+ cpPath := filepath .Base (cp )
175+ framework .L .Info ().Any ("Path" , cpPath ).Str ("Binary" , cpPath ).Msg ("Copying capability binary" )
176+ files = append (files , tc.ContainerFile {
177+ HostFilePath : cp ,
178+ ContainerFilePath : filepath .Join (in .Node .CapabilityContainerDir , cpPath ),
179+ FileMode : 0644 ,
180+ })
181+ }
182+ req .Files = append (req .Files , files ... )
170183 c , err := tc .GenericContainer (ctx , tc.GenericContainerRequest {
171184 ContainerRequest : req ,
172185 Started : true ,
0 commit comments