From dfa89450e2cb38a53970990424cbf90ee3f394f1 Mon Sep 17 00:00:00 2001 From: rfaircloth-splunk Date: Wed, 5 Feb 2020 18:55:30 -0500 Subject: [PATCH] info --- .circleci/config.yml | 41 ++++++++++++++++++++++++++++++++-------- tests/docker-compose.yml | 16 ++++++++++++++++ tests/entrypoint.sh | 26 +++++-------------------- 3 files changed, 54 insertions(+), 29 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 12c4c89..a39f491 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,7 @@ build-splunk: &build-splunk docker.pkg.github.com/splunk/splunk-connect-for-syslog/stg-splunk-connect-for-syslog:splunk-${SPLUNK}-<< pipeline.id >> + test: &test steps: - checkout @@ -69,15 +70,9 @@ test: &test - run: name: test command: | - pytest \ - -v \ - --splunk_type=docker --splunk_password=${SPLUNK_PASSWORD} - --junitxml=test-results/apptest-${SYSLOG}-${SPLUNK}.xml + docker-compose -f tests/docker-compose.yml up --abort-on-container-exit + docker cp results/* test-results/ no_output_timeout: 1h - - run: - name: get logs - command: docker-compose -f test/docker-compose.yml logs - when: always - store_artifacts: path: test-results destination: apptest-${SYSLOG}-${SPLUNK} @@ -93,6 +88,31 @@ orbs: jobs: + build-tests: + docker: + - image: circleci/buildpack-deps:18.04 + environment: + SYSLOG: '3.25.1' + steps: + - checkout + - setup_remote_docker: + docker_layer_caching: true + - run: + name: Docker Login + command: | + docker login -u $DOCKER_USER -p $DOCKER_PASS + docker login -u $GITHUB_USER -p $GITHUB_TOKEN docker.pkg.github.com + - run: + name: Build Splunk + command: | + docker build tests \ + -t docker.pkg.github.com/splunk/splunk-connect-for-syslog/stg-splunk-connect-for-syslog:tests-<< pipeline.id >> + - run: + name: Push Splunk + command: | + docker push \ + docker.pkg.github.com/splunk/splunk-connect-for-syslog/stg-splunk-connect-for-syslog:tests-<< pipeline.id >> + #JOB SC4S build-sc4s-3-25-1: docker: @@ -159,6 +179,7 @@ workflows: version: 2 build_and_deploy: jobs: + - build-tests - build-sc4s-3-25-1 - build-sc4s-master - build-splunk-7-2 @@ -168,15 +189,19 @@ workflows: requires: - build-sc4s-3-25-1 - build-splunk-8-0 + - build-tests - test-sc4s-master-splunk-8-0: requires: - build-sc4s-master - build-splunk-8-0 + - build-tests - test-sc4s-3-25-1-splunk-7-3: requires: - build-sc4s-3-25-1 - build-splunk-7-3 + - build-tests - test-sc4s-3-25-1-splunk-7-2: requires: - build-sc4s-3-25-1 - build-splunk-7-2 + - build-tests diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index ca06853..865678f 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -10,6 +10,19 @@ version: "3.7" services: + test: + build: ./tests + image: docker.pkg.github.com/splunk/splunk-connect-for-syslog/stg-splunk-connect-for-syslog:tests-${CIRCLE_SHA1} + links: + - splunk + - sc4s + environment: + - SPLUNK_USER=admin + - SPLUNK_PASSWORD=${SPLUNK_PASSWORD} + - SPLUNK_HOST=splunk + - SYSLOG_HOST=sc4s + volumes: + - results:/work/test-results sc4s: build: @@ -58,3 +71,6 @@ services: - SPLUNK_PASSWORD=${SPLUNK_PASSWORD} - SPLUNK_START_ARGS=--accept-license +volumes: + results: + external: false \ No newline at end of file diff --git a/tests/entrypoint.sh b/tests/entrypoint.sh index 6128096..723342b 100755 --- a/tests/entrypoint.sh +++ b/tests/entrypoint.sh @@ -1,23 +1,7 @@ #!/bin/sh -echo Check for sc4s -wait-for sc4s:514 -t 0 -- echo scs is up -echo check for splunk web -wait-for splunk:8000 -t 0 -- echo splunkweb is up -echo check for splunk mgmt -wait-for splunk:8089 -t 0 -- echo splunkmgmt is up -echo check for splunk hec -wait-for splunk:8088 -t 0 -- echo splunkhec is up -sleep 30 - -echo Check for sc4s -wait-for sc4s:514 -t 0 -- echo scs is up -echo check for splunk web -wait-for splunk:8000 -t 0 -- echo splunkweb is up -echo check for splunk mgmt -wait-for splunk:8089 -t 0 -- echo splunkmgmt is up -echo check for splunk hec -wait-for splunk:8088 -t 0 -- echo splunkhec is up - - -cd /work;python -m pytest --junitxml=/work/test-results/functional/functional.xml $@ +cd /work +pytest -v \ + --splunk_test=external \ + --splunk_password=${SPLUNK_PASSWORD} \ + --junitxml=/work/test-results/functional/functional.xml $@