Skip to content

Commit

Permalink
Unskip dendrite skipif on a members presence test (matrix-org#516)
Browse files Browse the repository at this point in the history
* Make local members presence test more reliable

and able to be ran in isolation

* add explicit presence-setting

* fix dendrite test failure

* fix imports

* apply review feedback

* add more parentheses, change skipif note, and remove additional skipif

* address review feedback

---------

Co-authored-by: kegsay <kegan@matrix.org>
  • Loading branch information
ShadowJonathan and kegsay committed May 19, 2023
1 parent ae1f8f2 commit 68c7643
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/csapi/rooms_members_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import (
)

func TestMembersLocal(t *testing.T) {
deployment := Deploy(t, b.BlueprintOneToOneRoom)
deployment := Deploy(t, b.BlueprintAlice)
defer deployment.Destroy(t)

alice := deployment.Client(t, "hs1", "@alice:hs1")
bob := deployment.Client(t, "hs1", "@bob:hs1")
// Here we don't use the BlueprintOneToOneRoom because else Bob would be able to see Alice's presence changes through
// that pre-existing one-on-one DM room. So we exclude that here.
bob := deployment.RegisterUser(t, "hs1", "bob", "bobspassword", false)
roomID := alice.CreateRoom(t, map[string]interface{}{"preset": "public_chat"})

bob.MustDoFunc(
Expand All @@ -23,7 +25,7 @@ func TestMembersLocal(t *testing.T) {
}),
)

_, incrementalSyncToken := alice.MustSync(t, client.SyncReq{})
_, incrementalSyncTokenBeforeBobJoinsRoom := alice.MustSync(t, client.SyncReq{TimeoutMillis: "0"})
bob.JoinRoom(t, roomID, []string{})

t.Run("Parallel", func(t *testing.T) {
Expand All @@ -38,15 +40,17 @@ func TestMembersLocal(t *testing.T) {
t.Run("Existing members see new members' join events", func(t *testing.T) {
t.Parallel()
// SyncJoinedTo already checks everything we need to know
alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(bob.UserID, roomID))
alice.MustSyncUntil(t, client.SyncReq{Since: incrementalSyncTokenBeforeBobJoinsRoom}, client.SyncJoinedTo(bob.UserID, roomID))
})

// sytest: Existing members see new members' presence
// Split into initial and incremental sync cases in Complement.
t.Run("Existing members see new members' presence in initial sync", func(t *testing.T) {
runtime.SkipIf(t, runtime.Dendrite) // FIXME: https://github.com/matrix-org/dendrite/issues/2803
t.Run("Existing members see new members' presence (in initial sync)", func(t *testing.T) {
runtime.SkipIf(t, runtime.Dendrite) // FIXME: https://github.com/matrix-org/matrix-spec/issues/1374
t.Parallel()
// First we sync to make sure bob to have joined the room...
alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(bob.UserID, roomID))
// ...and then we do another initial sync - this time waiting for bob's presence - to confirm we can get that.
alice.MustSyncUntil(t, client.SyncReq{},
client.SyncJoinedTo(bob.UserID, roomID),
client.SyncPresenceHas(bob.UserID, nil),
Expand All @@ -55,10 +59,9 @@ func TestMembersLocal(t *testing.T) {

// sytest: Existing members see new members' presence
// Split into initial and incremental sync cases in Complement.
t.Run("Existing members see new members' presence in incremental sync", func(t *testing.T) {
runtime.SkipIf(t, runtime.Dendrite) // FIXME: https://github.com/matrix-org/dendrite/issues/2803
t.Run("Existing members see new members' presence (in incremental sync)", func(t *testing.T) {
t.Parallel()
alice.MustSyncUntil(t, client.SyncReq{Since: incrementalSyncToken},
alice.MustSyncUntil(t, client.SyncReq{Since: incrementalSyncTokenBeforeBobJoinsRoom},
client.SyncJoinedTo(bob.UserID, roomID),
client.SyncPresenceHas(bob.UserID, nil),
)
Expand Down

0 comments on commit 68c7643

Please sign in to comment.