Skip to content

Fix ACCTZ clock skew by using DUT clock for RecordSubscribe timestamps#5347

Open
pjacakArista wants to merge 1 commit into
openconfig:mainfrom
pjacakArista:arista-ACCTZ4.2-timestamp
Open

Fix ACCTZ clock skew by using DUT clock for RecordSubscribe timestamps#5347
pjacakArista wants to merge 1 commit into
openconfig:mainfrom
pjacakArista:arista-ACCTZ4.2-timestamp

Conversation

@pjacakArista
Copy link
Copy Markdown

ACCTZ tests (ACCTZ-1.1, 2.1, 3.1, 4.2) use time.Now() from the test host for RecordSubscribe request timestamps. Clock skew between the test host and DUT (~300-825ms observed) causes the acctz service to reject the timestamp as "in the future", resulting in deterministic test failures.

Add a shared acctz.StartTimestamp() helper that fetches the DUT's own clock via gNMI /system/state/current-datetime and use it across all four acctz tests instead of the various per-test workarounds (Nanos: 0, time.Sleep, time.Now().Add(-10s)).

With this change ACCTZ-4.2 passes on Arista's EOS

@pjacakArista pjacakArista requested review from a team as code owners April 16, 2026 12:10
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses deterministic test failures in the ACCTZ suite caused by clock skew between the test host and the device under test (DUT). By standardizing the timestamp generation to use the DUT's own clock via gNMI, the tests become more robust and reliable across different environments.

Highlights

  • New Helper Function: Introduced acctz.StartTimestamp() to fetch the current time directly from the DUT via gNMI.
  • Test Stability: Updated multiple ACCTZ tests to use the new helper, eliminating deterministic failures caused by clock skew between the test host and the DUT.
  • Cleanup: Removed various per-test workarounds for clock synchronization, such as manual time offsets and sleeps.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helper function, acctz.StartTimestamp, which retrieves the current time from the Device Under Test (DUT) via gNMI to prevent clock skew issues in accounting tests. This helper is integrated into several test files to replace local time capturing. A critical issue was identified in record_subscribe_partial_test.go where the request timestamp is captured after the RPCs are sent, which would result in missing the expected records in the subscription stream.

@pjacakArista pjacakArista force-pushed the arista-ACCTZ4.2-timestamp branch from 5c59677 to 3825208 Compare April 29, 2026 11:06
@pjacakArista
Copy link
Copy Markdown
Author

PR #5330 added GetRouterTime and it's now used in some tests, but not to record_payload_truncation_test and record_subscribe_full_test

Scope of this PR is now limited to those 2 tests only

@pjacakArista pjacakArista force-pushed the arista-ACCTZ4.2-timestamp branch from 3825208 to efa5969 Compare May 5, 2026 08:18
@pjacakArista pjacakArista requested review from a team as code owners May 7, 2026 05:43
@pjacakArista pjacakArista force-pushed the arista-ACCTZ4.2-timestamp branch from b344267 to dbe6880 Compare May 14, 2026 21:20
The record_payload_truncation and record_subscribe_full tests use
time.Now() from the test host as the RecordSubscribe request timestamp.
Clock skew between the test host and DUT (~300-825ms observed) causes
the acctz service to reject the timestamp as "in the future", resulting
in deterministic test failures.

Replace time.Now() with helpers.GetRouterTime() to source the timestamp
from the DUT's own clock, matching the pattern already used in
record_subscribe_non_grpc and record_subscribe_partial.
@pjacakArista pjacakArista force-pushed the arista-ACCTZ4.2-timestamp branch from dbe6880 to 45024db Compare May 22, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants