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

Update tests to accommodate /batch_send returning separate meta event fields (MSC2716) #204

Merged
merged 24 commits into from
Sep 21, 2021

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Sep 7, 2021

Update tests to accommodate /batch_send returning separate meta event fields.

Corresponding Synapse changes in matrix-org/synapse#10777

See matrix-org/matrix-spec-proposals#2716 (comment)

Part of MSC2716

@@ -112,43 +112,53 @@ func TestBackfillingHistory(t *testing.T) {
eventIDsAfter := createMessagesInRoom(t, alice, roomID, 2)

// Insert the most recent chunk of backfilled history
insertTime1 := timeAfterEventBefore.Add(timeBetweenMessages * 3)
insertTime0 := timeAfterEventBefore.Add(timeBetweenMessages * 3)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating from insertTime1 -> insertTime0 to match the chunk explanation below

tests/msc2716_test.go Outdated Show resolved Hide resolved
if len(historicalEventIDs) != 5 {
t.Fatalf("Expected eventID list should be length 5 but saw %d: %s", len(historicalEventIDs), historicalEventIDs)
if len(historicalEventIDs) != 2 {
t.Fatalf("Expected eventID list should be length 2 but saw %d: %s", len(historicalEventIDs), historicalEventIDs)
Copy link
Member

Choose a reason for hiding this comment

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

Please please please document why you expect this to be 2. I don't see you changing the number of injected events, so why shouldn't this be 5? I'm guessing the event IDs returned in the batch endpoint are the earliest or something? But this is really really not clear. It's hard enough to follow all the event IDs and markers and timestamps without randomly changing a 5 into a 2 without any reason why.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's changed here is we have gone from including the 3 insertion and chunk events in the event_ids response, to separating them out to their own fields.

So now event_ids in the response only includes the 2 historical events that you sent in your request which is much more obvious for a downstream user (spawned from matrix-org/matrix-spec-proposals#2716 (comment))

I've updated the assertion message to make it clear Expected 2 event_ids in the response that correspond to the 2 events we sent in the request but saw XX: ...

@MadLittleMods MadLittleMods changed the base branch from madlittlemods/msc2716-verify-params to master September 21, 2021 19:46
@MadLittleMods
Copy link
Contributor Author

@kegsay Thanks for the initial round of review 🐷 Good shout on the useless getters!

Merging as the chain of PRs is getting a little too unwieldy. I'm willing to change anything you comment about in a follow-up though ⏩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants