Skip to content

Commit

Permalink
[TT-1259] Save PostgresDB logs (#13464)
Browse files Browse the repository at this point in the history
* connect log stream also to postgresdb

* go mod tidy

* use tagged CTF

* use boring solution
  • Loading branch information
Tofel authored Jun 10, 2024
1 parent 592b2bb commit af2a46f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
12 changes: 4 additions & 8 deletions integration-tests/docker/test_env/cl_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ func WithDbContainerName(name string) ClNodeOption {
}
}

func WithLogStream(ls *logstream.LogStream) ClNodeOption {
return func(c *ClNode) {
c.LogStream = ls
}
}

func WithImage(image string) ClNodeOption {
return func(c *ClNode) {
c.ContainerImage = image
Expand All @@ -124,10 +118,11 @@ func WithPgDBOptions(opts ...test_env.PostgresDbOption) ClNodeOption {
}
}

func NewClNode(networks []string, imageName, imageVersion string, nodeConfig *chainlink.Config, opts ...ClNodeOption) (*ClNode, error) {
func NewClNode(networks []string, imageName, imageVersion string, nodeConfig *chainlink.Config, logStream *logstream.LogStream, opts ...ClNodeOption) (*ClNode, error) {
nodeDefaultCName := fmt.Sprintf("%s-%s", "cl-node", uuid.NewString()[0:8])
pgDefaultCName := fmt.Sprintf("pg-%s", nodeDefaultCName)
pgDb, err := test_env.NewPostgresDb(networks, test_env.WithPostgresDbContainerName(pgDefaultCName))

pgDb, err := test_env.NewPostgresDb(networks, test_env.WithPostgresDbContainerName(pgDefaultCName), test_env.WithPostgresDbLogStream(logStream))
if err != nil {
return nil, err
}
Expand All @@ -137,6 +132,7 @@ func NewClNode(networks []string, imageName, imageVersion string, nodeConfig *ch
ContainerImage: imageName,
ContainerVersion: imageVersion,
Networks: networks,
LogStream: logStream,
},
UserEmail: "local@local.com",
UserPassword: "localdevpassword",
Expand Down
5 changes: 2 additions & 3 deletions integration-tests/docker/test_env/test_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ func (te *CLClusterTestEnv) StartMockAdapter() error {
return te.MockAdapter.StartContainer()
}

// pass config here
func (te *CLClusterTestEnv) StartClCluster(nodeConfig *chainlink.Config, count int, secretsConfig string, testconfig ctf_config.GlobalTestConfig, opts ...ClNodeOption) error {
if te.Cfg != nil && te.Cfg.ClCluster != nil {
te.ClCluster = te.Cfg.ClCluster
Expand All @@ -144,10 +143,10 @@ func (te *CLClusterTestEnv) StartClCluster(nodeConfig *chainlink.Config, count i
},
}, opts...)
}
opts = append(opts, WithSecrets(secretsConfig), WithLogStream(te.LogStream))
opts = append(opts, WithSecrets(secretsConfig))
te.ClCluster = &ClCluster{}
for i := 0; i < count; i++ {
ocrNode, err := NewClNode([]string{te.DockerNetwork.Name}, *testconfig.GetChainlinkImageConfig().Image, *testconfig.GetChainlinkImageConfig().Version, nodeConfig, opts...)
ocrNode, err := NewClNode([]string{te.DockerNetwork.Name}, *testconfig.GetChainlinkImageConfig().Image, *testconfig.GetChainlinkImageConfig().Version, nodeConfig, te.LogStream, opts...)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ require (
github.com/slack-go/slack v0.12.2
github.com/smartcontractkit/chainlink-automation v1.0.3
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240607135320-c9bc0a2ac0ce
github.com/smartcontractkit/chainlink-testing-framework v1.30.1
github.com/smartcontractkit/chainlink-testing-framework v1.30.2
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1524,8 +1524,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240605170242-555ff582f36
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240605170242-555ff582f36a/go.mod h1:QqcZSwLgEIn7YraAIRmomnBMAuVFephiHrIWVlkWbFI=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240531021326-99118e47f696 h1:h1E87+z+JcUEfvbJVF56SnZA/YUFE5ewUE61MaR/Ewg=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240531021326-99118e47f696/go.mod h1:OiWUTrrpSLLTMh7FINWjEh6mmDJCVPaC4yEsDCVaWdU=
github.com/smartcontractkit/chainlink-testing-framework v1.30.1 h1:JFoeSuOvdx8Rmfh5Z4KOH0FnjiLw3M2p7T4GLzTPLMk=
github.com/smartcontractkit/chainlink-testing-framework v1.30.1/go.mod h1:oEIggLGWyWfLkjWvuXLol8inUT4YbBb06fJx/S60gQ4=
github.com/smartcontractkit/chainlink-testing-framework v1.30.2 h1:PKAg0nVT6clcTYebm3Q0rhTId+5xE9wYyvFxxSg4+lI=
github.com/smartcontractkit/chainlink-testing-framework v1.30.2/go.mod h1:oEIggLGWyWfLkjWvuXLol8inUT4YbBb06fJx/S60gQ4=
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449 h1:fX/xmGm1GBsD1ZZnooNT+eWA0hiTAqFlHzOC5CY4dy8=
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449/go.mod h1:DC8sQMyTlI/44UCTL8QWFwb0bYNoXCfjwCv2hMivYZU=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/load/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/slack-go/slack v0.12.2
github.com/smartcontractkit/chainlink-automation v1.0.3
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240607135320-c9bc0a2ac0ce
github.com/smartcontractkit/chainlink-testing-framework v1.30.1
github.com/smartcontractkit/chainlink-testing-framework v1.30.2
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240214231432-4ad5eb95178c
github.com/smartcontractkit/chainlink/v2 v2.9.0-beta0.0.20240216210048-da02459ddad8
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/load/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1514,8 +1514,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240605170242-555ff582f36
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240605170242-555ff582f36a/go.mod h1:QqcZSwLgEIn7YraAIRmomnBMAuVFephiHrIWVlkWbFI=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240531021326-99118e47f696 h1:h1E87+z+JcUEfvbJVF56SnZA/YUFE5ewUE61MaR/Ewg=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240531021326-99118e47f696/go.mod h1:OiWUTrrpSLLTMh7FINWjEh6mmDJCVPaC4yEsDCVaWdU=
github.com/smartcontractkit/chainlink-testing-framework v1.30.1 h1:JFoeSuOvdx8Rmfh5Z4KOH0FnjiLw3M2p7T4GLzTPLMk=
github.com/smartcontractkit/chainlink-testing-framework v1.30.1/go.mod h1:oEIggLGWyWfLkjWvuXLol8inUT4YbBb06fJx/S60gQ4=
github.com/smartcontractkit/chainlink-testing-framework v1.30.2 h1:PKAg0nVT6clcTYebm3Q0rhTId+5xE9wYyvFxxSg4+lI=
github.com/smartcontractkit/chainlink-testing-framework v1.30.2/go.mod h1:oEIggLGWyWfLkjWvuXLol8inUT4YbBb06fJx/S60gQ4=
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449 h1:fX/xmGm1GBsD1ZZnooNT+eWA0hiTAqFlHzOC5CY4dy8=
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449/go.mod h1:DC8sQMyTlI/44UCTL8QWFwb0bYNoXCfjwCv2hMivYZU=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 h1:FFdvEzlYwcuVHkdZ8YnZR/XomeMGbz5E2F2HZI3I3w8=
Expand Down

0 comments on commit af2a46f

Please sign in to comment.