@@ -48,7 +48,7 @@ func TestSingleNodeInstallation(t *testing.T) {
48
48
}
49
49
50
50
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
51
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
51
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
52
52
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
53
53
t .Fatalf ("fail to check postupgrade state: %v" , err )
54
54
}
@@ -104,7 +104,7 @@ func TestSingleNodeInstallationAlmaLinux8(t *testing.T) {
104
104
}
105
105
106
106
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
107
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
107
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
108
108
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
109
109
t .Fatalf ("fail to check postupgrade state: %v" , err )
110
110
}
@@ -164,7 +164,7 @@ func TestSingleNodeInstallationDebian12(t *testing.T) {
164
164
}
165
165
166
166
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
167
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
167
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
168
168
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
169
169
t .Fatalf ("fail to check postupgrade state: %v" , err )
170
170
}
@@ -224,7 +224,7 @@ func TestSingleNodeInstallationDebian11(t *testing.T) {
224
224
}
225
225
226
226
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
227
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
227
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
228
228
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
229
229
t .Fatalf ("fail to check postupgrade state: %v" , err )
230
230
}
@@ -280,7 +280,7 @@ func TestSingleNodeInstallationCentos9Stream(t *testing.T) {
280
280
}
281
281
282
282
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
283
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
283
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
284
284
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
285
285
t .Fatalf ("fail to check postupgrade state: %v" , err )
286
286
}
@@ -499,7 +499,61 @@ func TestInstallFromReplicatedApp(t *testing.T) {
499
499
}
500
500
501
501
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
502
- line = []string {"check-postupgrade-state.sh" , os .Getenv ("SHORT_SHA" )}
502
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ()}
503
+ if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
504
+ t .Fatalf ("fail to check postupgrade state: %v" , err )
505
+ }
506
+
507
+ t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
508
+ }
509
+
510
+ func TestUpgradeFromReplicatedApp (t * testing.T ) {
511
+ t .Parallel ()
512
+
513
+ RequireEnvVars (t , []string {"SHORT_SHA" })
514
+
515
+ tc := cluster .NewTestCluster (& cluster.Input {
516
+ T : t ,
517
+ Nodes : 1 ,
518
+ Image : "debian/12" ,
519
+ })
520
+ defer cleanupCluster (t , tc )
521
+
522
+ t .Logf ("%s: downloading embedded-cluster on node 0" , time .Now ().Format (time .RFC3339 ))
523
+ line := []string {"vandoor-prepare.sh" , fmt .Sprintf ("%s-previous-k0s" , os .Getenv ("SHORT_SHA" )), os .Getenv ("LICENSE_ID" ), "false" }
524
+ if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
525
+ t .Fatalf ("fail to download embedded-cluster on node 0 %s: %v" , tc .Nodes [0 ], err )
526
+ }
527
+
528
+ t .Logf ("%s: installing embedded-cluster on node 0" , time .Now ().Format (time .RFC3339 ))
529
+ line = []string {"single-node-install.sh" , "ui" }
530
+ if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
531
+ t .Fatalf ("fail to install embedded-cluster on node %s: %v" , tc .Nodes [0 ], err )
532
+ }
533
+
534
+ if err := setupPlaywright (t , tc ); err != nil {
535
+ t .Fatalf ("fail to setup playwright: %v" , err )
536
+ }
537
+ if _ , _ , err := runPlaywrightTest (t , tc , "deploy-app" ); err != nil {
538
+ t .Fatalf ("fail to run playwright test deploy-app: %v" , err )
539
+ }
540
+
541
+ t .Logf ("%s: checking installation state" , time .Now ().Format (time .RFC3339 ))
542
+ line = []string {"check-installation-state.sh" , fmt .Sprintf ("%s-previous-k0s" , os .Getenv ("SHORT_SHA" ))}
543
+ if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
544
+ t .Fatalf ("fail to check installation state: %v" , err )
545
+ }
546
+
547
+ appUpgradeVersion := fmt .Sprintf ("appver-%s-upgrade" , os .Getenv ("SHORT_SHA" ))
548
+ testArgs := []string {appUpgradeVersion }
549
+
550
+ t .Logf ("%s: upgrading cluster" , time .Now ().Format (time .RFC3339 ))
551
+ if _ , _ , err := runPlaywrightTest (t , tc , "deploy-upgrade" , testArgs ... ); err != nil {
552
+ t .Fatalf ("fail to run playwright test deploy-app: %v" , err )
553
+ }
554
+
555
+ t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
556
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ()}
503
557
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
504
558
t .Fatalf ("fail to check postupgrade state: %v" , err )
505
559
}
@@ -653,7 +707,7 @@ func TestOldVersionUpgrade(t *testing.T) {
653
707
}
654
708
655
709
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
656
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
710
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
657
711
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
658
712
t .Fatalf ("fail to check postupgrade state: %v" , err )
659
713
}
@@ -763,7 +817,7 @@ func TestSingleNodeAirgapUpgrade(t *testing.T) {
763
817
}
764
818
765
819
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
766
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
820
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
767
821
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
768
822
t .Fatalf ("fail to check postupgrade state: %v" , err )
769
823
}
@@ -875,7 +929,7 @@ func TestSingleNodeAirgapUpgradeCustomCIDR(t *testing.T) {
875
929
}
876
930
877
931
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
878
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
932
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
879
933
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
880
934
t .Fatalf ("fail to check postupgrade state: %v" , err )
881
935
}
@@ -1055,7 +1109,7 @@ func TestMultiNodeAirgapUpgradeSameK0s(t *testing.T) {
1055
1109
}
1056
1110
1057
1111
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
1058
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
1112
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
1059
1113
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
1060
1114
t .Fatalf ("fail to check postupgrade state: %v" , err )
1061
1115
}
@@ -1219,7 +1273,7 @@ func TestMultiNodeAirgapUpgrade(t *testing.T) {
1219
1273
}
1220
1274
1221
1275
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
1222
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
1276
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
1223
1277
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
1224
1278
t .Fatalf ("fail to check postupgrade state: %v" , err )
1225
1279
}
@@ -1334,7 +1388,7 @@ func TestMultiNodeHAInstallation(t *testing.T) {
1334
1388
}
1335
1389
1336
1390
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
1337
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
1391
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
1338
1392
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
1339
1393
t .Fatalf ("fail to check postupgrade state: %v" , err )
1340
1394
}
@@ -1546,7 +1600,7 @@ func TestMultiNodeAirgapHAInstallation(t *testing.T) {
1546
1600
}
1547
1601
1548
1602
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
1549
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
1603
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
1550
1604
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
1551
1605
t .Fatalf ("fail to check postupgrade state: %v" , err )
1552
1606
}
@@ -1606,7 +1660,7 @@ func TestInstallSnapshotFromReplicatedApp(t *testing.T) {
1606
1660
}
1607
1661
1608
1662
t .Logf ("%s: checking installation state after upgrade" , time .Now ().Format (time .RFC3339 ))
1609
- line = []string {"check-postupgrade-state.sh" , os . Getenv ( "SHORT_SHA" )}
1663
+ line = []string {"check-postupgrade-state.sh" , k8sVersion ( )}
1610
1664
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
1611
1665
t .Fatalf ("fail to check postupgrade state: %v" , err )
1612
1666
}
@@ -1865,12 +1919,12 @@ func generateAndCopySupportBundle(t *testing.T, tc *cluster.Output) {
1865
1919
if stdout , stderr , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
1866
1920
t .Logf ("stdout: %s" , stdout )
1867
1921
t .Logf ("stderr: %s" , stderr )
1868
- t .Errorf ("fail to generate cluster support from node %s bundle: %v" , node , err )
1869
- }
1870
-
1871
- t . Logf ( "%s: copying cluster support bundle from node %s to local machine" , time . Now (). Format ( time . RFC3339 ), node )
1872
- if err := cluster . CopyFileFromNode ( node , "/root/cluster.tar.gz" , " support- bundle-cluster.tar.gz" ); err != nil {
1873
- t . Errorf ( "fail to copy cluster support bundle from node %s to local machine: %v" , node , err )
1922
+ t .Logf ("fail to generate cluster support from node %s bundle: %v" , node , err )
1923
+ } else {
1924
+ t . Logf ( "%s: copying cluster support bundle from node %s to local machine" , time . Now (). Format ( time . RFC3339 ), node )
1925
+ if err := cluster . CopyFileFromNode ( node , "/root/cluster.tar.gz" , "support-bundle-cluster.tar.gz" ); err != nil {
1926
+ t . Logf ( "fail to copy cluster support bundle from node %s to local machine: %v" , node , err )
1927
+ }
1874
1928
}
1875
1929
1876
1930
for i , node := range tc .Nodes {
@@ -1879,12 +1933,13 @@ func generateAndCopySupportBundle(t *testing.T, tc *cluster.Output) {
1879
1933
if stdout , stderr , err := RunCommandOnNode (t , tc , i , line ); err != nil {
1880
1934
t .Logf ("stdout: %s" , stdout )
1881
1935
t .Logf ("stderr: %s" , stderr )
1882
- t .Errorf ("fail to generate support from node %s bundle: %v" , node , err )
1936
+ t .Logf ("fail to generate support from node %s bundle: %v" , node , err )
1937
+ continue
1883
1938
}
1884
1939
1885
1940
t .Logf ("%s: copying host support bundle from node %s to local machine" , time .Now ().Format (time .RFC3339 ), node )
1886
1941
if err := cluster .CopyFileFromNode (node , "/root/host.tar.gz" , fmt .Sprintf ("support-bundle-host-%s.tar.gz" , node )); err != nil {
1887
- t .Errorf ("fail to copy host support bundle from node %s to local machine: %v" , node , err )
1942
+ t .Logf ("fail to copy host support bundle from node %s to local machine: %v" , node , err )
1888
1943
}
1889
1944
}
1890
1945
}
@@ -1894,29 +1949,27 @@ func copyPlaywrightReport(t *testing.T, tc *cluster.Output) {
1894
1949
if tc .Proxy != "" {
1895
1950
t .Logf ("%s: compressing playwright report on proxy node" , time .Now ().Format (time .RFC3339 ))
1896
1951
if _ , _ , err := RunCommandOnProxyNode (t , tc , line ); err != nil {
1897
- t .Errorf ("fail to compress playwright report on node %s: %v" , tc .Proxy , err )
1952
+ t .Logf ("fail to compress playwright report on node %s: %v" , tc .Proxy , err )
1898
1953
return
1899
1954
}
1900
1955
t .Logf ("%s: copying playwright report to local machine" , time .Now ().Format (time .RFC3339 ))
1901
1956
if err := cluster .CopyFileFromNode (tc .Proxy , "/root/playwright-report.tar.gz" , "playwright-report.tar.gz" ); err != nil {
1902
- t .Errorf ("fail to copy playwright report to local machine: %v" , err )
1957
+ t .Logf ("fail to copy playwright report to local machine: %v" , err )
1903
1958
}
1904
1959
} else {
1905
1960
t .Logf ("%s: compressing playwright report on node 0" , time .Now ().Format (time .RFC3339 ))
1906
1961
if _ , _ , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
1907
- t .Errorf ("fail to compress playwright report on node %s: %v" , tc .Nodes [0 ], err )
1962
+ t .Logf ("fail to compress playwright report on node %s: %v" , tc .Nodes [0 ], err )
1908
1963
return
1909
1964
}
1910
1965
t .Logf ("%s: copying playwright report to local machine" , time .Now ().Format (time .RFC3339 ))
1911
1966
if err := cluster .CopyFileFromNode (tc .Nodes [0 ], "/root/playwright-report.tar.gz" , "playwright-report.tar.gz" ); err != nil {
1912
- t .Errorf ("fail to copy playwright report to local machine: %v" , err )
1967
+ t .Logf ("fail to copy playwright report to local machine: %v" , err )
1913
1968
}
1914
1969
}
1915
1970
}
1916
1971
1917
1972
func cleanupCluster (t * testing.T , tc * cluster.Output ) {
1918
- if t .Failed () {
1919
- generateAndCopySupportBundle (t , tc )
1920
- copyPlaywrightReport (t , tc )
1921
- }
1973
+ generateAndCopySupportBundle (t , tc )
1974
+ copyPlaywrightReport (t , tc )
1922
1975
}
0 commit comments