Skip to content

tests: attempt to deflake proxy tests - #7696

Merged
sipsma merged 2 commits into
dagger:mainfrom
sipsma:deflake-proxy-tests
Jun 18, 2024
Merged

sipsma merged 2 commits into
dagger:mainfrom
sipsma:deflake-proxy-tests

Conversation

@sipsma

@sipsma sipsma commented Jun 18, 2024

Copy link
Copy Markdown
Contributor

I couldn't repro this locally but there were occasional CI flakes in the proxy test that pulls a git repo and verifies the proxy logs show a connection to github.com (needed to verify that git ops correctly use proxy settings).

My best guess is that the squid logs were just not always flushed by the time they were read for the test assertion, so this updates the tests to explicitly start/stop the squid service and do some retries on reading the logs.

Will have to see if this actually fixes the problem. If not there's more complicated options like starting a separate custom git service, intercepting traffic and asserting there. Would prefer to avoid complicating these already complicated tests further if possible though.

@sipsma
sipsma requested review from jedevc and vito June 18, 2024 18:43
I couldn't repro this locally but there were occasional CI flakes in the
proxy test that pulls a git repo and verifies the proxy logs show a
connection to github.com (needed to verify that git ops correctly use
proxy settings).

My best guess is that the squid logs were just not always flushed by the
time they were read for the test assertion, so this updates the tests to
explicitly start/stop the squid service and do some retries on reading
the logs.

Will have to see if this actually fixes the problem. If not there's more
complicated options like starting a separate custom git service,
intercepting traffic and asserting there. Would prefer to avoid
complicating these already complicated tests further if possible though.

Signed-off-by: Erik Sipsma <[email protected]>
test.proxyLogTest(t, c, func(ctx context.Context) (string, error) {
return c.Container().From(alpineImage).
WithMountedCache("/var/log/squidaccess", squidLogsVolume).
WithExec([]string{"cat", "/var/log/squidaccess/access.log"}).

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.

Does this need a cache-buster for the cat?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah good point! Wouldn't be surprised if that was part/whole of the flake before, I'll keep these updates but add that in too

@vito vito 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.

Nice - will keep an eye out to see if it comes up again!

@sipsma
sipsma merged commit 5466ed0 into dagger:main Jun 18, 2024
@sipsma sipsma added the kind/flake Sometimes failing, sometimes not label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/flake Sometimes failing, sometimes not

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants