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

Sytest: Add 30rooms/60version_upgrade tests #554

Closed

Conversation

ShadowJonathan
Copy link
Contributor

This adds 6 sytests:

  • ./tests/30rooms/60version_upgrade.pl: test "$user_type user has push rules copied to upgraded room",
  • ./tests/30rooms/60version_upgrade.pl:test "/upgrade creates a new room",
  • ./tests/30rooms/60version_upgrade.pl:test "/upgrade moves aliases to the new room",
  • ./tests/30rooms/60version_upgrade.pl:test "/upgrade is rejected if the user can't send state events",
  • ./tests/30rooms/60version_upgrade.pl:test "/upgrade of a bogus room fails gracefully",
  • ./tests/30rooms/60version_upgrade.pl:test "/upgrade to an unknown version is rejected",

However, this also ignores the remaining 13 sytests, due to non-formalisation of what they're testing for in the spec, see matrix-org/matrix-spec#1324 and matrix-org/matrix-spec#456 for more details on that.

This also adds some extra logging in MustSyncUntil to make it clear which checker exactly it is printing errors for, this is useful when the errors inside the checker itself are ambiguous or not helpful with identifying the checker.

ignore the rest due to non-formalisation

also alter MustSyncUntil to number checks in error output
@ShadowJonathan ShadowJonathan requested review from a team and kegsay as code owners November 10, 2022 10:30
@ShadowJonathan
Copy link
Contributor Author

ShadowJonathan commented Nov 10, 2022

CI is failing because of #550, will merge/rebase after that is merged

@clokep
Copy link
Member

clokep commented Nov 28, 2022

CI is failing because of #550, will merge/rebase after that is merged

CI seems to still be failing @ShadowJonathan , is that expected?

@ShadowJonathan
Copy link
Contributor Author

@clokep those are unrelated flakes, could you kick off a rerun?

@DMRobertson
Copy link
Contributor

I did another rerun and this is green.

Copy link
Contributor

@DMRobertson DMRobertson left a comment

Choose a reason for hiding this comment

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

I've only looked at the first sytest. Some thoughts in passing. Will see if I can get to the others next week.

Comment on lines +26 to +27
_, tombstoneSinceToken := alice.MustSync(t, client.SyncReq{TimeoutMillis: "0"})
_, sinceToken := alice.MustSync(t, client.SyncReq{TimeoutMillis: "0"})
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit odd to sync twice rather than copy the token into a new var

Copy link
Contributor

Choose a reason for hiding this comment

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

Might be clearer if this was a MustSyncUntil which waits for Alice to see her membership of the new room?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the same since-token creates - for my feeling - Undefined Behaviour, and these exist to detect two different things in disjoint "timelines";

  • One is looking for the tombstone event, which can happen before or after creating the new room.
  • One is looking for the new room, which can happen before or after the tombstone event is emitted.

This might look like a clear case of using the same since-token twice, but I've encountered subtle weird behaviour in the past with using the same sync token twice, and as this kind of behaviour is not explicitly defined in the spec (it only talks about and assumes that one uses a since token exactly once), i'm being conservative here, creating two different since tokens to use for different "spans of time" to test.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay. Can you please spell this out with a comment: something to the effect of "the tombstone and new room can appear down /sync in either order, so we check for these using separate /sync tracks". Can we also have a more descriptive name for the second sinceToken which describes what it is being used to wait for, please.

tests/csapi/room_upgrade_test.go Outdated Show resolved Hide resolved
tests/csapi/room_upgrade_test.go Outdated Show resolved Hide resolved
tests/csapi/room_upgrade_test.go Outdated Show resolved Hide resolved
tests/csapi/room_upgrade_test.go Outdated Show resolved Hide resolved
@DMRobertson DMRobertson self-assigned this Dec 2, 2022
},
})

_, sinceToken := alice.MustSync(t, client.SyncReq{TimeoutMillis: "0"})
Copy link
Contributor

Choose a reason for hiding this comment

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

