Skip to content

Commit

Permalink
fixup! fix cli in upgrade test
Browse files Browse the repository at this point in the history
  • Loading branch information
elchead committed Oct 24, 2024
1 parent f7d27fc commit 874a76e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions e2e/internal/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestUpgrade(t *testing.T) {
log.Println(string(data))

log.Println("Checking upgrade.")
runUpgradeCheck(require, cli, *targetKubernetes)
runUpgradeCheck(require, cli, *targetKubernetes, *targetMicroservices)

log.Println("Triggering upgrade.")
runUpgradeApply(require, cli)
Expand Down Expand Up @@ -170,7 +170,7 @@ func testNodesEventuallyAvailable(t *testing.T, k *kubernetes.Clientset, wantCon

// runUpgradeCheck executes 'upgrade check' and does basic checks on the output.
// We can not check images upgrades because we might use unpublished images. CLI uses public CDN to check for available images.
func runUpgradeCheck(require *require.Assertions, cli, targetKubernetes string) {
func runUpgradeCheck(require *require.Assertions, cli, targetKubernetes string, targetMicroservices string) {
cmd := exec.CommandContext(context.Background(), cli, "upgrade", "check", "--debug")
stdout, stderr, err := runCommandWithSeparateOutputs(cmd)
require.NoError(err, "Stdout: %s\nStderr: %s", string(stdout), string(stderr))
Expand All @@ -186,9 +186,12 @@ func runUpgradeCheck(require *require.Assertions, cli, targetKubernetes string)
log.Printf("false. targetKubernetes: %s\n", targetKubernetes)
require.Contains(string(stdout), targetKubernetes, fmt.Sprintf("Expected Kubernetes version %s in output.", targetKubernetes))
}
if targetMicroservices == "" {
targetMicroservices = constants.BinaryVersion().String() // assume that the CLI is not a simulated patch upgrade, such that the version is the same as the CLI version.
}

require.Contains(string(stdout), "Services:")
require.Contains(string(stdout), fmt.Sprintf("--> %s", constants.BinaryVersion().String()))
require.Contains(string(stdout), fmt.Sprintf("--> %s", targetMicroservices))

log.Println(string(stdout))
}
Expand Down

0 comments on commit 874a76e

Please sign in to comment.