Extract e2e test environment variables into file.

This commit is contained in:
Maximilian Paß
2024-01-24 14:13:41 +01:00
committed by Sebastian Serth
parent fa04ed8ad4
commit f16efa65b7
3 changed files with 14 additions and 14 deletions

View File

@ -125,16 +125,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ compile, test ] needs: [ compile, test ]
env: env:
POSEIDON_AWS_ENABLED: false
POSEIDON_AWS_ENDPOINT: ${{ secrets.POSEIDON_AWS_ENDPOINT }} POSEIDON_AWS_ENDPOINT: ${{ secrets.POSEIDON_AWS_ENDPOINT }}
POSEIDON_AWS_FUNCTIONS: ""
POSEIDON_LOGGER_FORMATTER: "JSONFormatter"
POSEIDON_LOG_FILE: "../../poseidon.log"
POSEIDON_NOMAD_DISABLEFORCEPULL: true
GOCOVERDIR: coverage
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Write secrets to environment file
run: cat ./.github/workflows/resources/.env | envsubst > ./.env
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
@ -203,6 +199,7 @@ jobs:
run: make e2e-test-docker-image run: make e2e-test-docker-image
- name: Run e2e tests - name: Run e2e tests
run: | run: |
export $(cat ./.env | xargs)
sudo ./nomad agent -dev -log-level=WARN -config e2e-config.hcl & sudo ./nomad agent -dev -log-level=WARN -config e2e-config.hcl &
until curl -s --fail http://localhost:4646/v1/agent/health ; do sleep 1; done until curl -s --fail http://localhost:4646/v1/agent/health ; do sleep 1; done
chmod +x ./poseidon chmod +x ./poseidon
@ -210,16 +207,15 @@ jobs:
./poseidon | tee poseidon.log & ./poseidon | tee poseidon.log &
until curl -s --fail http://localhost:7200/api/v1/health ; do sleep 1; done until curl -s --fail http://localhost:7200/api/v1/health ; do sleep 1; done
make e2e-test make e2e-test
- name: Write Environment Variables to file
run: |
echo "${{ vars }}"
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
- name: Setup Poseidon Socket - name: Setup Poseidon Socket
run: | run: |
export $(cat ./.env | xargs)
killall poseidon killall poseidon
mkdir -p ~/.config/systemd/user mkdir -p ~/.config/systemd/user
cp ./.github/workflows/resources/poseidon-minimal.socket ~/.config/systemd/user/poseidon.socket cp ./.github/workflows/resources/poseidon-minimal.socket ~/.config/systemd/user/poseidon.socket
cat ./.github/workflows/resources/poseidon-minimal.service | envsubst > ~/.config/systemd/user/poseidon.service cat ./.github/workflows/resources/poseidon-minimal.service | envsubst > ~/.config/systemd/user/poseidon.service
echo "POSEIDON_SERVER_SYSTEMDSOCKETACTIVATION=TRUE" >> ./.env
systemctl --user daemon-reload systemctl --user daemon-reload
systemctl --user start poseidon.socket systemctl --user start poseidon.socket
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
@ -235,9 +231,7 @@ jobs:
journalctl --user -xe -u poseidon.service --no-pager journalctl --user -xe -u poseidon.service --no-pager
if: failure() if: failure()
- name: Stop Poseidon to flush the coverage file - name: Stop Poseidon to flush the coverage file
run: | run: systemctl --user stop poseidon.service poseidon.socket
systemctl --user stop poseidon.service poseidon.socket
ls -lah ${GOCOVERDIR}
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
- name: Convert coverage reports - name: Convert coverage reports
run: make convert-run-coverage run: make convert-run-coverage

7
.github/workflows/resources/.env vendored Normal file
View File

@ -0,0 +1,7 @@
POSEIDON_AWS_ENABLED="false"
POSEIDON_AWS_ENDPOINT="${POSEIDON_AWS_ENDPOINT}"
POSEIDON_AWS_FUNCTIONS=""
POSEIDON_LOGGER_FORMATTER="JSONFormatter"
POSEIDON_LOG_FILE="${GITHUB_WORKSPACE}/poseidon.log"
POSEIDON_NOMAD_DISABLEFORCEPULL="true"
GOCOVERDIR="${GITHUB_WORKSPACE}/coverage"

View File

@ -8,8 +8,7 @@ Requires=poseidon.socket
[Service] [Service]
WorkingDirectory=${GITHUB_WORKSPACE} WorkingDirectory=${GITHUB_WORKSPACE}
ExecStart=${GITHUB_WORKSPACE}/poseidon ExecStart=${GITHUB_WORKSPACE}/poseidon
Environment="POSEIDON_SERVER_SYSTEMDSOCKETACTIVATION=TRUE" EnvironmentFile=${GITHUB_WORKSPACE}/.env
Environment="GOCOVERDIR=${GITHUB_WORKSPACE}/${GOCOVERDIR}"
Restart=always Restart=always
StartLimitBurst=0 StartLimitBurst=0