Skip to content

Commit 9255e25

Browse files
committed
Add Venator homeserver build tag
Signed-off-by: timedout <git@nexy7574.co.uk>
1 parent 1a2baac commit 9255e25

56 files changed

Lines changed: 378 additions & 55 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

runtime/hs.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package runtime
22

33
import (
44
"context"
5+
"slices"
56

67
"github.com/docker/docker/client"
78
"github.com/matrix-org/complement/ct"
@@ -12,6 +13,7 @@ const (
1213
Synapse = "synapse"
1314
Conduit = "conduit"
1415
Conduwuit = "conduwuit"
16+
Venator = "venator"
1517
)
1618

1719
var Homeserver string
@@ -50,3 +52,19 @@ func SkipIf(t ct.TestLike, hses ...string) {
5052
)
5153
}
5254
}
55+
56+
// SkipUnless is the inverse of SkipIf: if the homeserver being tested is not present in the provided set, the test is skipped.
57+
// This also means running without a blacklist tag will always skip.
58+
func SkipUnless(t ct.TestLike, hses ...string) {
59+
t.Helper()
60+
if slices.Contains(hses, Homeserver) {
61+
return
62+
}
63+
if Homeserver == "" {
64+
t.Logf(
65+
"WARNING: %s called runtime.SkipUnless(%v) but Complement doesn't know which HS is running as it was run without a *_blacklist tag: not executing test.",
66+
t.Name(), hses,
67+
)
68+
}
69+
t.Skipf("test only runs on specific homeservers: %v", hses)
70+
}

runtime/hs_venator.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//go:build venator_blacklist
2+
3+
package runtime
4+
5+
func init() {
6+
Homeserver = Venator
7+
}

tests/csapi/account_change_password_pushers_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
//go:build !dendrite_blacklist
2-
// +build !dendrite_blacklist
1+
//go:build !dendrite_blacklist && !venator_blacklist
2+
// +build !dendrite_blacklist,!venator_blacklist
3+
4+
// Venator: https://github.com/matrix-org/complement/issues/897
35

46
package csapi_tests
57

tests/csapi/account_change_password_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ import (
99
"github.com/matrix-org/complement/helpers"
1010
"github.com/matrix-org/complement/match"
1111
"github.com/matrix-org/complement/must"
12+
"github.com/matrix-org/complement/runtime"
1213

1314
"github.com/tidwall/gjson"
1415
)
1516

