Skip to content

Commit

Permalink
time.Sleep because there is nothing better
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Nov 17, 2023
1 parent e688468 commit 3364a9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions internal/api/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ func (c *JSClient) StartSyncing(t *testing.T) (stopSyncing func()) {
case <-ch:
}
cancel()
// we need to wait for rust crypto's outgoing request loop to finish.
// There's no callbacks for that yet, so sleep and pray.
// See https://github.com/matrix-org/matrix-js-sdk/blob/v29.1.0/src/rust-crypto/rust-crypto.ts#L1483
time.Sleep(500 * time.Millisecond)
t.Logf("%s is now syncing", c.userID)
return func() {
chrome.AwaitExecute(t, c.ctx, `window.__client.stopClient();`)
Expand Down
13 changes: 8 additions & 5 deletions internal/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func RunNewDeployment(t *testing.T, shouldTCPDump bool) *SlidingSyncDeployment {
defer cancel()

// Deploy the homeserver using Complement
deployment := complement.Deploy(t, 1)
deployment := complement.Deploy(t, 2)
networkName := deployment.Network()

// Make a postgres container
Expand Down Expand Up @@ -114,20 +114,23 @@ func RunNewDeployment(t *testing.T, shouldTCPDump bool) *SlidingSyncDeployment {
must.NotError(t, "failed to start sliding sync container", err)

ssURL := externalURL(t, ssContainer, ssExposedPort)
csapi := deployment.UnauthenticatedClient(t, "hs1")
csapi1 := deployment.UnauthenticatedClient(t, "hs1")
csapi2 := deployment.UnauthenticatedClient(t, "hs2")

// log for debugging purposes
t.Logf("SlidingSyncDeployment created (network=%s):", networkName)
t.Logf(" NAME INT EXT")
t.Logf(" sliding sync: ssproxy %s", ssURL)
t.Logf(" synapse: hs1 %s", csapi.BaseURL)
t.Logf(" synapse: hs1 %s", csapi1.BaseURL)
t.Logf(" synapse: hs2 %s", csapi2.BaseURL)
t.Logf(" postgres: postgres")
var cmd *exec.Cmd
if shouldTCPDump {
t.Log("Running tcpdump...")
su, _ := url.Parse(ssURL)
cu, _ := url.Parse(csapi.BaseURL)
filter := fmt.Sprintf("tcp port %s or port %s", su.Port(), cu.Port())
cu1, _ := url.Parse(csapi1.BaseURL)
cu2, _ := url.Parse(csapi2.BaseURL)
filter := fmt.Sprintf("tcp port %s or port %s or port %s", su.Port(), cu1.Port(), cu2.Port())
cmd = exec.Command("tcpdump", "-i", "any", "-s", "0", filter, "-w", "test.pcap")
t.Log(cmd.String())
if err := cmd.Start(); err != nil {
Expand Down

0 comments on commit 3364a9c

Please sign in to comment.