Skip to content

Commit f76bad0

Browse files
authored
Revert TestMultiNodeAirgapHAInstallation back to LXD (#2142)
1 parent 6b0ff41 commit f76bad0

File tree

3 files changed

+73
-53
lines changed

3 files changed

+73
-53
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ jobs:
624624
# e2e-docker runs the e2e tests inside a docker container rather than a full VM
625625
e2e-docker:
626626
name: E2E docker # this name is used by .github/workflows/automated-prs-manager.yaml
627-
runs-on: ubuntu-latest
627+
runs-on: ubuntu-22.04
628628
needs:
629629
- git-sha
630630
- build-current
@@ -743,10 +743,11 @@ jobs:
743743
- TestMultiNodeAirgapUpgrade
744744
- TestMultiNodeAirgapUpgradeSameK0s
745745
- TestMultiNodeAirgapUpgradePreviousStable
746-
- TestMultiNodeAirgapHAInstallation
747746
include:
748747
- test: TestAirgapUpgradeFromEC18
749748
runner: embedded-cluster-2
749+
- test: TestMultiNodeAirgapHAInstallation
750+
runner: embedded-cluster-2
750751
- test: TestSingleNodeAirgapDisasterRecovery
751752
runner: embedded-cluster-2
752753
- test: TestMultiNodeAirgapHADisasterRecovery

.github/workflows/release-prod.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ jobs:
456456
# e2e-docker runs the e2e tests inside a docker container rather than a full VM
457457
e2e-docker:
458458
name: E2E docker
459-
runs-on: ubuntu-latest
459+
runs-on: ubuntu-22.04
460460
needs:
461461
- release
462462
- release-app
@@ -566,10 +566,11 @@ jobs:
566566
- TestMultiNodeAirgapUpgrade
567567
- TestMultiNodeAirgapUpgradeSameK0s
568568
- TestMultiNodeAirgapUpgradePreviousStable
569-
- TestMultiNodeAirgapHAInstallation
570569
include:
571570
- test: TestAirgapUpgradeFromEC18
572571
runner: embedded-cluster-2
572+
- test: TestMultiNodeAirgapHAInstallation
573+
runner: embedded-cluster-2
573574
- test: TestSingleNodeAirgapDisasterRecovery
574575
runner: embedded-cluster-2
575576
- test: TestMultiNodeAirgapHADisasterRecovery

e2e/install_test.go

Lines changed: 67 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,111 +1564,129 @@ func TestMultiNodeAirgapHAInstallation(t *testing.T) {
15641564

15651565
RequireEnvVars(t, []string{"SHORT_SHA"})
15661566

1567-
tc := cmx.NewCluster(&cmx.ClusterInput{
1568-
T: t,
1569-
Nodes: 4,
1570-
Distribution: "ubuntu",
1571-
Version: "22.04",
1572-
InstanceType: "r1.medium",
1573-
SupportBundleNodeIndex: 2,
1574-
})
1575-
defer tc.Cleanup()
1576-
1577-
t.Logf("%s: downloading airgap files on nodes", time.Now().Format(time.RFC3339))
1578-
initialVersion := fmt.Sprintf("appver-%s", os.Getenv("SHORT_SHA"))
1579-
upgradeVersion := fmt.Sprintf("appver-%s-upgrade", os.Getenv("SHORT_SHA"))
1567+
t.Logf("%s: downloading airgap files", time.Now().Format(time.RFC3339))
1568+
airgapInstallBundlePath := "/tmp/airgap-install-bundle.tar.gz"
1569+
airgapUpgradeBundlePath := "/tmp/airgap-upgrade-bundle.tar.gz"
15801570
runInParallel(t,
15811571
func(t *testing.T) error {
1582-
return downloadAirgapBundleOnNode(t, tc, 0, initialVersion, AirgapInstallBundlePath, AirgapLicenseID)
1583-
},
1584-
func(t *testing.T) error {
1585-
return downloadAirgapBundleOnNode(t, tc, 0, upgradeVersion, AirgapUpgradeBundlePath, AirgapLicenseID)
1572+
return downloadAirgapBundle(t, fmt.Sprintf("appver-%s", os.Getenv("SHORT_SHA")), airgapInstallBundlePath, AirgapLicenseID)
1573+
}, func(t *testing.T) error {
1574+
return downloadAirgapBundle(t, fmt.Sprintf("appver-%s-upgrade", os.Getenv("SHORT_SHA")), airgapUpgradeBundlePath, AirgapLicenseID)
15861575
},
15871576
)
15881577

1589-
// install "expect" dependency on node 3 as that's where the HA join command will run.
1590-
t.Logf("%s: installing expect package on node 3", time.Now().Format(time.RFC3339))
1591-
if stdout, stderr, err := tc.RunCommandOnNode(3, []string{"apt-get", "install", "-y", "expect"}); err != nil {
1592-
t.Fatalf("fail to install expect package on node 3: %v: %s: %s", err, stdout, stderr)
1593-
}
1578+
tc := lxd.NewCluster(&lxd.ClusterInput{
1579+
T: t,
1580+
Nodes: 4,
1581+
Image: "debian/12",
1582+
WithProxy: true,
1583+
AirgapInstallBundlePath: airgapInstallBundlePath,
1584+
AirgapUpgradeBundlePath: airgapUpgradeBundlePath,
1585+
SupportBundleNodeIndex: 2,
1586+
})
1587+
defer tc.Cleanup()
15941588

1595-
t.Logf("%s: airgapping cluster", time.Now().Format(time.RFC3339))
1596-
if err := tc.Airgap(); err != nil {
1597-
t.Fatalf("failed to airgap cluster: %v", err)
1589+
// delete airgap bundles once they've been copied to the nodes
1590+
if err := os.Remove(airgapInstallBundlePath); err != nil {
1591+
t.Logf("failed to remove airgap install bundle: %v", err)
15981592
}
15991593

1594+
// install "curl" dependency on node 0 for app version checks.
1595+
tc.InstallTestDependenciesDebian(t, 0, true)
1596+
1597+
// install "expect" dependency on node 3 as that's where the HA join command will run.
1598+
tc.InstallTestDependenciesDebian(t, 3, true)
1599+
16001600
t.Logf("%s: preparing embedded cluster airgap files on node 0", time.Now().Format(time.RFC3339))
16011601
line := []string{"airgap-prepare.sh"}
1602-
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {
1603-
t.Fatalf("fail to prepare airgap files on node 0: %v: %s: %s", err, stdout, stderr)
1602+
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
1603+
t.Fatalf("fail to prepare airgap files on node %s: %v", tc.Nodes[0], err)
16041604
}
16051605

1606-
installSingleNodeWithOptions(t, tc, installOptions{
1607-
isAirgap: true,
1608-
})
1606+
t.Logf("%s: installing embedded-cluster on node 0", time.Now().Format(time.RFC3339))
1607+
line = []string{"single-node-airgap-install.sh", os.Getenv("SHORT_SHA")}
1608+
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
1609+
t.Fatalf("fail to install embedded-cluster on node %s: %v", tc.Nodes[0], err)
1610+
}
16091611

16101612
checkWorkerProfile(t, tc, 0)
16111613

1612-
if stdout, stderr, err := tc.SetupPlaywrightAndRunTest("deploy-app"); err != nil {
1613-
t.Fatalf("fail to run playwright test deploy-app: %v: %s: %s", err, stdout, stderr)
1614+
// remove artifacts after installation to save space
1615+
line = []string{"rm", "/assets/release.airgap"}
1616+
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
1617+
t.Fatalf("fail to remove airgap bundle on node %s: %v", tc.Nodes[0], err)
1618+
}
1619+
// do not remove the embedded-cluster binary as it is used for reset
1620+
1621+
if _, _, err := tc.SetupPlaywrightAndRunTest("deploy-app"); err != nil {
1622+
t.Fatalf("fail to run playwright test deploy-app: %v", err)
16141623
}
16151624

16161625
t.Logf("%s: checking installation state after app deployment", time.Now().Format(time.RFC3339))
16171626
line = []string{"check-airgap-installation-state.sh", fmt.Sprintf("appver-%s", os.Getenv("SHORT_SHA")), k8sVersion()}
1618-
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {
1619-
t.Fatalf("fail to check installation state: %v: %s: %s", err, stdout, stderr)
1627+
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
1628+
t.Fatalf("fail to check installation state: %v", err)
16201629
}
16211630

16221631
// join a worker
16231632
joinWorkerNode(t, tc, 1)
16241633
checkWorkerProfile(t, tc, 1)
1625-
16261634
// join a controller
16271635
joinControllerNode(t, tc, 2)
16281636
checkWorkerProfile(t, tc, 2)
1629-
16301637
// join another controller in HA mode
16311638
joinControllerNodeWithOptions(t, tc, 3, joinOptions{isHA: true})
16321639
checkWorkerProfile(t, tc, 3)
1633-
16341640
// wait for the nodes to report as ready.
16351641
waitForNodes(t, tc, 4, nil)
16361642

16371643
t.Logf("%s: checking installation state after enabling high availability", time.Now().Format(time.RFC3339))
16381644
line = []string{"check-airgap-post-ha-state.sh", os.Getenv("SHORT_SHA"), k8sVersion()}
1639-
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {
1640-
t.Fatalf("fail to check post ha state: %v: %s: %s", err, stdout, stderr)
1645+
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
1646+
t.Fatalf("fail to check post ha state: %v", err)
16411647
}
16421648

16431649
t.Logf("%s: running airgap update", time.Now().Format(time.RFC3339))
16441650
line = []string{"airgap-update.sh"}
1645-
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {
1646-
t.Fatalf("fail to run airgap update: %v: %s: %s", err, stdout, stderr)
1651+
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
1652+
t.Fatalf("fail to run airgap update: %v", err)
1653+
}
1654+
// remove the airgap bundle and binary after upgrade
1655+
line = []string{"rm", "/assets/upgrade/release.airgap"}
1656+
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
1657+
t.Fatalf("fail to remove airgap bundle on node %s: %v", tc.Nodes[0], err)
16471658
}
16481659

16491660
appUpgradeVersion := fmt.Sprintf("appver-%s-upgrade", os.Getenv("SHORT_SHA"))
16501661
testArgs := []string{appUpgradeVersion}
16511662

16521663
t.Logf("%s: upgrading cluster", time.Now().Format(time.RFC3339))
1653-
if stdout, stderr, err := tc.RunPlaywrightTest("deploy-upgrade", testArgs...); err != nil {
1654-
t.Fatalf("fail to run playwright test deploy-app: %v: %s: %s", err, stdout, stderr)
1664+
if _, _, err := tc.RunPlaywrightTest("deploy-upgrade", testArgs...); err != nil {
1665+
t.Fatalf("fail to run playwright test deploy-app: %v", err)
16551666
}
16561667

1657-
checkPostUpgradeState(t, tc)
1668+
t.Logf("%s: checking installation state after upgrade", time.Now().Format(time.RFC3339))
1669+
line = []string{"check-postupgrade-state.sh", k8sVersion(), ecUpgradeTargetVersion()}
1670+
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
1671+
t.Fatalf("fail to check postupgrade state: %v", err)
1672+
}
16581673

1659-
stdout, stderr, err := resetInstallationWithError(t, tc, 0, resetInstallationOptions{})
1674+
bin := "embedded-cluster"
1675+
t.Logf("%s: resetting controller node 0 with bin %q", time.Now().Format(time.RFC3339), bin)
1676+
stdout, stderr, err := tc.RunCommandOnNode(0, []string{bin, "reset", "--yes"})
16601677
if err != nil {
1661-
t.Fatalf("fail to reset the installation on node 0: %v: %s: %s", err, stdout, stderr)
1678+
t.Logf("stdout: %s\nstderr: %s", stdout, stderr)
1679+
t.Fatalf("fail to remove controller node 0 %s:", err)
16621680
}
16631681
if !strings.Contains(stdout, "High-availability is enabled and requires at least three controller-test nodes") {
1664-
t.Logf("reset output does not contain the ha warning: stdout: %s\nstderr: %s", stdout, stderr)
1682+
t.Errorf("reset output does not contain the ha warning")
1683+
t.Logf("stdout: %s\nstderr: %s", stdout, stderr)
16651684
}
16661685

1667-
stdout, stderr, err = tc.RunCommandOnNode(2, []string{"check-nodes-removed.sh", "3"})
1686+
stdout, _, err = tc.RunCommandOnNode(2, []string{"check-nodes-removed.sh", "3"})
16681687
if err != nil {
16691688
t.Fatalf("fail to check nodes removed: %v: %s: %s", err, stdout, stderr)
16701689
}
1671-
16721690
t.Logf("%s: checking nllb", time.Now().Format(time.RFC3339))
16731691
line = []string{"check-nllb.sh"}
16741692
if stdout, stderr, err := tc.RunCommandOnNode(2, line); err != nil {

0 commit comments

Comments
 (0)