@@ -13,7 +13,6 @@ import (
1313
1414 "github.com/replicatedhq/embedded-cluster/e2e/cluster/cmx"
1515 "github.com/replicatedhq/embedded-cluster/e2e/cluster/docker"
16- "github.com/replicatedhq/embedded-cluster/e2e/cluster/lxd"
1716)
1817
1918func TestSingleNodeInstallation (t * testing.T ) {
@@ -851,302 +850,6 @@ func TestSingleNodeAirgapUpgradeSelinux(t *testing.T) {
851850 t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
852851}
853852
854- func TestSingleNodeAirgapUpgradeCustomCIDR (t * testing.T ) {
855- t .Parallel ()
856-
857- RequireEnvVars (t , []string {"SHORT_SHA" })
858-
859- tc := cmx .NewCluster (& cmx.ClusterInput {
860- T : t ,
861- Nodes : 1 ,
862- Distribution : "ubuntu" ,
863- Version : "22.04" ,
864- })
865- defer tc .Cleanup ()
866-
867- t .Logf ("%s: downloading airgap files on node 0" , time .Now ().Format (time .RFC3339 ))
868- // Previous stable EC version with a -1 minor k0s version
869- initialVersion := fmt .Sprintf ("appver-%s-previous-stable" , os .Getenv ("SHORT_SHA" ))
870- runInParallel (t ,
871- func (t * testing.T ) error {
872- return downloadAirgapBundleOnNode (t , tc , 0 , initialVersion , AirgapInstallBundlePath , AirgapLicenseID )
873- }, func (t * testing.T ) error {
874- return downloadAirgapBundleOnNode (t , tc , 0 , fmt .Sprintf ("appver-%s-upgrade" , os .Getenv ("SHORT_SHA" )), AirgapUpgradeBundlePath , AirgapLicenseID )
875- },
876- )
877-
878- t .Logf ("%s: airgapping cluster" , time .Now ().Format (time .RFC3339 ))
879- if err := tc .Airgap (); err != nil {
880- t .Fatalf ("failed to airgap cluster: %v" , err )
881- }
882-
883- t .Logf ("%s: preparing embedded cluster airgap files" , time .Now ().Format (time .RFC3339 ))
884- line := []string {"airgap-prepare.sh" }
885- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
886- t .Fatalf ("fail to prepare airgap files on node %s: %v" , tc .Nodes [0 ], err )
887- }
888-
889- installSingleNodeWithOptions (t , tc , installOptions {
890- isAirgap : true ,
891- version : initialVersion ,
892- cidr : "172.16.0.0/15" ,
893- })
894-
895- if stdout , stderr , err := tc .SetupPlaywrightAndRunTest ("deploy-app" ); err != nil {
896- t .Fatalf ("fail to run playwright test deploy-app: %v: %s: %s" , err , stdout , stderr )
897- }
898-
899- t .Logf ("%s: checking installation state after app deployment" , time .Now ().Format (time .RFC3339 ))
900- line = []string {"check-airgap-installation-state.sh" , initialVersion , k8sVersionPreviousStable ()}
901- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
902- t .Fatalf ("fail to check installation state: %v" , err )
903- }
904-
905- t .Logf ("%s: running airgap update" , time .Now ().Format (time .RFC3339 ))
906- line = []string {"airgap-update.sh" }
907- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
908- t .Fatalf ("fail to run airgap update: %v" , err )
909- }
910-
911- appUpgradeVersion := fmt .Sprintf ("appver-%s-upgrade" , os .Getenv ("SHORT_SHA" ))
912- testArgs := []string {appUpgradeVersion }
913-
914- t .Logf ("%s: upgrading cluster" , time .Now ().Format (time .RFC3339 ))
915- if stdout , stderr , err := tc .RunPlaywrightTest ("deploy-upgrade" , testArgs ... ); err != nil {
916- t .Fatalf ("fail to run playwright test deploy-upgrade: %v: %s: %s" , err , stdout , stderr )
917- }
918-
919- checkPostUpgradeState (t , tc )
920-
921- // ensure that the cluster is using the right IP ranges.
922- t .Logf ("%s: checking service and pod IP addresses" , time .Now ().Format (time .RFC3339 ))
923-
924- // we have used --cidr 172.16.0.0/15 during install time so pods are
925- // expected to be in the 172.16.0.0/16 range while services are in the
926- // 172.17.0.0/16 range.
927- podregex := `172\\.16\\.[0-9]\\+\\.[0-9]\\+`
928- svcregex := `172\\.17\\.[0-9]\\+\\.[0-9]\\+`
929-
930- if stdout , stderr , err := tc .RunCommandOnNode (0 , []string {"check-cidr-ranges.sh" , podregex , svcregex }); err != nil {
931- t .Log (stdout )
932- t .Log (stderr )
933- t .Fatalf ("fail to check addresses on node %s: %v" , tc .Nodes [0 ], err )
934- }
935-
936- t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
937- }
938-
939- func TestAirgapUpgradeFromEC18 (t * testing.T ) {
940- t .Parallel ()
941-
942- RequireEnvVars (t , []string {"SHORT_SHA" })
943-
944- withEnv := map [string ]string {"KUBECONFIG" : "/var/lib/k0s/pki/admin.conf" }
945-
946- appVer := fmt .Sprintf ("appver-%s-1.8.0-k8s-1.28" , os .Getenv ("SHORT_SHA" ))
947-
948- t .Logf ("%s: downloading airgap files" , time .Now ().Format (time .RFC3339 ))
949- airgapInstallBundlePath := "/tmp/airgap-install-bundle.tar.gz"
950- airgapUpgradeBundlePath := "/tmp/airgap-upgrade-bundle.tar.gz"
951- airgapUpgrade2BundlePath := "/tmp/airgap-upgrade2-bundle.tar.gz"
952- runInParallel (t ,
953- func (t * testing.T ) error {
954- return downloadAirgapBundle (t , appVer , airgapInstallBundlePath , AirgapLicenseID )
955- }, func (t * testing.T ) error {
956- return downloadAirgapBundle (t , fmt .Sprintf ("appver-%s-noop" , os .Getenv ("SHORT_SHA" )), airgapUpgradeBundlePath , AirgapLicenseID )
957- }, func (t * testing.T ) error {
958- return downloadAirgapBundle (t , fmt .Sprintf ("appver-%s-upgrade" , os .Getenv ("SHORT_SHA" )), airgapUpgrade2BundlePath , AirgapLicenseID )
959- },
960- )
961-
962- tc := lxd .NewCluster (& lxd.ClusterInput {
963- T : t ,
964- Nodes : 2 ,
965- Image : "debian/12" ,
966- WithProxy : true ,
967- AirgapInstallBundlePath : airgapInstallBundlePath ,
968- AirgapUpgradeBundlePath : airgapUpgradeBundlePath ,
969- AirgapUpgrade2BundlePath : airgapUpgrade2BundlePath ,
970- LowercaseNodeNames : true ,
971- })
972- defer tc .Cleanup (withEnv )
973-
974- // delete airgap bundles once they've been copied to the nodes
975- if err := os .Remove (airgapInstallBundlePath ); err != nil {
976- t .Logf ("failed to remove airgap install bundle: %v" , err )
977- }
978- if err := os .Remove (airgapUpgradeBundlePath ); err != nil {
979- t .Logf ("failed to remove airgap upgrade bundle: %v" , err )
980- }
981- if err := os .Remove (airgapUpgrade2BundlePath ); err != nil {
982- t .Logf ("failed to remove airgap upgrade bundle: %v" , err )
983- }
984-
985- // upgrade airgap bundle is only needed on the first node
986- line := []string {"rm" , "/assets/ec-release-upgrade.tgz" }
987- if _ , _ , err := tc .RunCommandOnNode (1 , line ); err != nil {
988- t .Fatalf ("fail to remove upgrade airgap bundle on node %s: %v" , tc .Nodes [1 ], err )
989- }
990-
991- // install "curl" dependency on node 0 for app version checks.
992- tc .InstallTestDependenciesDebian (t , 0 , true )
993-
994- t .Logf ("%s: preparing embedded cluster airgap files" , time .Now ().Format (time .RFC3339 ))
995- line = []string {"airgap-prepare.sh" }
996- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
997- t .Fatalf ("fail to prepare airgap files on node %s: %v" , tc .Nodes [0 ], err )
998- }
999-
1000- installSingleNodeWithOptions (t , tc , installOptions {
1001- isAirgap : true ,
1002- version : appVer ,
1003- withEnv : withEnv ,
1004- })
1005- // remove the airgap bundle after installation
1006- line = []string {"rm" , "/assets/release.airgap" }
1007- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
1008- t .Fatalf ("fail to remove airgap bundle on node %s: %v" , tc .Nodes [0 ], err )
1009- }
1010-
1011- if err := tc .SetupPlaywright (withEnv ); err != nil {
1012- t .Fatalf ("fail to setup playwright: %v" , err )
1013- }
1014- if stdout , stderr , err := tc .RunPlaywrightTest ("deploy-ec18-app" ); err != nil {
1015- t .Fatalf ("fail to run playwright test deploy-ec18-app: %v: %s: %s" , err , stdout , stderr )
1016- }
1017-
1018- // generate worker node join command.
1019- t .Logf ("%s: generating a new worker token command" , time .Now ().Format (time .RFC3339 ))
1020- stdout , stderr , err := tc .RunPlaywrightTest ("get-ec18-join-worker-command" )
1021- if err != nil {
1022- t .Fatalf ("fail to generate worker join token:\n stdout: %s\n stderr: %s" , stdout , stderr )
1023- }
1024- workerCommand , err := findJoinCommandInOutput (stdout )
1025- if err != nil {
1026- t .Fatalf ("fail to find the join command in the output: %v" , err )
1027- }
1028- t .Log ("worker join token command:" , workerCommand )
1029-
1030- // join the worker node
1031- t .Logf ("%s: preparing embedded cluster airgap files on worker node" , time .Now ().Format (time .RFC3339 ))
1032- line = []string {"airgap-prepare.sh" }
1033- if _ , _ , err := tc .RunCommandOnNode (1 , line ); err != nil {
1034- t .Fatalf ("fail to prepare airgap files on worker node: %v" , err )
1035- }
1036- t .Logf ("%s: joining worker node to the cluster" , time .Now ().Format (time .RFC3339 ))
1037- if _ , _ , err := tc .RunCommandOnNode (1 , strings .Split (workerCommand , " " )); err != nil {
1038- t .Fatalf ("fail to join worker node to the cluster: %v" , err )
1039- }
1040- // remove artifacts after joining to save space
1041- line = []string {"rm" , "/assets/release.airgap" }
1042- if _ , _ , err := tc .RunCommandOnNode (1 , line ); err != nil {
1043- t .Fatalf ("fail to remove airgap bundle on worker node: %v" , err )
1044- }
1045- line = []string {"rm" , "/usr/local/bin/embedded-cluster" }
1046- if _ , _ , err := tc .RunCommandOnNode (1 , line ); err != nil {
1047- t .Fatalf ("fail to remove embedded-cluster binary on worker node: %v" , err )
1048- }
1049- line = []string {"rm" , "/var/lib/embedded-cluster/bin/embedded-cluster" }
1050- if _ , _ , err := tc .RunCommandOnNode (1 , line ); err != nil {
1051- t .Fatalf ("fail to remove embedded-cluster binary on node %s: %v" , tc .Nodes [0 ], err )
1052- }
1053-
1054- // wait for the nodes to report as ready.
1055- t .Logf ("%s: all nodes joined, waiting for them to be ready" , time .Now ().Format (time .RFC3339 ))
1056- stdout , _ , err = tc .RunCommandOnNode (0 , []string {"wait-for-ready-nodes.sh" , "2" }, withEnv )
1057- if err != nil {
1058- t .Log (stdout )
1059- t .Fatalf ("fail to wait for ready nodes: %v" , err )
1060- }
1061-
1062- t .Logf ("%s: checking installation state after app deployment" , time .Now ().Format (time .RFC3339 ))
1063- line = []string {
1064- "check-airgap-installation-state.sh" ,
1065- // the initially installed version is 1.8.0+k8s-1.28
1066- // the '+' character is problematic in the regex used to validate the version, so we use '.' instead
1067- appVer ,
1068- "v1.28.11" ,
1069- }
1070- if _ , _ , err := tc .RunCommandOnNode (0 , line , withEnv ); err != nil {
1071- t .Fatalf ("fail to check installation state: %v" , err )
1072- }
1073-
1074- t .Logf ("%s: running airgap update" , time .Now ().Format (time .RFC3339 ))
1075- line = []string {"airgap-update.sh" }
1076- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
1077- t .Fatalf ("fail to run airgap update: %v" , err )
1078- }
1079- // remove the airgap bundle after upgrade
1080- line = []string {"rm" , "/assets/upgrade/release.airgap" }
1081- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
1082- t .Fatalf ("fail to remove airgap bundle on node %s: %v" , tc .Nodes [0 ], err )
1083- }
1084-
1085- appUpgradeVersion := fmt .Sprintf ("appver-%s-noop" , os .Getenv ("SHORT_SHA" ))
1086- testArgs := []string {appUpgradeVersion }
1087-
1088- t .Logf ("%s: upgrading cluster" , time .Now ().Format (time .RFC3339 ))
1089- if stdout , stderr , err := tc .RunPlaywrightTest ("deploy-upgrade" , testArgs ... ); err != nil {
1090- t .Fatalf ("fail to run playwright test deploy-upgrade: %v: %s: %s" , err , stdout , stderr )
1091- }
1092-
1093- t .Logf ("%s: checking installation state after noop upgrade" , time .Now ().Format (time .RFC3339 ))
1094- line = []string {"check-airgap-installation-state.sh" , appUpgradeVersion , k8sVersion ()}
1095- if stdout , stderr , err := tc .RunCommandOnNode (0 , line , withEnv ); err != nil {
1096- t .Fatalf ("fail to check installation state: %v: %s: %s" , err , stdout , stderr )
1097- }
1098-
1099- t .Logf ("%s: running second airgap update" , time .Now ().Format (time .RFC3339 ))
1100- line = []string {"airgap-update2.sh" }
1101- if _ , _ , err := tc .RunCommandOnNode (0 , line , withEnv ); err != nil {
1102- t .Fatalf ("fail to run airgap update: %v" , err )
1103- }
1104- // remove the airgap bundle and binary after upgrade
1105- line = []string {"rm" , "/assets/upgrade2/release.airgap" }
1106- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
1107- t .Fatalf ("fail to remove airgap bundle on node %s: %v" , tc .Nodes [0 ], err )
1108- }
1109- line = []string {"rm" , "/usr/local/bin/embedded-cluster-upgrade2" }
1110- if _ , _ , err := tc .RunCommandOnNode (0 , line ); err != nil {
1111- t .Fatalf ("fail to remove embedded-cluster-upgrade2 binary on node %s: %v" , tc .Nodes [0 ], err )
1112- }
1113-
1114- appUpgradeVersion = fmt .Sprintf ("appver-%s-upgrade" , os .Getenv ("SHORT_SHA" ))
1115- testArgs = []string {appUpgradeVersion }
1116-
1117- t .Logf ("%s: upgrading cluster a second time" , time .Now ().Format (time .RFC3339 ))
1118- if stdout , stderr , err := tc .RunPlaywrightTest ("deploy-upgrade" , testArgs ... ); err != nil {
1119- t .Fatalf ("fail to run playwright test deploy-upgrade: %v: %s: %s" , err , stdout , stderr )
1120- }
1121-
1122- t .Logf ("%s: checking installation state after second upgrade" , time .Now ().Format (time .RFC3339 ))
1123- line = []string {"check-postupgrade-state.sh" , k8sVersion (), ecUpgradeTargetVersion ()}
1124- if stdout , stderr , err := tc .RunCommandOnNode (0 , line , withEnv ); err != nil {
1125- t .Fatalf ("fail to check postupgrade state: %v: %s: %s" , err , stdout , stderr )
1126- }
1127-
1128- // TODO: reset fails with the following error:
1129- // error: could not reset k0s: exit status 1, time="2024-10-17 22:44:52" level=warning msg="To ensure a full reset, a node reboot is recommended."
1130- // Error: errors received during clean-up: [failed to delete /run/k0s. err: unlinkat /run/k0s/containerd/io.containerd.grpc.v1.cri/sandboxes/.../shm: device or resource busy]
1131-
1132- // t.Logf("%s: resetting worker node", time.Now().Format(time.RFC3339))
1133- // line = []string{"reset-installation.sh"}
1134- // if stdout, stderr, err := tc.RunCommandOnNode(1, line, withEnv); err != nil {
1135- // t.Fatalf("fail to reset worker node: %v: %s: %s", err, stdout, stderr)
1136- // }
1137-
1138- // // use upgrade binary for reset
1139- // withUpgradeBin := map[string]string{"EMBEDDED_CLUSTER_BIN": "embedded-cluster-upgrade"}
1140-
1141- // t.Logf("%s: resetting node 0", time.Now().Format(time.RFC3339))
1142- // line = []string{"reset-installation.sh"}
1143- // if stdout, stderr, err := tc.RunCommandOnNode(0, line, withEnv, withUpgradeBin); err != nil {
1144- // t.Fatalf("fail to reset node 0: %v: %s: %s", err, stdout, stderr)
1145- // }
1146-
1147- t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
1148- }
1149-
1150853func TestMultiNodeAirgapUpgradeSameK0s (t * testing.T ) {
1151854 t .Parallel ()
1152855
@@ -1623,50 +1326,6 @@ func TestMultiNodeAirgapHAInstallation(t *testing.T) {
16231326 t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
16241327}
16251328
1626- func TestInstallSnapshotFromReplicatedApp (t * testing.T ) {
1627- t .Parallel ()
1628-
1629- RequireEnvVars (t , []string {"SHORT_SHA" })
1630-
1631- tc := docker .NewCluster (& docker.ClusterInput {
1632- T : t ,
1633- Nodes : 1 ,
1634- Distro : "debian-bookworm" ,
1635- })
1636- defer tc .Cleanup ()
1637-
1638- downloadECReleaseWithOptions (t , tc , 0 , downloadECReleaseOptions {
1639- version : fmt .Sprintf ("appver-%s" , os .Getenv ("SHORT_SHA" )),
1640- licenseID : SnapshotLicenseID ,
1641- })
1642-
1643- installSingleNode (t , tc )
1644-
1645- if stdout , stderr , err := tc .SetupPlaywrightAndRunTest ("deploy-app" ); err != nil {
1646- t .Fatalf ("fail to run playwright test deploy-app: %v: %s: %s" , err , stdout , stderr )
1647- }
1648-
1649- checkInstallationState (t , tc )
1650-
1651- t .Logf ("%s: ensuring velero is installed" , time .Now ().Format (time .RFC3339 ))
1652- line := []string {"check-velero-state.sh" , os .Getenv ("SHORT_SHA" )}
1653- if stdout , stderr , err := tc .RunCommandOnNode (0 , line ); err != nil {
1654- t .Fatalf ("fail to check velero state: %v: %s: %s" , err , stdout , stderr )
1655- }
1656-
1657- appUpgradeVersion := fmt .Sprintf ("appver-%s-upgrade" , os .Getenv ("SHORT_SHA" ))
1658- testArgs := []string {appUpgradeVersion }
1659-
1660- t .Logf ("%s: upgrading cluster" , time .Now ().Format (time .RFC3339 ))
1661- if stdout , stderr , err := tc .RunPlaywrightTest ("deploy-upgrade" , testArgs ... ); err != nil {
1662- t .Fatalf ("fail to run playwright test deploy-upgrade: %v: %s: %s" , err , stdout , stderr )
1663- }
1664-
1665- checkPostUpgradeState (t , tc )
1666-
1667- t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
1668- }
1669-
16701329func TestSingleNodeInstallationNoopUpgrade (t * testing.T ) {
16711330 t .Parallel ()
16721331
0 commit comments