From 661ec7e6eeb0514bdeff3b0b516bc2cbf5ffa9a5 Mon Sep 17 00:00:00 2001 From: YZ775 Date: Wed, 11 Sep 2024 07:32:58 +0000 Subject: [PATCH] fix neco-reboter_test.go to use strimgs.TrimSpace --- dctest/neco-rebooter_test.go | 4 ++-- dctest/reboot_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dctest/neco-rebooter_test.go b/dctest/neco-rebooter_test.go index db5622e23..eb12a299f 100644 --- a/dctest/neco-rebooter_test.go +++ b/dctest/neco-rebooter_test.go @@ -21,7 +21,7 @@ func testNecoRebooter() { if len(stdout) == 0 { return errors.New("no leader") } - leaderNodeBefore = strings.TrimSuffix(string(stdout), "\n") + leaderNodeBefore = strings.TrimSpace(string(stdout)) return nil }).Should(Succeed()) @@ -40,7 +40,7 @@ func testNecoRebooter() { if len(stdout) == 0 { return errors.New("no leader") } - leaderNodeAfter := strings.TrimSuffix(string(stdout), "\n") + leaderNodeAfter := strings.TrimSpace(string(stdout)) if leaderNodeAfter == leaderNodeBefore { return errors.New("leader is not changed") } diff --git a/dctest/reboot_test.go b/dctest/reboot_test.go index 40067e1a5..ea5ca4484 100644 --- a/dctest/reboot_test.go +++ b/dctest/reboot_test.go @@ -343,7 +343,7 @@ func testNecoRebooterRebootGracefully() { Expect(err).NotTo(HaveOccurred(), "stdout: %s, stderr: %s", stdout, stderr) By(fmt.Sprintf("adding %s nodes to reboot-list", racks[0])) - // [:4] is number of "rack" + // racks[0][:4] represents the rack number execSafeAt(bootServers[0], "yes", "|", "neco", "rebooter", "reboot-worker", "--rack="+racks[0][4:]) By("enable rebooting") @@ -363,7 +363,7 @@ func testNecoRebooterRebootGracefully() { }).Should(Succeed()) By(fmt.Sprintf("adding %s nodes to reboot-list", racks[1])) - // [:4] is number of "rack" + // racks[0][:4] represents the rack number execSafeAt(bootServers[0], "yes", "|", "neco", "rebooter", "reboot-worker", "--rack="+racks[1][4:]) By(fmt.Sprintf("waiting for skipping %s and moving to %s", racks[0], racks[1]))