From 704e2b2088ebe9dcfa9c295955ebfbd97450b3c9 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Thu, 3 Oct 2024 22:43:09 +0100 Subject: [PATCH] Add more tests --- .github/workflows/build.yml | 42 ++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0bb591d..7b8cc36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,11 +18,17 @@ jobs: compat-test: runs-on: ubuntu-latest + strategy: + matrix: + encryption-method: [ plain, chacha20-poly1305 ] + num-conn: [ 0, 1, 4 ] steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: go-version: '^1.22' + - name: Build Cloak + run: make - name: Create configs run: | mkdir config @@ -30,12 +36,12 @@ jobs: { "Transport": "direct", "ProxyMethod": "iperf", - "EncryptionMethod": "chacha20-poly1305", + "EncryptionMethod": "${{ matrix.encryption-method }}", "UID": "Q4GAXHVgnDLXsdTpw6bmoQ==", "PublicKey": "4dae/bF43FKGq+QbCc5P/E/MPM5qQeGIArjmJEHiZxc=", "ServerName": "cloudflare.com", "BrowserSig": "firefox", - "NumConn": 4 + "NumConn": ${{ matrix.num-conn }} } EOF cat << EOF > config/ckserver.json @@ -56,9 +62,29 @@ jobs: "PrivateKey": "AAaskZJRPIAbiuaRLHsvZPvE6gzOeSjg+ZRg1ENau0Y=" } EOF - - run: | - docker run -d --network host ajoergensen/iperf3:latest --server - docker run --network host -v $PWD/config:/go/Cloak/config cbeuw/cloak:latest build/ck-server -c config/ckserver.json --verbosity debug & - make client - build/ck-client -c config/ckclient.json -s 127.0.0.1 -p 8443 --verbosity debug & - docker run --network host ajoergensen/iperf3:latest --client 127.0.0.1 -p 1984 \ No newline at end of file + - name: Start iperf3 server + run: docker run -d --name iperf-server --network host ajoergensen/iperf3:latest --server + - name: Test new client against old server + run: | + docker run -d --name old-cloak-server --network host -v $PWD/config:/go/Cloak/config cbeuw/cloak:latest build/ck-server -c config/ckserver.json --verbosity debug + build/ck-client -c config/ckclient.json -s 127.0.0.1 -p 8443 --verbosity debug | tee new-cloak-client.log & + docker run --network host ajoergensen/iperf3:latest --client 127.0.0.1 -p 1984 + docker stop old-cloak-server + - name: Test old client against new server + run: | + build/ck-server -c config/ckserver.json --verbosity debug | tee new-cloak-server.log & + docker run -d --name old-cloak-client --network host -v $PWD/config:/go/Cloak/config cbeuw/cloak:latest build/ck-client -c config/ckclient.json -s 127.0.0.1 -p 8443 --verbosity debug + docker run --network host ajoergensen/iperf3:latest --client 127.0.0.1 -p 1984 + docker stop old-cloak-client + - name: Dump docker logs + if: always() + run: | + docker container logs iperf-server > iperf-server.log + docker container logs old-cloak-server > old-cloak-server.log + docker container logs old-cloak-client > old-cloak-client.log + - name: Upload logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.encryption-method }}-${{ matrix.num-conn }}-conn-logs + path: ./*.log \ No newline at end of file