Skip to content

Commit

Permalink
Try to get mitmproxy logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Jan 15, 2024
1 parent 5e677cb commit 23b29cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
run: |
sudo apt-get update && sudo apt-get install -y libolm3 libolm-dev
go install -v github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
cat /etc/hosts
ping -c 1 host.docker.internal
# Install whatever version of the JS SDK is in package.json
- name: Build JS SDK
Expand Down Expand Up @@ -113,6 +115,9 @@ jobs:
COMPLEMENT_SHARE_ENV_PREFIX: PASS_
PASS_SYNAPSE_COMPLEMENT_DATABASE: sqlite
DOCKER_BUILDKIT: 1
- run: |
docker ps | grep mitm | grep -Eo '[^ ]*$' | xargs docker logs
- name: Upload logs
uses: actions/upload-artifact@v2
Expand Down
9 changes: 3 additions & 6 deletions tests/client_connectivity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net/http"
"os"
"os/exec"
"strconv"
"sync"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -120,15 +119,13 @@ func TestSigkillBeforeKeysUploadResponse(t *testing.T) {
BaseURL: tc.Deployment.ReverseProxyURLForHS(clientType.HS),
SSURL: tc.Deployment.SlidingSyncURL(t),
})
cmd.WaitDelay = 10 * time.Second
cmd.WaitDelay = 3 * time.Second
defer close()
waiter := helpers.NewWaiter()
terminateClient = func() {
terminated.Store(true)
t.Logf("got keys/upload: terminating process %v", cmd.Process.Pid)
kill := exec.Command("kill", "-USR2", strconv.Itoa(cmd.Process.Pid))
t.Logf(kill.String())
if err := kill.Run(); err != nil {
if err := cmd.Process.Kill(); err != nil {
t.Errorf("failed to kill process: %s", err)
return
}
Expand All @@ -138,7 +135,7 @@ func TestSigkillBeforeKeysUploadResponse(t *testing.T) {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Start()
waiter.Waitf(t, 20*time.Second, "failed to terminate process")
waiter.Waitf(t, 5*time.Second, "failed to terminate process")
t.Logf("terminated process, making new client")
// now make the same client
cfg.BaseURL = tc.Deployment.ReverseProxyURLForHS(clientType.HS)
Expand Down
13 changes: 0 additions & 13 deletions tests/templates/sigkill_before_keys_upload_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"

"github.com/matrix-org/complement-crypto/internal/api"
Expand All @@ -26,18 +24,7 @@ func (t *MockT) Fatalf(f string, args ...any) {
}
func (t *MockT) Name() string { return "inline_script" }

func ProcessSignal() {
sigch := make(chan os.Signal, 2)
signal.Notify(sigch, syscall.SIGUSR2)
for {
signalType := <-sigch
fmt.Println("Received signal SIGUSR2 from channel : ", signalType)
panic("terminating...")
}
}

func main() {
go ProcessSignal()
time.Sleep(time.Second)
t := &MockT{}
cfg := api.ClientCreationOpts{
Expand Down

0 comments on commit 23b29cf

Please sign in to comment.