-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add test for transactions containing a V1 event into a V10 room #743
base: main
Are you sure you want to change the base?
Add test for transactions containing a V1 event into a V10 room #743
Conversation
Signed-off-by: morguldir <morguldir@protonmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments below.
tests/federation_room_send_test.go
Outdated
} | ||
|
||
for eventID, e := range resp.PDUs { | ||
if eventID != "$meow" && eventID != event.EventID() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does $meow
come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, i think that was the bad event id i used originally, but ended up just calculating it instead, fixed
if eventID != "$meow" && eventID != event.EventID() { | ||
ct.Fatalf(t, "Server responded with bogus event ID %s", eventID) | ||
} else if e.Error == "" { | ||
ct.Fatalf(t, "Server accepted event sent into a V10 room using V1 format") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least for Dendrite, this is fine. When it receives a transaction, it extracts the room ID, asks the DB about the version and then executes NewEventFromUntrustedJSON
(link), which for a V10
room (not specified in the test) runs newEventFromUntrustedJSONV2
(link), which strips out the event_id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a bogus prev_event too, now it will get the INFO log about not including the event id in the error dict instead
nexy := srv.UserID("nexy") | ||
|
||
room := alice.MustCreateRoom(t, map[string]interface{}{ | ||
"preset": "public_chat", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the log below wants room version 10, specify it, as it otherwise defaults to the server implementations default (which might be unknown).
"preset": "public_chat", | |
"preset": "public_chat", | |
"room_version": "10", |
tests/federation_room_send_test.go
Outdated
Type: "m.room.message", | ||
Content: map[string]interface{}{"body": "hello i am nexy and i somehow broke the room into a v1 room"}, | ||
}) | ||
//event.EventID() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//event.EventID() |
t.Log("invalid json bwuh", err) | ||
t.FailNow() | ||
} | ||
data, err = sjson.SetBytes(data, "event_id", event.EventID()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing error check.
Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com> Signed-off-by: morguldir <morguldir@protonmail.com>
Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com>
Pull Request Checklist