diff --git a/feature/gnsi/acctz/tests/record_payload_truncation/record_payload_truncation_test.go b/feature/gnsi/acctz/tests/record_payload_truncation/record_payload_truncation_test.go index 1736c034e18..6e762941a0a 100644 --- a/feature/gnsi/acctz/tests/record_payload_truncation/record_payload_truncation_test.go +++ b/feature/gnsi/acctz/tests/record_payload_truncation/record_payload_truncation_test.go @@ -78,11 +78,14 @@ func TestAccountzRecordPayloadTruncation(t *testing.T) { helpers.GnmiCLIConfig(t, dut, communitySetCLIConfig) } - startTime := time.Now() - + // Get the current time from the router via gNMI to avoid clock skew issues. + startTime := helpers.GetRouterTime(t, dut) acctzClient := dut.RawAPIs().GNSI(t).AcctzStream() acctzSubClient, err := acctzClient.RecordSubscribe(context.Background(), &acctzpb.RecordRequest{ - Timestamp: timestamppb.New(startTime), + Timestamp: ×tamppb.Timestamp{ + Seconds: startTime.Unix(), + Nanos: 0, + }, }) if err != nil { t.Fatalf("Failed to subscribe to acctz records: %v", err) diff --git a/feature/gnsi/acctz/tests/record_subscribe_full/record_subscribe_full_test.go b/feature/gnsi/acctz/tests/record_subscribe_full/record_subscribe_full_test.go index 7a2bdf8ba91..bc944053716 100644 --- a/feature/gnsi/acctz/tests/record_subscribe_full/record_subscribe_full_test.go +++ b/feature/gnsi/acctz/tests/record_subscribe_full/record_subscribe_full_test.go @@ -26,6 +26,7 @@ import ( "github.com/openconfig/featureprofiles/internal/deviations" "github.com/openconfig/featureprofiles/internal/fptest" + "github.com/openconfig/featureprofiles/internal/helpers" "github.com/openconfig/featureprofiles/internal/security/acctz" acctzpb "github.com/openconfig/gnsi/acctz" "github.com/openconfig/ondatra" @@ -53,8 +54,8 @@ func TestAccountzRecordSubscribeFull(t *testing.T) { } else { acctz.SetupUsers(t, dut, false) } - startTime := time.Now() - + // Get the current time from the router via gNMI to avoid clock skew issues. + startTime := helpers.GetRouterTime(t, dut) // Get gNSI record subscribe client. requestTimestamp := ×tamppb.Timestamp{ Seconds: startTime.Unix(),