Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TT-758] Fixes Upgrade Test #11589

Merged
merged 5 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)

}
Loading