Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: fix TestPendingUpdatesMetric flaky assertion#14534

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
spikecurtis merged 1 commit intomainfromspike/test-pending-updates-metric-flake
Sep 3, 2024

Conversation

spikecurtis
Copy link
Contributor

@spikecurtisspikecurtis commentedSep 3, 2024
edited
Loading

Fixes flake seen here:

https://github.com/coder/coder/actions/runs/10677025332/job/29591518118

The original test waits for DB calls to update success and failure of notifications, and blocks on apause channel. However, it uses a single pause channel for both DB calls, and so implicitly assumes that both success and failure updates occur during an update sync.

However, the update sync timer isn't synchronized to anything, and so there is a race where the update sync only has either the success or the failure result but not both. This blocks the test, which waits for both, and deadlocks before unpausing.

It appears the unpause mechanism is there to test that thePendingUpdates metric updates accordingly.

This fixes the flake by:

  1. using a Quartz clock to control when theManager syncs updates.
  2. waiting for thePendingUpdates metric to reach 2, so that we know that both success and failure have been queued up
  3. triggering the update via the Quartz mock clock

This has the nice property that a "pause" function is no longer required: we know the manager is in our desired state before we trigger the update, and can assert on the Metrics before and after.

@spikecurtisGraphite App
Copy link
ContributorAuthor

This stack of pull requests is managed by Graphite.Learn more about stacking.

Join@spikecurtis and the rest of your teammates onGraphiteGraphite

@spikecurtisspikecurtis marked this pull request as ready for reviewSeptember 3, 2024 08:54
Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing this@spikecurtis!

There's a minor change regardingdbtime to be made before merging.

func newNotifier(cfg codersdk.NotificationsConfig, id uuid.UUID, log slog.Logger, db Store,
hr map[database.NotificationMethod]Handler, metrics *Metrics, clock quartz.Clock,
) *notifier {
tick := clock.NewTicker(cfg.FetchInterval.Value(), "notifier", "fetchInterval")
Copy link
Contributor

Choose a reason for hiding this comment

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

I love these ticker tags ❤️

@spikecurtisspikecurtisforce-pushed thespike/test-pending-updates-metric-flake branch from0747bb8 to3ae3fbbCompareSeptember 3, 2024 09:38
@spikecurtisspikecurtis merged commit0eca1fc intomainSep 3, 2024
28 checks passed
@spikecurtisGraphite App
Copy link
ContributorAuthor

Merge activity

@spikecurtisspikecurtis deleted the spike/test-pending-updates-metric-flake branchSeptember 3, 2024 09:47
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dannykoppingdannykoppingdannykopping approved these changes

Assignees

@spikecurtisspikecurtis

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@spikecurtis@dannykopping

[8]ページ先頭

©2009-2025 Movatter.jp