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

Flaky test: TestArtifactFetcher_SnapshotOnly #3693

Closed
faec opened this issue Nov 2, 2023 · 2 comments · Fixed by #3685
Closed

Flaky test: TestArtifactFetcher_SnapshotOnly #3693

faec opened this issue Nov 2, 2023 · 2 comments · Fixed by #3685
Assignees
Labels
flaky-test Unstable or unreliable test cases. Team:Elastic-Agent Label for the Agent team

Comments

@faec
Copy link
Contributor

faec commented Nov 2, 2023

TestArtifactFetcher_SnapshotOnly is flaky because of a data race in the test code. Error message:

WARNING: DATA RACE
--
  | Read at 0x00c00037e218 by goroutine 11:
  | github.com/elastic/elastic-agent/pkg/testing.(*writeProgress).printProgress()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact.go:285 +0x239
  | github.com/elastic/elastic-agent/pkg/testing.newWriteProgress.func1()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact.go:267 +0x58
  |  
  | Previous write at 0x00c00037e218 by goroutine 9:
  | github.com/elastic/elastic-agent/pkg/testing.(*writeProgress).Write()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact.go:273 +0xa8
  | io.(*teeReader).Read()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/io/io.go:615 +0xbe
  | io.copyBuffer()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/io/io.go:427 +0x28d
  | io.Copy()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/io/io.go:386 +0x88
  | os.genericReadFrom()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/os/file.go:161 +0x34
  | os.(*File).ReadFrom()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/os/file.go:155 +0x99
  | io.copyBuffer()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/io/io.go:413 +0x1c5
  | io.Copy()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/io/io.go:386 +0x62d
  | github.com/elastic/elastic-agent/pkg/testing.DownloadPackage()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact.go:243 +0x567
  | github.com/elastic/elastic-agent/pkg/testing.(*artifactResult).Fetch()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact.go:110 +0x456
  | github.com/elastic/elastic-agent/pkg/testing.TestArtifactFetcher_SnapshotOnly()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact_test.go:95 +0xdc7
  | testing.tRunner()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:1576 +0x216
  | testing.(*T).Run.func1()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:1629 +0x47
  |  
  | Goroutine 11 (running) created at:
  | github.com/elastic/elastic-agent/pkg/testing.newWriteProgress()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact.go:267 +0x1dc
  | github.com/elastic/elastic-agent/pkg/testing.DownloadPackage()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact.go:237 +0x484
  | github.com/elastic/elastic-agent/pkg/testing.(*artifactResult).Fetch()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact.go:110 +0x456
  | github.com/elastic/elastic-agent/pkg/testing.TestArtifactFetcher_SnapshotOnly()
  | /Users/admin/builds/bk-agent-prod-orka-1698924985688909064/elastic/elastic-agent/pkg/testing/fetcher_artifact_test.go:95 +0xdc7
  | testing.tRunner()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:1576 +0x216
  | testing.(*T).Run.func1()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:1629 +0x47
  |  
  | Goroutine 9 (running) created at:
  | testing.(*T).Run()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:1629 +0x805
  | testing.runTests.func1()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:2036 +0x8d
  | testing.tRunner()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:1576 +0x216
  | testing.runTests()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:2034 +0x87c
  | testing.(*M).Run()
  | /Users/admin/.gvm/versions/go1.20.10.darwin.amd64/src/testing/testing.go:1906 +0xb44
  | main.main()
  | _testmain.go:90 +0x2fc
  | ==================
  | fetcher_artifact.go:285: Downloading artifact progress 100.00%
  | fetcher_artifact.go:252: Completed downloading artifact from https://snapshots.elastic.co/8.8.0-ba3f07b2/downloads/beats/elastic-agent/elastic-agent-8.6.0-SNAPSHOT-darwin-x86_64.tar.gz.sha512
  | testing.go:1446: race detected during execution of test
@faec faec added Team:Elastic-Agent Label for the Agent team flaky-test Unstable or unreliable test cases. labels Nov 2, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

@cmacknz
Copy link
Member

cmacknz commented Nov 2, 2023

Fix is here #3685

@cmacknz cmacknz linked a pull request Nov 2, 2023 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-test Unstable or unreliable test cases. Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants