diff --git a/.dockerignore b/.dockerignore index 94b5ab1dcf1d2ee2ee7e8073fe8fd6270a0835f0..5e6c3505694118ea3a8aae4f85d71d973f2f712a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,4 +6,5 @@ dump.rdb .git .cache .gitignore -.gitlab-ci.yml \ No newline at end of file +.gitlab-ci.yml +test/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c88a90b94d8e42200e1ef35ae9746eb040413753..1708e84336c7f185653198f13305bfed38bb0636 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ stages: build: stage: build script: - - docker build --no-cache -t $REGISTRY/medina/$SERVICE:$VERSION . + - docker build --no-cache -t $REGISTRY/medina/$SERVICE:$VERSION . only: - develop - master @@ -23,7 +23,12 @@ build: test: stage: test script: - - echo "not yet implemented" + - apk add bash + - docker stop $SERVICE || true && docker rm $SERVICE || true + - docker run --name $SERVICE -d $REGISTRY/medina/$SERVICE:$VERSION + - sleep 5 + - bash test/test.sh + - docker stop $SERVICE && docker container rm $SERVICE only: - develop - master diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..455e2a7c4e7f2aed15fd5b118cd7991cc2d5e72f --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,4 @@ +Copyright (C) 2021 XLAB d.o.o. +Use of this software allowed only to MEDINA partners for the purpose of research in the scope of MEDINA project, as specified in the MEDINA Consortium Agreement. +No commercial use allowed. +This program is distributed without any warranty. \ No newline at end of file diff --git a/scheduler/scheduler.py b/scheduler/scheduler.py index 8662516e3092195e297423924e40d7af967e0c5b..696dbb81fef16cb640860d86f46177ccda0b6f60 100644 --- a/scheduler/scheduler.py +++ b/scheduler/scheduler.py @@ -31,7 +31,7 @@ scheduler.cron( '* * * * * ', func=wazuh_evidence_collector.run_full_check, args=[], - repeat=10, + repeat=None, queue_name=constants['redis']['queue'], use_local_timezone=False ) diff --git a/test/test.sh b/test/test.sh new file mode 100755 index 0000000000000000000000000000000000000000..7eb399f92d83e22e5394b90114e1dc1cee50ba0a --- /dev/null +++ b/test/test.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +logs=$(docker logs $SERVICE 2>&1) +redis1="# oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo" +redis2="Ready to accept connections" +scheduler="Registering birth" +worker1="Worker rq:worker:" +worker2="Subscribing to channel rq:pubsub:" +worker3="Listening on " + +if ! [[ $logs =~ $redis1 ]] + then + echo "Redis server not started" 1>&2 + exit 1 +fi + +if ! [[ $logs =~ $redis2 ]] + then + echo "Redis server not started" 1>&2 + exit 1 +fi + +if ! [[ $logs =~ $scheduler ]] + then + echo "Redis queue scheduler not started" 1>&2 + exit 1 +fi + +if ! [[ $logs =~ $worker1 ]] + then + echo "Redis worker not started" 1>&2 + exit 1 +fi + +if ! [[ $logs =~ $worker2 ]] + then + echo "Redis worker not started" 1>&2 + exit 1 +fi + +if ! [[ $logs =~ $worker3 ]] + then + echo "Redis worker not started" 1>&2 + exit 1 +fi