Skip to content
Snippets Groups Projects
Verified Commit d40f72c5 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

process some feedback, by default run all tests with test command

parent 0f61c779
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@
# Ignore files created by ansible-playbook
*.retry
/ansible/cluster_data/
# Virtualenvs for the project
/env
......@@ -18,7 +17,6 @@
/test/inventory*
/test/behave/behave.ini
/test/behave/rerun_failing.features
/test/cluster_data/
/clusters
# Ignore files created during tests
......
......@@ -24,7 +24,7 @@ ci_test_image:
only:
changes:
- test/Dockerfile
- test/requirements.txt
- requirements.txt
bootstrap:
stage: setup-cluster
......@@ -36,8 +36,8 @@ bootstrap:
- chmod 755 ansible/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- python3 -m openappstack $CI_PIPELINE_ID create --create-droplet openappstack.net --hostname "ci-$CI_PIPELINE_ID" --ssh-key-id 411 --create-domain-records --subdomain "ci-$CI_PIPELINE_ID.ci"
- python3 -m openappstack $CI_PIPELINE_ID install --ansible-param skip-tags=helmfile
- python3 -m openappstack ci-$CI_PIPELINE_ID create --create-droplet openappstack.net --hostname "ci-$CI_PIPELINE_ID" --ssh-key-id 411 --create-domain-records --subdomain "ci-$CI_PIPELINE_ID.ci"
- python3 -m openappstack ci-$CI_PIPELINE_ID install --ansible-param skip-tags=helmfile
artifacts:
paths:
- ./clusters
......@@ -61,7 +61,7 @@ install:
- chmod 755 ansible/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- python3 -m openappstack $CI_PIPELINE_ID install --ansible-param tags=helmfile
- python3 -m openappstack ci-$CI_PIPELINE_ID install --ansible-param tags=helmfile
# Show versions of installed apps/binaries
- ansible master -m shell -a 'oas-version-info.sh 2>&1'
artifacts:
......@@ -82,7 +82,7 @@ testinfra:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- cd test/
- py.test -v -m 'testinfra' --connection=ansible --ansible-inventory=./clusters/$CI_PIPELINE_ID/inventory.yml --hosts='ansible://*'
- py.test -v -m 'testinfra' --connection=ansible --ansible-inventory=../clusters/ci-$CI_PIPELINE_ID/inventory.yml --hosts='ansible://*'
only:
changes:
- ansible/**/*
......@@ -100,7 +100,7 @@ certs:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- cd test/
- py.test -s -m 'certs' --connection=ansible --ansible-inventory=./clusters/$CI_PIPELINE_ID/inventory.yml --hosts='ansible://*'
- py.test -s -m 'certs' --connection=ansible --ansible-inventory=../clusters/ci-$CI_PIPELINE_ID/inventory.yml --hosts='ansible://*'
only:
changes:
- ansible/**/*
......@@ -112,8 +112,7 @@ certs:
behave-nextcloud:
stage: integration-test
script:
# Debug failing CI caches which happened in the past
- python -m openappstack $CI_PIPELINE_ID test --behave --behave-headless --behave-tags nextcloud || python -m openappstack $CI_PIPELINE_ID test --behave --behave-headless --behave-rerun-failing --behave-tags nextcloud
- python3 -m openappstack ci-$CI_PIPELINE_ID test --behave --behave-headless --behave-tags nextcloud || python3 -m openappstack ci-$CI_PIPELINE_ID test --behave --behave-headless --behave-rerun-failing --behave-tags nextcloud
artifacts:
paths:
- test/behave/screenshots/
......@@ -131,8 +130,7 @@ behave-nextcloud:
behave-grafana:
stage: integration-test
script:
# Debug failing CI caches which happened in the past
- python -m openappstack $CI_PIPELINE_ID test --behave --behave-headless --behave-tags grafana || python -m openappstack $CI_PIPELINE_ID test --behave --behave-headless --behave-rerun-failing --behave-tags grafana
- python3 -m openappstack ci-$CI_PIPELINE_ID test --behave --behave-headless --behave-tags grafana || python3 -m openappstack ci-$CI_PIPELINE_ID test --behave --behave-headless --behave-rerun-failing --behave-tags grafana
artifacts:
paths:
- test/behave/screenshots/
......@@ -150,7 +148,7 @@ terminate:
stage: cleanup
script:
# Remove droplet after successful tests
- echo "$CI_COMMIT_MESSAGE" | grep '!ci_dont_terminate' && echo 'Termination of droplet disabled in commit message.' || python3 -m openappstack $CI_PIPELINE_ID --terminate
- echo "$CI_COMMIT_MESSAGE" | grep '!ci_dont_terminate' && echo 'Termination of droplet disabled in commit message.' || python3 -m openappstack ci-$CI_PIPELINE_ID --terminate
# Remove droplet older than 2 days
- python3 -c "import openappstack.cosmos; openappstack.cosmos.terminate_droplets_by_name(\"^ci-\", 2)"
only:
......
......@@ -13,7 +13,7 @@ release_name: "test"
# Important: Don't quote this variable !
acme_staging: false
# Directory where we save all the passwords etc.
cluster_dir: "./clusters/example-clusterrname/"
cluster_dir: "./clusters/example-clustername/"
# Which apps to install from the helmfile.d/ dir
helmfiles:
- 00-storage
......
......@@ -17,7 +17,7 @@ Install requirements:
openssl-dev openssh-client
pip3 install -r requirements.txt
- Apline using packages (much faster):
- Alpine using packages (much faster):
apk --no-cache add ansible musl-dev linux-headers gcc py3-psutil \
openssh-client
......@@ -38,6 +38,7 @@ import sys
from behave.__main__ import main as behave_main
from openappstack import name, cluster, cosmos, ansible
ALL_TESTS = ['behave']
def main(): # pylint: disable=too-many-statements,too-many-branches,too-many-locals
......@@ -88,7 +89,8 @@ def main(): # pylint: disable=too-many-statements,too-many-branches,too-many-lo
'--ssh-key-id',
metavar='ID',
type=int,
help='ID of ssh key to deploy with (default: 411)')
help=('Greenhost-specific database ID of ssh key to deploy with'
'(default: 411)'))
droplet_creation_group.add_argument(
'--create-domain-records',
......@@ -140,9 +142,12 @@ def main(): # pylint: disable=too-many-statements,too-many-branches,too-many-lo
test_parser.set_defaults(func=test)
test_parser.add_argument(
'--behave',
action='store_true',
help='Runs "behave" tests. NOTE: This overrides behave.ini!')
'--run-test',
action='append',
help=('Run only a specific kind of test. If not provided, all tests '
'are run. The currently available tests are: ') \
+ ','.join(ALL_TESTS))
test_parser.add_argument(
'--behave-rerun-failing',
action='store_true',
......@@ -237,7 +242,14 @@ def install(clus, args):
def test(clus, args):
"""Runs behave or testinfra test. Overwrites behave_path/behave.ini!"""
if args.behave:
# At the moment we only have one type if test, but more tests will be added
# to this in the future. If args.run_test is empty, we run all the tests
run_test = args.run_test
if not run_test:
run_test = ALL_TESTS
if 'behave' in run_test:
behave_path = os.path.join(os.path.dirname(__file__), '..', 'test',
'behave')
# Run from the behave directory so behave automatically loads all the
......@@ -248,7 +260,6 @@ def test(clus, args):
command = []
if args.behave_rerun_failing:
command.append("@rerun_failing.features")
log.info(args.behave_tags)
if args.behave_headless:
command.append("-D headless=True")
for tag in args.behave_tags:
......
File moved
......@@ -20,6 +20,6 @@ RUN apk --no-cache add \
python3-dev \
rsync
COPY ./requirements.txt /requirements.txt
COPY ../requirements.txt /requirements.txt
RUN pip3 install -r /requirements.txt
RUN ln -s /usr/bin/python3 /usr/bin/python
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment