From 4053a09ca951d2b879b675262efc87d56edacdb5 Mon Sep 17 00:00:00 2001 From: hattikals Date: Tue, 3 Dec 2024 21:32:54 -0800 Subject: [PATCH] Adding changes to the complete chassis reboot test --- .../complete_chassis_reboot_test.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/feature/gnoi/system/tests/complete_chassis_reboot/complete_chassis_reboot_test.go b/feature/gnoi/system/tests/complete_chassis_reboot/complete_chassis_reboot_test.go index b272c85db88..2b405739629 100644 --- a/feature/gnoi/system/tests/complete_chassis_reboot/complete_chassis_reboot_test.go +++ b/feature/gnoi/system/tests/complete_chassis_reboot/complete_chassis_reboot_test.go @@ -148,8 +148,18 @@ func TestChassisReboot(t *testing.T) { t.Logf("Time elapsed %.2f seconds > %d reboot delay", time.Since(start).Seconds(), rebootDelay) break } - latestTime, err := time.Parse(time.RFC3339, gnmi.Get(t, dut, gnmi.OC().System().CurrentDatetime().State())) - if err != nil { + var latestTime time.Time + var err error + if errMsg := testt.CaptureFatal(t, func(t testing.TB) { + latestTime, err = time.Parse(time.RFC3339, gnmi.Get(t, dut, gnmi.OC().System().CurrentDatetime().State())) + if err != nil { + t.Fatalf("Failed parsing current-datetime: %s", err) + } + }); errMsg != nil && time.Since(start).Seconds() < rebootDelay { + t.Fatalf("Get request failed before reboot delay, %s", *errMsg) + } + + if err != nil && time.Since(start).Seconds() < rebootDelay { t.Fatalf("Failed parsing current-datetime: %s", err) } if latestTime.Before(prevTime) || latestTime.Equal(prevTime) {