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

test: enable -race flag for running unit tests in CI #2558

Open
lucasrod16 opened this issue May 29, 2024 · 1 comment
Open

test: enable -race flag for running unit tests in CI #2558

lucasrod16 opened this issue May 29, 2024 · 1 comment

Comments

@lucasrod16
Copy link
Contributor

lucasrod16 commented May 29, 2024

Steps to reproduce

  1. On the main branch of the repository, run all of the unit tests with the -race flag:
go test -failfast -v -race -coverprofile=coverage.out -covermode=atomic $(go list ./... | grep -v '^github.com/defenseunicorns/zarf/src/test' | grep -v 'github.com/defenseunicorns/zarf/src/extensions/bigbang/test')

Expected result

All unit tests pass

Actual Result

Unit tests fail due to data races

Visual Proof (screenshots, videos, text, etc)

data-race

@lucasrod16 lucasrod16 added the bug 🐞 Something isn't working label May 29, 2024
@lucasrod16 lucasrod16 self-assigned this May 29, 2024
AustinAbro321 pushed a commit that referenced this issue May 30, 2024
## Description
Shutdown HTTP test servers with `Close()`

## Related Issue
Noticed we aren't shutting down HTTP test servers in a couple of our
unit tests while working on #2558

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
@lucasrod16
Copy link
Contributor Author

pterm's SpinnerPrinter and ProgressbarPrinter are not thread safe:

Better concurrency pattern for LivePrinters #439
Data race on pterm.SpinnerPrinter #482

There is an open draft PR that is supposed to fix most of these issues, but it appears to be stale:

Fix most data race issues & enable in CI tests #447

This means our tests will fail with the -race flag, whether run sequentially or concurrently, due to the bugs mentioned above.

I will keep this issue open to track any progress on fixing the concurrency issues in pterm.

@lucasrod16 lucasrod16 removed their assignment May 30, 2024
@lucasrod16 lucasrod16 added tests blocked upstream and removed bug 🐞 Something isn't working labels May 30, 2024
@lucasrod16 lucasrod16 changed the title Add -race flag to unit test make target and fix race conditions test: enable -race flag for running unit tests in CI May 30, 2024
@lucasrod16 lucasrod16 mentioned this issue Jun 13, 2024
2 tasks
AustinAbro321 pushed a commit that referenced this issue Jul 23, 2024
## Description
Shutdown HTTP test servers with `Close()`

## Related Issue
Noticed we aren't shutting down HTTP test servers in a couple of our
unit tests while working on #2558

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Triage
Development

No branches or pull requests

1 participant