From d3e684be540dbe7bcbdc8847507cea313b0d1b0e Mon Sep 17 00:00:00 2001 From: Martin Magr Date: Mon, 8 Mar 2021 14:13:04 +0100 Subject: [PATCH] Spin up sensu-core server correctly --- .github/workflows/unit_tests.yml | 27 ++++++++++++++++++++++++--- ci/sensu-env.sh | 7 +++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 ci/sensu-env.sh diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 6363920..5cc6388 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -1,9 +1,23 @@ -name: Integration testing +name: Unit test suite run env: + # sensu container config SENSU_IMAGE: bitlayer/docker-sensu:1.9.0-1 + TRANSPORT_NAME: rabbitmq + RABBITMQ_HOST: 127.0.0.1 + RABBITMQ_USER: guest + RABBITMQ_PASSWORD: "" + RABBITMQ_VHOST: "/sensu" + REDIS_HOST: 127.0.0.1 + REDIS_PORT: 6379 + # redis container config + REDIS_IMAGE: redis:6.2.1 + # rabbitmq container config RABBITMQ_IMAGE: rabbitmq:3.7.24 + # qdr container config QDROUTERD_IMAGE: quay.io/interconnectedcloud/qdrouterd:1.12.0 + # loki container config LOKI_IMAGE: grafana/loki:2.1.0 + # misc. config COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} on: push @@ -15,6 +29,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + - name: Start Redis + run: | + docker run --name redis -p 6379:6379 -d $REDIS_IMAGE - name: Start RabbitMQ message bus run: | docker run --name=rabbitmq -p 5672:5672 -p 4369:4369 -d $RABBITMQ_IMAGE @@ -29,18 +46,22 @@ jobs: docker exec rabbitmq rabbitmqctl set_permissions -p "/sensu" guest ".*" ".*" ".*" - name: Start Sensu run: | - docker run --name sensu-core --volume=$PWD/ci/sensu/conf.d:/etc/sensu/conf.d:ro --network host -d $SENSU_IMAGE + docker run --name sensu-core --network host --env-file=$PWD/ci/sensu-env.sh -d $SENSU_IMAGE server - name: Start Loki run: | docker run --name loki --volume=$PWD/ci/loki-config.yaml:/etc/loki/loki-config.yaml:ro -p 3100:3100 -d $LOKI_IMAGE -config.file=/etc/loki/loki-config.yaml - name: List dependency containers run: | docker ps --all + echo "---- rabbitmq ----" docker logs rabbitmq + echo "---- qdr ----" docker logs qdr + echo "---- sensu-core ----" docker logs sensu-core + echo "---- loki ----" docker logs loki - - name: Run integration tests + - name: Run unit tests run: | export PROJECT_ROOT=/root/go/src/github.com/infrawatch/apputils docker run -uroot --network host --volume=$PWD:$PROJECT_ROOT:z --workdir $PROJECT_ROOT centos:8 bash ci/run_ci.sh diff --git a/ci/sensu-env.sh b/ci/sensu-env.sh new file mode 100644 index 0000000..324a05a --- /dev/null +++ b/ci/sensu-env.sh @@ -0,0 +1,7 @@ +TRANSPORT_NAME=rabbitmq +RABBITMQ_HOST=127.0.0.1 +RABBITMQ_USER=guest +RABBITMQ_PASSWORD=guest +RABBITMQ_VHOST=/sensu +REDIS_HOST=127.0.0.1 +REDIS_PORT=6379