@@ -401,6 +401,62 @@ func TestInstallFromReplicatedApp(t *testing.T) {
401401 t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
402402}
403403
404+ func TestResetAndReinstall (t * testing.T ) {
405+ t .Parallel ()
406+ tc := cluster .NewTestCluster (& cluster.Input {
407+ T : t ,
408+ Nodes : 1 ,
409+ Image : "ubuntu/jammy" ,
410+ LicensePath : "license.yaml" ,
411+ EmbeddedClusterPath : "../output/bin/embedded-cluster" ,
412+ })
413+ defer tc .Destroy ()
414+ t .Logf ("%s: installing embedded-cluster on node 0" , time .Now ().Format (time .RFC3339 ))
415+ line := []string {"single-node-install.sh" }
416+ if stdout , stderr , err := RunCommandOnNode (t , tc , 0 , line ); err != nil {
417+ t .Log ("install stdout:" , stdout )
418+ t .Log ("install stderr:" , stderr )
419+ t .Fatalf ("fail to install embedded-cluster on node %s: %v" , tc .Nodes [0 ], err )
420+ }
421+
422+ t .Logf ("%s: checking installation state" , time .Now ().Format (time .RFC3339 ))
423+ line = []string {"check-installation-state.sh" }
424+ stdout , stderr , err := RunCommandOnNode (t , tc , 0 , line )
425+ if err != nil {
426+ t .Log ("stdout:" , stdout )
427+ t .Log ("stderr:" , stderr )
428+ t .Fatalf ("fail to check installation state: %v" , err )
429+ }
430+
431+ t .Logf ("%s: resetting the installation" , time .Now ().Format (time .RFC3339 ))
432+ line = []string {"reset-installation.sh" }
433+ stdout , stderr , err = RunCommandOnNode (t , tc , 0 , line )
434+ if err != nil {
435+ t .Log ("stdout:" , stdout )
436+ t .Log ("stderr:" , stderr )
437+ t .Fatalf ("fail to reset the installation: %v" , err )
438+ }
439+
440+ t .Logf ("%s: installing embedded-cluster on node 0 after reset" , time .Now ().Format (time .RFC3339 ))
441+ line = []string {"single-node-install.sh" }
442+ if stdout , stderr , err = RunCommandOnNode (t , tc , 0 , line ); err != nil {
443+ t .Log ("install stdout:" , stdout )
444+ t .Log ("install stderr:" , stderr )
445+ t .Fatalf ("fail to install embedded-cluster on node %s: %v" , tc .Nodes [0 ], err )
446+ }
447+
448+ t .Logf ("%s: checking installation state after reinstall" , time .Now ().Format (time .RFC3339 ))
449+ line = []string {"check-installation-state.sh" }
450+ stdout , stderr , err = RunCommandOnNode (t , tc , 0 , line )
451+ if err != nil {
452+ t .Log ("stdout:" , stdout )
453+ t .Log ("stderr:" , stderr )
454+ t .Fatalf ("fail to check installation state: %v" , err )
455+ }
456+
457+ t .Logf ("%s: test complete" , time .Now ().Format (time .RFC3339 ))
458+ }
459+
404460func runPuppeteerAppStatusCheck (t * testing.T , node int , tc * cluster.Output ) {
405461 t .Logf ("%s: installing puppeteer on node %d" , time .Now ().Format (time .RFC3339 ), node )
406462 line := []string {"install-puppeteer.sh" }
0 commit comments