Skip to content

Fix concurrent deadlock #65

Fix concurrent deadlock

Fix concurrent deadlock #65

Workflow file for this run

name: Unit test suite run
env:
# sensu container config
SENSU_IMAGE: quay.io/infrawatch/sensu:1.9.0
TRANSPORT_NAME: rabbitmq
RABBITMQ_HOST: 127.0.0.1
RABBITMQ_PORT: 5672
RABBITMQ_USER: sensu
RABBITMQ_PASSWORD: sensu
RABBITMQ_VHOST: "/sensu"
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
REDIS_DB: 0
REDIS_AUTO_RECONNECT: true
REDIS_RECONNECT_ON_ERROR: false
# 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: quay.io/infrawatch/loki:2.4.2
# misc. config
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
on:
- push
- pull_request
- workflow_dispatch
jobs:
test-framework:
name: Unit test suite
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- 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
- name: Start qdrouterd message bus
run: |
docker run --name=qdr --volume=${{ github.workspace }}/ci/qdrouterd.conf:/etc/qpid-dispatch/qdrouterd.conf:ro -p 5666:5666 -d $QDROUTERD_IMAGE
- name: Configure RabbitMQ message bus for sensu-core usage
run: |
docker exec rabbitmq rabbitmqctl start_app
sleep 5
docker exec rabbitmq rabbitmqctl add_user $RABBITMQ_USER $RABBITMQ_PASSWORD
docker exec rabbitmq rabbitmqctl add_vhost $RABBITMQ_VHOST
docker exec rabbitmq rabbitmqctl set_permissions -p $RABBITMQ_VHOST $RABBITMQ_USER ".*" ".*" ".*"
- name: Start Sensu
run: |
cat > ./sensu-env <<EOF
TRANSPORT_NAME=$TRANSPORT_NAME
RABBITMQ_HOST=$ABBITMQ_HOST
RABBITMQ_USER=$RABBITMQ_USER
RABBITMQ_PASSWORD=$RABBITMQ_PASSWORD
RABBITMQ_VHOST=$RABBITMQ_VHOST
REDIS_HOST=$REDIS_HOST
REDIS_PORT=$REDIS_PORT
REDIS_DB=$REDIS_DB
REDIS_AUTO_RECONNECT=$REDIS_AUTO_RECONNECT
REDIS_RECONNECT_ON_ERROR=$REDIS_RECONNECT_ON_ERROR
EOF
docker run --name sensu-api --network host --env-file=./sensu-env -d $SENSU_IMAGE api
docker run --name sensu-server --network host --env-file=./sensu-env --volume=${{ github.workspace }}/ci/sensu/check.d:/etc/sensu/check.d:ro -d $SENSU_IMAGE server
- name: Start Loki
run: |
docker run --name loki --volume=${{ github.workspace }}/ci/loki-config.yaml:/etc/loki/loki-config.yaml:ro -p 3100:3100 -d $LOKI_IMAGE -config.file=/etc/loki/loki-config.yaml
- name: Wait for Loki to become ready
run: |
echo "========================== loki ========================="
while ! curl -sX GET "http://127.0.0.1:3100/ready" | grep -q "^ready$"
do
sleep 1
done
- name: List dependency containers' logs
run: |
docker ps --all
echo "---- rabbitmq ----"
docker logs rabbitmq
echo "---- qdr ----"
docker logs qdr
echo "---- sensu-core ----"
docker logs sensu-server
docker logs sensu-api
echo "---- loki ----"
docker logs loki
- name: Run unit tests
run: |
export PROJECT_ROOT=/root/go/src/github.com/infrawatch/apputils
docker run -uroot --network host --volume=${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT quay.io/centos/centos:stream8 bash ci/run_ci.sh
- name: List dependency containers' logs
run: |
echo "---- rabbitmq ----"
docker logs rabbitmq
echo "---- qdr ----"
docker logs qdr
echo "---- sensu-core ----"
docker logs sensu-server
docker logs sensu-api
echo "---- loki ----"
docker logs loki
if: ${{ failure() }}