Skip to content

Commit

Permalink
[TT-758] Fixes Upgrade Test (#11589)
Browse files Browse the repository at this point in the history
* Fixes Upgrade Test

* Comment

* Ani's comments

* Mod tidy

* Mod tidy again
  • Loading branch information
kalverra authored Dec 18, 2023
1 parent 3cea51d commit 6ce226c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
9 changes: 8 additions & 1 deletion integration-tests/docker/test_env/cl_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,15 @@ func (n *ClNode) UpgradeVersion(newImage, newVersion string) error {
return fmt.Errorf("new version is empty")
}
if newImage == "" {
return fmt.Errorf("new image name is empty")
newImage = os.Getenv("CHAINLINK_IMAGE")
}
n.l.Info().
Str("Name", n.ContainerName).
Str("Old Image", os.Getenv("CHAINLINK_IMAGE")).
Str("Old Version", os.Getenv("CHAINLINK_VERSION")).
Str("New Image", newImage).
Str("New Version", newVersion).
Msg("Upgrading Chainlink Node")
n.ContainerImage = newImage
n.ContainerVersion = newVersion
return n.Restart(n.NodeConfig)
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ require (
// avoids ambigious imports of indirect dependencies
exclude github.com/hashicorp/consul v1.2.1

// Pin K8s versions as their updates are highly disruptive and go mod keeps wanting to update them
replace (
// Required until https://github.com/testcontainers/testcontainers-go/pull/1971 is merged
github.com/testcontainers/testcontainers-go => github.com/Tofel/testcontainers-go v0.0.0-20231130110817-e6fbf9498b56
// Pin K8s versions as their updates are highly disruptive and go mod keeps wanting to update them
k8s.io/api => k8s.io/api v0.25.11
k8s.io/client-go => k8s.io/client-go v0.25.11
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230303024457-afdc3dddf62d
Expand Down
12 changes: 4 additions & 8 deletions integration-tests/migration/upgrade_version_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package migration

import (
"os"
"testing"

"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/utils/osutil"

"github.com/smartcontractkit/chainlink/integration-tests/docker/test_env"
)

func TestVersionUpgrade(t *testing.T) {
t.Parallel()
env, err := test_env.NewCLTestEnvBuilder().
WithTestInstance(t).
WithStandardCleanup().
WithGeth().
WithCLNodes(1).
Build()
Expand All @@ -23,16 +24,11 @@ func TestVersionUpgrade(t *testing.T) {
require.NoError(t, err, "Error getting upgrade image")
upgradeVersion, err := osutil.GetEnv("UPGRADE_VERSION")
require.NoError(t, err, "Error getting upgrade version")

_ = os.Setenv("CHAINLINK_IMAGE", upgradeImage)
_ = os.Setenv("CHAINLINK_VERSION", upgradeVersion)

// just restarting CL container with the same name, DB is still the same
//
// [Database]
// MigrateOnStartup = true
//
// by default
err = env.ClCluster.Nodes[0].Restart(env.ClCluster.Nodes[0].NodeConfig)
err = env.ClCluster.Nodes[0].UpgradeVersion(upgradeImage, upgradeVersion)
require.NoError(t, err)

}

0 comments on commit 6ce226c

Please sign in to comment.