Don't assert human error message in TestAsyncUpload (de-flake)#839
Merged
MadLittleMods merged 8 commits intomainfrom Jan 26, 2026
Merged
Conversation
MadLittleMods
commented
Jan 22, 2026
| JSON: []match.JSON{ | ||
| match.JSONKeyEqual("errcode", "M_NOT_YET_UPLOADED"), | ||
| match.JSONKeyEqual("error", "Media has not been uploaded yet"), | ||
| match.JSONKeyPresent("error"), |
Collaborator
Author
There was a problem hiding this comment.
For reference, we do match.JSONKeyPresent("error") in a few other places. I think this can make sense in terms of making sure it's a standard Matrix error response.
Contributor
There was a problem hiding this comment.
This is the same approach that was just taken here for testing the error on the /health endpoint in synapse.
I think it makes the most sense.
This was referenced Jan 22, 2026
error message in TestAsyncUploaderror message in TestAsyncUpload (de-flake)
devonh
approved these changes
Jan 26, 2026
Contributor
devonh
left a comment
There was a problem hiding this comment.
Looks like a nice easy fix to deflake things :)
| JSON: []match.JSON{ | ||
| match.JSONKeyEqual("errcode", "M_NOT_YET_UPLOADED"), | ||
| match.JSONKeyEqual("error", "Media has not been uploaded yet"), | ||
| match.JSONKeyPresent("error"), |
Contributor
There was a problem hiding this comment.
This is the same approach that was just taken here for testing the error on the /health endpoint in synapse.
I think it makes the most sense.
MadLittleMods
added a commit
that referenced
this pull request
Jan 26, 2026
Now you can run tests individually: ``` COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh ./tests/csapi -run TestAsyncUpload/Cannot_upload_to_a_media_ID_that_has_already_been_uploaded_to ``` This refactor is spawning from #839 where I wanted to specifically run the flaky test.
Base automatically changed from
madlittlemods/fix-media-async-upload-tests-not-being-independent
to
main
January 26, 2026 19:36
…dependent' into madlittlemods/fix-test-async-media-assert-human-error
Collaborator
Author
|
Thanks for the review @devonh 🐕🦺 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Don't assert human
errormessage inTestAsyncUpload(de-flake).As a general rule, we should not be asserting the language of human
errormessages. They can change at any time, localized, etc.This is spawning from a real life flaky failure I'm seeing when testing with the workers variant of Synapse:
$ WORKERS=1 COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh ./tests/csapi -run TestAsyncUpload/Cannot_upload_to_a_media_ID_that_has_already_been_uploaded_to ... === NAME TestAsyncUpload/Cannot_upload_to_a_media_ID_that_has_already_been_uploaded_to media_async_uploads_test.go:68: MatchResponse key 'error' got 'Media ID cannot be overwritten' (type string) want 'Media ID already has content' (type string) - http://127.0.0.1:33651/_matrix/media/v3/upload/hs1/GjRDDFucigeiLQtzNbjADIoI => {"errcode":"M_CANNOT_OVERWRITE_MEDIA","error":"Media ID cannot be overwritten"} 2026/01/22 17:05:44 ============================================ --- FAIL: TestAsyncUpload (14.13s) --- FAIL: TestAsyncUpload/Cannot_upload_to_a_media_ID_that_has_already_been_uploaded_to (0.07s) FAIL FAIL github.com/matrix-org/complement/tests/csapi 16.063s FAILI also see this test listed in the known flakes we track with Synapse: element-hq/synapse#18537
This problem happens because there are two possible error messages in Synapse which we could encounter for
M_CANNOT_OVERWRITE_MEDIA:"Media ID already has content""Media ID cannot be overwritten"Dev notes
How to run in
element-hq/synapse-rust-apps:Pull Request Checklist