Skip to content

CI: fix CAPI pull test on windows - #4634

Merged
blotus merged 2 commits into
masterfrom
windows-capi-pull-test
Aug 26, 2026
Merged

CI: fix CAPI pull test on windows#4634
blotus merged 2 commits into
masterfrom
windows-capi-pull-test

Conversation

@blotus

@blotus blotus commented Aug 26, 2026

Copy link
Copy Markdown
Member

TestAPICPull/test_pull was flaky on Windows runners: the test started api.Pull() in a
goroutine, slept 500ms, then asserted the decision was in the DB, meaning that on a slow runner (windows) the write could happen after the assertion.

Test now waits for the condition (require.EventuallyWithT) instead of a fixed sleep, and
shuts down + joins the pull routine in a cleanup, so it no longer leaks a goroutine that
kept pulling against a closed DB for the rest of the package run.

apic.go: Pull()'s "waiting for scenarios" loop used a bare time.Sleep and ignored the
tomb, so the routine could not be stopped until a machine registered a scenario. It now
selects on pullTomb.Dying(). This is what made the leaked goroutine unstoppable in the
test, and it also blocks shutdown in production.

@github-actions

Copy link
Copy Markdown

@blotus: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.

  • /kind feature
  • /kind enhancement
  • /kind refactoring
  • /kind fix
  • /kind chore
  • /kind dependencies
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@github-actions

Copy link
Copy Markdown

@blotus: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@blotus blotus changed the title Windows capi pull test CI: fix CAPI pull test on windows Aug 26, 2026
@blotus

blotus commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

/kind chore
/area local-api

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.58%. Comparing base (d66b45e) to head (755db6a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4634      +/-   ##
==========================================
- Coverage   64.62%   64.58%   -0.05%     
==========================================
  Files         521      521              
  Lines       39762    39767       +5     
==========================================
- Hits        25696    25682      -14     
- Misses      11670    11680      +10     
- Partials     2396     2405       +9     
Flag Coverage Δ
bats 41.19% <33.33%> (-0.06%) ⬇️
unit-linux 41.74% <83.33%> (-0.04%) ⬇️
unit-windows 30.22% <83.33%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sabban

sabban commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

lgtm

@sabban sabban left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@blotus
blotus merged commit 83f688a into master Aug 26, 2026
16 checks passed
@blotus
blotus deleted the windows-capi-pull-test branch August 26, 2026 18:12
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.

2 participants