Skip to content

Update dockerfile and install_repositories.sh for open source #7

Update dockerfile and install_repositories.sh for open source

Update dockerfile and install_repositories.sh for open source #7

Workflow file for this run

name: End-to-End Test
on:
pull_request:
types:
- opened
- synchronize
branches:
'main'
jobs:
build-and-test:
if: |
github.repository == 'SmartDCSITlimited/test-harness'
&& github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
env:
SSH_AUTH_SOCK: $SSH_AUTH_SOCK
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to GitLab Docker registry
uses: docker/login-action@v3
with:
registry: registry.gitlab.com
username: ${{ secrets.GITLAB_USERNAME }}
password: ${{ secrets.GITLAB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: Build and run containers
# uses: adambirds/docker-compose-action@v1.3.0
# with:
# compose-file: ./docker-compose-end-to-end-test.yml
# - name: sort out SSH keys
# uses: shimataro/ssh-key-action@v2
# with:
# key: ${{ secrets.TEST_EVENT_GENERATOR_DEPLOY_KEY }}
# # This is unnecessary because github is always added to known_hosts automatically
# known_hosts: unnecessary
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
ssh-agent -a ${SSH_AUTH_SOCK} > /dev/null
ssh-add - <<< "${{ secrets.TEST_EVENT_GENERATOR_DEPLOY_KEY }}"
echo "${{ secrets.TEST_EVENT_GENERATOR_DEPLOY_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Do test
run: |
mkdir -p config
cp ./test_harness/config/default_config.config ./config/config.config
sed -i 's/host\.docker\.internal/httpserver/g' ./config/config.config
mkdir -p aerconfig
cp ./end_to_end_test_configs/aer_config.json ./aerconfig/config.json
cp ./end_to_end_test_configs/log-config-reception.xml ./aerconfig/
mkdir -p aeo_svdc_config
cp ./end_to_end_test_configs/aeosvdc_config.json ./aeo_svdc_config/config.json
cp ./end_to_end_test_configs/log-config-verifier.xml ./aeo_svdc_config/
docker compose -f ./docker-compose-end-to-end-test.yml up -d
# this should return false as no tests are running
sleep 10
echo "Testing that no tests are running"
curl 127.0.0.1:8800/isTestRunning | grep 'false'
# actual tests are set to run
timeout 1m ./end-to-end-curl-commands.sh
# this should return true as tests are running
echo "Testing that tests are running"
curl 127.0.0.1:8800/isTestRunning | grep 'true'
# It takes this long to get any meaningful output from the test harness
# It's 60 seconds for the test harness to start the job ...
# ... and 10 seconds to run the job ...
# ... and 60 seconds to ensure the test is finished ...
# ... and another 50 seconds for grace time in starting up/waiting for logs/waiting for calculations
echo "Sleeping to give the test harness time to work"
date
sleep 20
echo "Testing that a percentage is returned"
curl 127.0.0.1:8800/isTestRunning | grep percent_done
sleep 160
date
sleep 10
docker compose -f ./docker-compose-end-to-end-test.yml logs test-harness | grep -Po "Test Harness test run completed successfully"
docker compose -f ./docker-compose-end-to-end-test.yml down
# - name: Save the whole repo to know exactly what happened in there
# uses: actions/upload-artifact@v3
# with:
# name: whole-repo
# path: |
# **/*
# !/home/runner/work/test-harness/test-harness/$SSH_AUTH_SOCK