Skip to content

Commit 1fca0ea

Browse files
committed
fix reboot timings
1 parent f88e0df commit 1fca0ea

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

pkg/testcase/upgrademanual.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ func TestUpgradeClusterManual(cluster *shared.Cluster, k8sClient *k8s.Client, ve
7474
return nil
7575
}
7676

77-
func rebootEc2Instance(awsClient *aws.Client, ip string) {
78-
serverInstanceID, getErr := awsClient.GetInstanceIDByIP(ip)
79-
Expect(getErr).NotTo(HaveOccurred())
80-
shared.LogLevel("debug", "Rebooting instance id: %s", serverInstanceID)
81-
rebootError := awsClient.RebootInstance(serverInstanceID)
82-
Expect(rebootError).NotTo(HaveOccurred())
83-
}
84-
8577
// upgradeProduct upgrades a node server or agent type to the specified version.
8678
func upgradeProduct(awsClient *aws.Client, product, nodeType, installType, ip, nodeOS string) error {
8779
upgradeCommand := shared.GetInstallCmd(product, installType, nodeType)
@@ -92,12 +84,11 @@ func upgradeProduct(awsClient *aws.Client, product, nodeType, installType, ip, n
9284
}
9385

9486
if nodeOS == "slemicro" {
95-
rebootEc2Instance(awsClient, ip)
87+
rebootNodeAndWait(awsClient, ip)
9688
}
9789

9890
actions := []shared.ServiceAction{
99-
{Service: product, Action: stop, NodeType: nodeType, ExplicitDelay: 30},
100-
{Service: product, Action: start, NodeType: nodeType, ExplicitDelay: 180},
91+
{Service: product, Action: restart, NodeType: nodeType, ExplicitDelay: 180},
10192
{Service: product, Action: status, NodeType: nodeType, ExplicitDelay: 30},
10293
}
10394

@@ -115,7 +106,18 @@ func upgradeProduct(awsClient *aws.Client, product, nodeType, installType, ip, n
115106

116107
if product == "k3s" {
117108
ms := shared.NewManageService(3, 10)
118-
output, err := ms.ManageService(ip, []shared.ServiceAction{actions[1]})
109+
var output string
110+
var err error
111+
if nodeOS == "slemicro" {
112+
sleActions := []shared.ServiceAction{
113+
{Service: product, Action: stop, NodeType: nodeType, ExplicitDelay: 30},
114+
{Service: product, Action: start, NodeType: nodeType, ExplicitDelay: 60},
115+
{Service: product, Action: status, NodeType: nodeType, ExplicitDelay: 180},
116+
}
117+
output, err = ms.ManageService(ip, sleActions)
118+
} else {
119+
output, err = ms.ManageService(ip, []shared.ServiceAction{actions[1]})
120+
}
119121
if output != "" {
120122
Expect(output).To(ContainSubstring("active "),
121123
fmt.Sprintf("error running %s service %s on %s node: %s", product, status, nodeType, ip))

pkg/testcase/upgradenodereplacement.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,12 +698,13 @@ func validateClusterHealth() error {
698698

699699
func waitForSSHReady(ip string) error {
700700
ticker := time.NewTicker(10 * time.Second)
701-
timeout := time.After(2 * time.Minute)
701+
timeout := time.After(3 * time.Minute)
702702
defer ticker.Stop()
703703
for {
704704
select {
705705
case <-timeout:
706-
return errors.New("timed out waiting for SSH Ready")
706+
return fmt.Errorf("timed out waiting 3 mins for SSH Ready on node ip %s", ip)
707+
// return errors.New(fmt.Sprintf("timed out waiting 3 mins for SSH Ready on node ip %s", ip))
707708
case <-ticker.C:
708709
cmdOutput, sshErr := shared.RunCommandOnNode("ls -lrt", ip)
709710
if sshErr != nil {
@@ -725,6 +726,14 @@ func prepSlemicro(awsClient *aws.Client, ip, nodeOS string) {
725726
rebootNodeAndWait(awsClient, ip)
726727
}
727728

729+
func rebootEc2Instance(awsClient *aws.Client, ip string) {
730+
serverInstanceID, getErr := awsClient.GetInstanceIDByIP(ip)
731+
Expect(getErr).NotTo(HaveOccurred())
732+
shared.LogLevel("debug", "Rebooting instance id: %s", serverInstanceID)
733+
rebootError := awsClient.RebootInstance(serverInstanceID)
734+
Expect(rebootError).NotTo(HaveOccurred())
735+
}
736+
728737
func rebootNodeAndWait(awsClient *aws.Client, ip string) {
729738
rebootEc2Instance(awsClient, ip)
730739
sshErr := waitForSSHReady(ip)

0 commit comments

Comments
 (0)