1617
func TestChangePassword(t *testing.T) {
18+
// Venator: https://github.com/matrix-org/complement/issues/897
19+
// Omitting the entire file via build tag breaks other test files due to the definition of createSession
20+
runtime.SkipIf(t, runtime.Venator)
21+
1722
deployment := complement.Deploy(t, 1)
1823
defer deployment.Destroy(t)
1924
password1 := "superuser"

tests/csapi/account_deactivate_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"net/http"
55
"testing"
66

7+
"github.com/matrix-org/complement/runtime"
78
"github.com/tidwall/gjson"
89

910
"github.com/matrix-org/complement"
@@ -73,6 +74,8 @@ func TestDeactivateAccount(t *testing.T) {
7374

7475
// sytest: Can't deactivate account with wrong password
7576
t.Run("Can't deactivate account with wrong password", func(t *testing.T) {
77+
// Venator: https://github.com/matrix-org/complement/issues/898
78+
runtime.SkipIf(t, runtime.Venator)
7679
res := deactivateAccount(t, authedClient, "wrong_password")
7780
must.MatchResponse(t, res, match.HTTPResponse{
7881
StatusCode: 401,
@@ -83,6 +86,8 @@ func TestDeactivateAccount(t *testing.T) {
8386
})
8487
// sytest: Can deactivate account
8588
t.Run("Can deactivate account", func(t *testing.T) {
89+
// Venator: https://github.com/matrix-org/complement/issues/898
90+
runtime.SkipIf(t, runtime.Venator)
8691

8792
res := deactivateAccount(t, authedClient, password)
8893
must.MatchResponse(t, res, match.HTTPResponse{
@@ -91,6 +96,8 @@ func TestDeactivateAccount(t *testing.T) {
9196
})
9297
// sytest: After deactivating account, can't log in with password
9398
t.Run("After deactivating account, can't log in with password", func(t *testing.T) {
99+
// Venator: https://github.com/matrix-org/complement/issues/898
100+
runtime.SkipIf(t, runtime.Venator)
94101

95102
reqBody := client.WithJSONBody(t, map[string]interface{}{
96103
"identifier": map[string]interface{}{

tests/csapi/apidoc_content_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
func TestContent(t *testing.T) {
1515
// Synapse no longer allows downloads over the unauthenticated media endpoints by default
1616
runtime.SkipIf(t, runtime.Synapse)
17+
// Venator is too young for any media to be available over the unauthenticated API, and always returns M_NOT_FOUND
18+
runtime.SkipIf(t, runtime.Venator)
1719

1820
deployment := complement.Deploy(t, 1)
1921
defer deployment.Destroy(t)

tests/csapi/apidoc_device_management_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package csapi_tests
33
import (
44
"testing"
55

6+
"github.com/matrix-org/complement/runtime"
67
"github.com/tidwall/gjson"
78

89
"github.com/matrix-org/complement"
@@ -126,6 +127,8 @@ func TestDeviceManagement(t *testing.T) {
126127

127128
// sytest: DELETE /device/{deviceId}
128129
t.Run("DELETE /device/{deviceId}", func(t *testing.T) {
130+
// Venator: https://github.com/matrix-org/complement/issues/899
131+
runtime.SkipIf(t, runtime.Venator)
129132
newDeviceID, session2 := createSession(t, deployment, authedClient.UserID, "superuser")
130133
session2.MustSync(t, client.SyncReq{})
131134

@@ -196,6 +199,8 @@ func TestDeviceManagement(t *testing.T) {
196199
})
197200
// sytest: DELETE /device/{deviceId} requires UI auth user to match device owner
198201
t.Run("DELETE /device/{deviceId} requires UI auth user to match device owner", func(t *testing.T) {
202+
// Venator: https://github.com/matrix-org/complement/issues/899
203+
runtime.SkipIf(t, runtime.Venator)
199204
bob := deployment.Register(t, "hs1", helpers.RegistrationOpts{
200205
LocalpartSuffix: "bob",
201206
Password: "bobspassword",

tests/csapi/apidoc_presence_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
//go:build !dendrite_blacklist
2-
// +build !dendrite_blacklist
1+
//go:build !dendrite_blacklist && !venator_blacklist
2+
// +build !dendrite_blacklist,!venator_blacklist
33

44
// Rationale for being included in Dendrite's blacklist: https://github.com/matrix-org/complement/pull/104#discussion_r617646624
5+
// Venator: Does not implement presence
56

67
package csapi_tests
78

tests/csapi/apidoc_register_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"net/url"
1212
"testing"
1313

14+
"github.com/matrix-org/complement/runtime"
1415
"github.com/tidwall/gjson"
1516

1617
"github.com/matrix-org/complement"
@@ -62,6 +63,8 @@ func TestRegistration(t *testing.T) {
6263
})
6364
// sytest: POST /register can create a user
6465
t.Run("POST /register can create a user", func(t *testing.T) {
66+
// Venator: https://github.com/matrix-org/complement/issues/893
67+
runtime.SkipIf(t, runtime.Venator)
6568
t.Parallel()
6669
res := unauthedClient.Do(t, "POST", []string{"_matrix", "client", "v3", "register"}, client.WithRawBody(json.RawMessage(`{
6770
"auth": {
@@ -79,6 +82,8 @@ func TestRegistration(t *testing.T) {
7982
})
8083
// sytest: POST /register downcases capitals in usernames
8184
t.Run("POST /register downcases capitals in usernames", func(t *testing.T) {
85+
// Venator: https://github.com/matrix-org/complement/issues/893
86+
runtime.SkipIf(t, runtime.Venator)
8287
t.Parallel()
8388
res := unauthedClient.Do(t, "POST", []string{"_matrix", "client", "v3", "register"}, client.WithRawBody(json.RawMessage(`{
8489
"auth": {
@@ -96,6 +101,8 @@ func TestRegistration(t *testing.T) {
96101
})
97102
// sytest: POST /register returns the same device_id as that in the request
98103
t.Run("POST /register returns the same device_id as that in the request", func(t *testing.T) {
104+
// Venator: https://github.com/matrix-org/complement/issues/893
105+
runtime.SkipIf(t, runtime.Venator)
99106
t.Parallel()
100107
deviceID := "my_device_id"
101108
res := unauthedClient.Do(t, "POST", []string{"_matrix", "client", "v3", "register"}, client.WithRawBody(json.RawMessage(`{
@@ -115,6 +122,8 @@ func TestRegistration(t *testing.T) {
115122
})
116123
// sytest: POST /register rejects registration of usernames with '$q'
117124
t.Run("POST /register rejects usernames with special characters", func(t *testing.T) {
125+
// Venator: https://github.com/matrix-org/complement/issues/893
126+
runtime.SkipIf(t, runtime.Venator)
118127
t.Parallel()
119128
specialChars := []string{
120129
`!`,
@@ -151,6 +160,8 @@ func TestRegistration(t *testing.T) {
151160
}
152161
})
153162
t.Run("POST /register rejects if user already exists", func(t *testing.T) {
163+
// Venator: https://github.com/matrix-org/complement/issues/893
164+
runtime.SkipIf(t, runtime.Venator)
154165
t.Parallel()
155166
res := unauthedClient.Do(t, "POST", []string{"_matrix", "client", "v3", "register"}, client.WithRawBody(json.RawMessage(`{
156167
"auth": {
@@ -178,6 +189,8 @@ func TestRegistration(t *testing.T) {
178189
})
179190
// sytest: POST /register allows registration of usernames with '$chr'
180191
t.Run("POST /register allows registration of usernames with ", func(t *testing.T) {
192+
// Venator: https://github.com/matrix-org/complement/issues/893
193+
runtime.SkipIf(t, runtime.Venator)
181194
testChars := []rune("q3._=-/")
182195
for x := range testChars {
183196
localpart := fmt.Sprintf("chrtestuser%s", string(testChars[x]))

tests/csapi/apidoc_room_alias_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"testing"
66
"time"
77

8+
"github.com/matrix-org/complement/runtime"
89
"github.com/tidwall/gjson"
910

1011
"github.com/matrix-org/complement"
@@ -276,6 +277,8 @@ func TestRoomDeleteAlias(t *testing.T) {
276277

277278
// sytest: Can delete canonical alias
278279
t.Run("Can delete canonical alias", func(t *testing.T) {
280+
// Venator: https://github.com/matrix-org/complement/issues/900
281+
runtime.SkipIf(t, runtime.Venator)
279282
t.Parallel()
280283

281284
roomID := alice.MustCreateRoom(t, map[string]interface{}{})
@@ -383,6 +386,8 @@ func TestRoomDeleteAlias(t *testing.T) {
383386

384387
// sytest: Users can't delete other's aliases
385388
t.Run("Users can't delete other's aliases", func(t *testing.T) {
389+
// Venator: https://github.com/matrix-org/complement/issues/900
390+
runtime.SkipIf(t, runtime.Venator)
386391
t.Parallel()
387392

388393
roomID := alice.MustCreateRoom(t, map[string]interface{}{})
@@ -416,6 +421,9 @@ func TestRoomDeleteAlias(t *testing.T) {
416421

417422
// sytest: Users with sufficient power-level can delete other's aliases
418423
t.Run("Users with sufficient power-level can delete other's aliases", func(t *testing.T) {
424+
// Venator: https://github.com/matrix-org/complement/issues/900
425+
// This technically passes, but not because of the behaviour this test is testing for.
426+
runtime.SkipIf(t, runtime.Venator)
419427
t.Parallel()
420428

421429
roomID := alice.MustCreateRoom(t, map[string]interface{}{})

0 commit comments

Comments
 (0)