From 2d91cc674e3cef9ce4517f4b6041537d994041e5 Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Mon, 25 Dec 2023 14:03:49 +0200 Subject: [PATCH] Re-enable SFTP integration tests Removed dependency on external server. Test also expected the order which was removed from the promise earlier. --- .github/workflows/commit.yml | 70 ++++++++++++++++++++---------------- replica_client_test.go | 10 ++++-- 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 04a55ffe..0a86449a 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -183,34 +183,42 @@ jobs: LITESTREAM_ABS_ACCOUNT_KEY: ${{ secrets.LITESTREAM_ABS_ACCOUNT_KEY }} LITESTREAM_ABS_BUCKET: integration -## this doesn't yet work -# sftp-integration-test: -# name: Run SFTP Integration Tests -# runs-on: ubuntu-latest -# needs: build -# if: github.ref == 'refs/heads/main' -# concurrency: -# group: integration-test-sftp -# steps: -# - name: Extract SSH key -# run: 'echo "$LITESTREAM_SFTP_KEY" > /opt/id_ed25519' -# shell: bash -# env: -# LITESTREAM_SFTP_KEY: ${{secrets.LITESTREAM_SFTP_KEY}} - -# - uses: actions/checkout@v4 - -# - uses: actions/setup-go@v4 -# with: -# go-version: ${{ env.GO_VERSION }} - -# - run: go env - -# - run: go install ./cmd/litestream - -# - run: go test -v ./replica_client_test.go -integration sftp -# env: -# LITESTREAM_SFTP_HOST: ${{ secrets.LITESTREAM_SFTP_HOST }} -# LITESTREAM_SFTP_USER: ${{ secrets.LITESTREAM_SFTP_USER }} -# LITESTREAM_SFTP_KEY_PATH: /opt/id_ed25519 -# LITESTREAM_SFTP_PATH: ${{ secrets.LITESTREAM_SFTP_PATH }} + sftp-integration-test: + name: Run SFTP Integration Tests + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + + - run: |- + sudo mkdir -p /opt/ssh/etc/ssh /opt/ssh/home /run/sshd /opt/ssh/test/ + sudo ssh-keygen -t ed25519 -f /opt/ssh/etc/ssh/id_ed25519_host -N "" + sudo ssh-keygen -t ed25519 -f /opt/ssh/etc/ssh/id_ed25519 -N "" + sudo chmod 0600 /opt/ssh/etc/ssh/id_ed25519_host /opt/ssh/etc/ssh/id_ed25519 + sudo chmod 0644 /opt/ssh/etc/ssh/id_ed25519 + sudo chmod 0644 /opt/ssh/etc/ssh/id_ed25519_host.pub /opt/ssh/etc/ssh/id_ed25519.pub + sudo cat > /opt/ssh/etc/ssh/sshd_config <