Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): Add custom comparer to ignore timestamps in capture tests #1173

Merged
merged 2 commits into from
Jan 2, 2025

Conversation

kamilprz
Copy link
Contributor

Description

Previously, in PR 894, timestamps were introduced to be able to print capture names as their jobs were beginning.

This PR addresses an oversight in the testing which compared whether the timestamp of the test and the timestamp of the test capture were the same. This was not always the case - particularly if there was some delay between the beginning of the test and the beginning of the capture. The change in this PR adds a custom comparer to the cmp.Diff which ignores the timestamp environment variables.

Related Issue

1045

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Testing Completed

The tests now succeed regardless of whether a delay occurs or not - causing the timestamps to differ. This was simulated with an artificial delay with time.Sleep.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@kamilprz kamilprz requested a review from a team as a code owner December 31, 2024 11:48
@kamilprz kamilprz changed the title (fix): Add custom comparer to ignore timestamps in capture tests fix(test): Add custom comparer to ignore timestamps in capture tests Dec 31, 2024
Copy link

@ibezrukavyi ibezrukavyi left a comment

Choose a reason for hiding this comment

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

Could you please add separate check that timestamp is not empty and valid.

@kamilprz kamilprz added this pull request to the merge queue Jan 2, 2025
Merged via the queue into microsoft:main with commit 87d2196 Jan 2, 2025
27 checks passed
@kamilprz kamilprz deleted the capture-tests branch January 2, 2025 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants