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: Use eventually to avoid flakey test #700

Merged
merged 1 commit into from
Jun 23, 2023
Merged

Conversation

cbuto
Copy link
Contributor

@cbuto cbuto commented Jun 23, 2023

This test has been a bit flakey specifically when running in github actions.

Since the adding charts to the index is async, sometimes the metrics endpoint in this tests was being called before the second chart version was added to the index and thus the metrics were not updated.

example failure: https://github.com/helm/chartmuseum/actions/runs/5287153415/jobs/9567311265#step:5:835

2023-06-16T07:03:27.582Z	DEBUG	[33] Incoming request: /api/a/charts	{"reqID": "ab32022d-e8ee-47c9-b984-05a3d887b416"}
2023-06-16T07:03:27.583Z	DEBUG	[33] Adding package to storage	{"package": "mychart-0.1.0.tgz", "reqID": "ab32022d-e8ee-47c9-b984-05a3d887b416"}
2023-06-16T07:03:27.583Z	DEBUG	[33] PutWithLimit: per-chart-limit not set	{"reqID": "ab32022d-e8ee-47c9-b984-05a3d887b416"}
2023-06-16T07:03:27.583Z	DEBUG	[26] Entry saved in cache store	{"repo": "", "reqID": "5599daba-a3da-47fb-8915-a187d1def7ae"}
2023-06-16T07:03:27.583Z	DEBUG	[26] Event handled successfully	{"event": {"repo_name":"","operation_type":0,"chart_version":{"name":"mychart","version":"0.1.0","apiVersion":"v1","urls":["charts/mychart-0.1.0.tgz"],"created":"2023-06-16T07:03:27.577265453Z","digest":"14cd9996cc8eb0a3ef913ade40a3b000ab3dd3f5606595747cdd93786cc25d1f"}}, "reqID": "5599daba-a3da-47fb-8915-a187d1def7ae"}
2023-06-16T07:03:27.584Z	INFO	[33] Request served	{"path": "/api/a/charts", "comment": "", "clientIP": "", "method": "POST", "statusCode": 201, "latency": "2.140022ms", "reqID": "ab32022d-e8ee-47c9-b984-05a3d887b416"}
2023-06-16T07:03:27.584Z	DEBUG	[34] Incoming request: /api/a/charts	{"reqID": "436294b7-115e-44b0-bd4c-1d9b5feb38b9"}
2023-06-16T07:03:27.585Z	DEBUG	[33] Event received	{"event": {"repo_name":"a","operation_type":1,"chart_version":{"name":"mychart","version":"0.1.0","apiVersion":"v1","urls":["charts/mychart-0.1.0.tgz"],"created":"2023-06-16T07:03:27.5[836](https://github.com/helm/chartmuseum/actions/runs/5287153415/jobs/9567311265#step:5:837)95319Z","digest":"14cd9996cc8eb0a3ef913ade40a3b000ab3dd3f5606595747cdd93786cc25d1f"}}, "reqID": "ab32022d-e8ee-47c9-b984-05a3d887b416"}
2023-06-16T07:03:27.585Z	DEBUG	[34] Adding package to storage	{"package": "mychart-0.2.0.tgz", "reqID": "436294b7-115e-44b0-bd4c-1d9b5feb38b9"}
2023-06-16T07:03:27.585Z	DEBUG	[34] PutWithLimit: per-chart-limit not set	{"reqID": "436294b7-115e-44b0-bd4c-1d9b5feb38b9"}
2023-06-16T07:03:27.587Z	DEBUG	[33] Entry saved in cache store	{"repo": "a", "reqID": "ab32022d-e8ee-47c9-b984-05a3d887b416"}
2023-06-16T07:03:27.587Z	DEBUG	[33] Event handled successfully	{"event": {"repo_name":"a","operation_type":1,"chart_version":{"name":"mychart","version":"0.1.0","apiVersion":"v1","urls":["charts/mychart-0.1.0.tgz"],"created":"2023-06-16T07:03:27.583695319Z","digest":"14cd9996cc8eb0a3ef913ade40a3b000ab3dd3f5606595747cdd93786cc25d1f"}}, "reqID": "ab32022d-e8ee-47c9-b984-05a3d887b416"}
2023-06-16T07:03:27.587Z	INFO	[34] Request served	{"path": "/api/a/charts", "comment": "", "clientIP": "", "method": "POST", "statusCode": 201, "latency": "2.92633ms", "reqID": "436294b7-115e-44b0-bd4c-1d9b5feb38b9"}
2023-06-16T07:03:27.587Z	DEBUG	[35] Incoming request: /a/index.yaml	{"reqID": "d9679b71-d703-4aed-860d-0c06f31cc94b"}
2023-06-16T07:03:27.587Z	DEBUG	[35] Entry found in cache store	{"repo": "a", "reqID": "d9679b71-d703-4aed-860d-0c06f31cc94b"}
2023-06-16T07:03:27.588Z	INFO	[35] Request served	{"path": "/a/index.yaml", "comment": "", "clientIP": "", "method": "GET", "statusCode": 200, "latency": "165.602µs", "reqID": "d9679b71-d703-4aed-860d-0c06f31cc94b"}
2023-06-16T07:03:27.588Z	DEBUG	[36] Incoming request: /b/index.yaml	{"reqID": "002aca9b-5f06-400d-9254-fb4cdbcb69cb"}
2023-06-16T07:03:27.588Z	DEBUG	[36] Fetching chart list from storage	{"repo": "b", "reqID": "002aca9b-5f06-400d-9254-fb4cdbcb69cb"}
2023-06-16T07:03:27.588Z	DEBUG	[36] No change detected between cache and storage	{"repo": "b", "reqID": "002aca9b-5f06-400d-9254-fb4cdbcb69cb"}
2023-06-16T07:03:27.589Z	INFO	[36] Request served	{"path": "/b/index.yaml", "comment": "", "clientIP": "", "method": "GET", "statusCode": 200, "latency": "766.308µs", "reqID": "002aca9b-5f06-400d-9254-fb4cdbcb69cb"}
2023-06-16T07:03:27.589Z	DEBUG	[37] Incoming request: /metrics	{"reqID": "be507d15-2fb8-4493-b24f-08fe641aa321"}

