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: fix race in http sync test #401

Merged
merged 1 commit into from
Feb 13, 2023
Merged

fix: fix race in http sync test #401

merged 1 commit into from
Feb 13, 2023

Conversation

toddbaert
Copy link
Member

@toddbaert toddbaert commented Feb 10, 2023

In the TestSimpleSync test we are asserting that hs.Cron.AddFunc and hs.Cron.Start are called by the time the dataSync is sent. This is a race, because these methods are actually called after the first send. I get failures here ~25% of the time (seems like @skyerus does too).

This changes things to add the handler and start the cron before the first send, which makes things deterministic.

@codecov
Copy link

codecov bot commented Feb 10, 2023

Codecov Report

Merging #401 (f5ee476) into main (9d7dbd1) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head f5ee476 differs from pull request most recent head c07027b. Consider uploading reports for the commit c07027b to get more accurate results

@@            Coverage Diff             @@
##             main     #401      +/-   ##
==========================================
+ Coverage   65.62%   65.65%   +0.02%     
==========================================
  Files          10       10              
  Lines        1213     1214       +1     
==========================================
+ Hits          796      797       +1     
  Misses        367      367              
  Partials       50       50              
Impacted Files Coverage Δ
pkg/sync/http/http_sync.go 40.47% <100.00%> (+0.71%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@toddbaert toddbaert force-pushed the fix/http-sync-test-race branch from 3cf1538 to b780c7b Compare February 10, 2023 19:04
@toddbaert toddbaert force-pushed the fix/http-sync-test-race branch from b780c7b to f5ee476 Compare February 10, 2023 21:19
Signed-off-by: Todd Baert <toddbaert@gmail.com>
@toddbaert toddbaert force-pushed the fix/http-sync-test-race branch from f5ee476 to c07027b Compare February 13, 2023 15:18
@toddbaert toddbaert merged commit 1d0c8e1 into main Feb 13, 2023
@beeme1mr beeme1mr deleted the fix/http-sync-test-race branch February 13, 2023 16:12
Kavindu-Dodan pushed a commit that referenced this pull request Feb 13, 2023
🤖 I have created a release *beep* *boop*
---


##
[0.3.7](v0.3.6...v0.3.7)
(2023-02-13)


### Bug Fixes

* **deps:** update module golang.org/x/net to v0.6.0
([#396](#396))
([beb7564](beb7564))
* **deps:** update module google.golang.org/grpc to v1.53.0
([#388](#388))
([174cd7c](174cd7c))
* error handling of Serve/ServeTLS funcs
([#397](#397))
([8923bf2](8923bf2))
* fix race in http sync test
([#401](#401))
([1d0c8e1](1d0c8e1))
* sbom artefact name
([#380](#380))
([3daef26](3daef26)),
closes [#379](#379)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Dec 2, 2023
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.

4 participants