What are syncing for here? Can we make this a MustSyncUntil and make the thing we want to see?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are syncing explicitly over the span of time of the room upgrade, I find this cleaner to test for.

Copy link
Contributor

@DMRobertson DMRobertson Dec 13, 2022

Choose a reason for hiding this comment

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

We are syncing explicitly over the span of time of the room upgrade

What guarantees that this /sync response includes Alice's join to the room and the canonical alias event she sent?

"POST",
[]string{"_matrix", "client", "v3", "rooms", roomID, "upgrade"},
client.WithJSONBody(t, map[string]string{
"new_version": "6",
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason for 6? Sytest used to have 2 AFAICS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No particular reason, but I think that we should really start to use a more modern room number than 2.

tests/csapi/room_upgrade_test.go Outdated Show resolved Hide resolved
})

user.JoinRoom(t, roomID, []string{"hs1"})
alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(user.UserID, roomID))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is alice syncing? Presumably this should be user.MustSyncUntil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If user asserts that it has joined the room, the join might not have propagated to alice's homeserver, so when alice asserts it, it must've registered on both user and alice's homeserver, which means its safe to assume this going forward, whereas its not when only user sees it.

It might look small, but it could result in a flake if alice's homeserver is just slow enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

when alice asserts it, it must've registered on both user and alice's homeserver,

while this is true, it's not obvious to the reader at first glance.

Can we either

  • have a comment along the lines of your own above, or
  • change (2) to have user wait for the join, and then change alice's sync on +43 to wait for user's join before upgrading the room.

}),
)

_, sinceToken := alice.MustSync(t, client.SyncReq{TimeoutMillis: "0"})
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is alice syncing here? Please make the condition explicit

Copy link
Contributor Author

@ShadowJonathan ShadowJonathan Dec 10, 2022

Choose a reason for hiding this comment

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

This is because alice upgrades the room, and will be the first to see the new events and its results. IIRC this is also what the sytest did, incrementally syncing from a room's upgrader to observe its results there.

If it were user, they would have do a sync in the meantime to assert the room has upgraded, join the room, and then do another sync (which might miss the room creation event due to gaps), and then have that be observed. Its cleaner to have the upgrader do this with one sync, where its assumed they join the room they're upgrading, and that they also get all the room creation events nicely frontloaded.

Copy link
Contributor

Choose a reason for hiding this comment

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

My objection isn't that the user that's syncing is Alice; it's that I don't know what we are waiting for Alice to see down /sync before upgrading the room. That's why I suggest splitting out user and alice's syncs in https://github.com/matrix-org/complement/pull/554/files#r1047211314 --- it makes it easier to see what each client is waiting to see before the scenario progresses.

tests/federation_room_upgrade_test.go Show resolved Hide resolved
tests/federation_room_upgrade_test.go Outdated Show resolved Hide resolved
tests/federation_room_upgrade_test.go Outdated Show resolved Hide resolved
tests/federation_room_upgrade_test.go Outdated Show resolved Hide resolved
@DMRobertson DMRobertson removed their assignment Dec 5, 2022
@ShadowJonathan ShadowJonathan requested review from DMRobertson and removed request for kegsay December 10, 2022 11:03
@DMRobertson DMRobertson requested a review from a team February 6, 2023 18:19
/upgrade restricts power levels in the old room
/upgrade restricts power levels in the old room when the old PLs are unusual
/upgrade should preserve room visibility for $vis rooms

# Tests deprecated endpoints
Tags appear in the v1 /initialSync
Tags appear in the v1 /events stream
Copy link
Contributor

Choose a reason for hiding this comment

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

@ShadowJonathan What's the status with this other unresolved review feedback?

@kegsay kegsay added the stale This issue or PR is old and may be closed soon label Sep 11, 2023
@kegsay
Copy link
Member

kegsay commented Sep 6, 2024

Closing as stale.

@kegsay kegsay closed this Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This issue or PR is old and may be closed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants