Skip to content

Commit

Permalink
Add docs and proper cleanup function
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Nov 16, 2023
1 parent 42df410 commit df785ea
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ If you get failing tests, JS SDK logs to file as does Rust SDK in `./tests`, whi

- `COMPLEMENT_CRYPTO_TEST_CLIENT_MATRIX` : Comma separated clients to run. Default: `jj,jr,rj,rr`
Control which kinds of clients to make for tests. `r` creates Rust client. `j` creates JS clients. The default runs all permutations.
- `COMPLEMENT_CRYPTO_TCPDUMP`: If `1`, will execute `tcpdump` automatically when the servers are running on the dynamic ports being used. To run this, `go test` must be run with `sudo -E` (preserve env vars for configuration) e.g `COMPLEMENT_BASE_IMAGE=homeserver:latest sudo -E go test ./tests`. Listens for synapse and sliding sync traffic.


### Test hitlist
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ require (
github.com/chromedp/cdproto v0.0.0-20231025043423-5615e204d422
github.com/chromedp/chromedp v0.9.3
github.com/docker/go-connections v0.4.0
github.com/matrix-org/complement v0.0.0-20231030161126-e811566d9bb6
github.com/matrix-org/complement v0.0.0-20231116184323-62f59c436d00
github.com/testcontainers/testcontainers-go v0.26.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
)

require (
Expand Down Expand Up @@ -58,7 +59,6 @@ require (
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/matrix-org/complement v0.0.0-20231030161126-e811566d9bb6 h1:CooPBAdWBGghbspoZj83k12XC/6c/ofmTg52R8Zy5NU=
github.com/matrix-org/complement v0.0.0-20231030161126-e811566d9bb6/go.mod h1:UQqYuClBEPysOJJU4MKWVSna3ev8q56aV6OeYm0lk3g=
github.com/matrix-org/complement v0.0.0-20231116184323-62f59c436d00 h1:nljG6wWK2IgqNFCkGXllzsDEm7EDNEcUn3XyoUSVouI=
github.com/matrix-org/complement v0.0.0-20231116184323-62f59c436d00/go.mod h1:MpFg8YqIgcfReuwX5x0HyIsxkekKyUvbXxY6ey9LeE0=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230921171121-0466775328c7 h1:NhPNNFLHwdDb/upeicBh1GkxX/sFinEp5HF1WBqPtiY=
Expand Down
1 change: 1 addition & 0 deletions internal/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (d *SlidingSyncDeployment) Teardown() {
}
}
if d.tcpdump != nil {
fmt.Println("Killing tcpdump...")
d.tcpdump.Process.Signal(os.Interrupt)
}
}
Expand Down
8 changes: 3 additions & 5 deletions tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,15 @@ func TestMain(m *testing.M) {
testClientMatrix = append(testClientMatrix, testCase)
}
ssMutex = &sync.Mutex{}
defer func() { // always teardown even if panicking
api.SetupJSLogs("js_sdk.log") // rust sdk logs on its own
complement.TestMainWithCleanup(m, "crypto", func() { // always teardown even if panicking
ssMutex.Lock()
if ssDeployment != nil {
ssDeployment.Teardown()
}
ssMutex.Unlock()
api.WriteJSLogs()
}()
api.SetupJSLogs("js_sdk.log") // rust sdk logs on its own
complement.TestMain(m, "crypto")

})
}

func Deploy(t *testing.T) *deploy.SlidingSyncDeployment {
Expand Down

0 comments on commit df785ea

Please sign in to comment.