# second chart version event was just received (not successfully processed yet)
2023-06-16T07:03:27.591Z	DEBUG	[34] Event received	{"event": {"repo_name":"a","operation_type":1,"chart_version":{"name":"mychart","version":"0.2.0","apiVersion":"v1","urls":["charts/mychart-0.2.0.tgz"],"created":"2023-06-16T07:03:27.585890[841](https://github.com/helm/chartmuseum/actions/runs/5287153415/jobs/9567311265#step:5:842)Z","digest":"5f2f1145e113d6c39260ef4be82e96f86e352eae156db006105d366b5d354cb8"}}, "reqID": "436294b7-115e-44b0-bd4c-1d9b5feb38b9"}
2023-06-16T07:03:27.591Z	DEBUG	[34] Entry found in cache store	{"repo": "a", "reqID": "436294b7-115e-44b0-bd4c-1d9b5feb38b9"}

# metrics endpoint is called
2023-06-16T07:03:27.592Z	INFO	[37] Request served	{"path": "/metrics", "comment": "", "clientIP": "", "method": "GET", "statusCode": 200, "latency": "3.426435ms", "reqID": "be507d15-2fb8-4493-b24f-08fe641aa321"}
    server_test.go:1008: 
        	Error Trace:	/home/runner/work/chartmuseum/chartmuseum/pkg/chartmuseum/server/multitenant/server_test.go:1008
        	Error:      	Should be true
        	Test:       	TestMultiTenantServerTestSuite/TestMetrics

@cbuto cbuto self-assigned this Jun 23, 2023
@pull-request-size pull-request-size bot added size/M and removed size/S labels Jun 23, 2023
@cbuto cbuto marked this pull request as ready for review June 23, 2023 19:40
@cbuto cbuto requested review from jdolitsky and scbizu June 23, 2023 19:40
@jdolitsky jdolitsky merged commit e1d98a8 into helm:main Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants