Skip to content

Commit

Permalink
Add an Ansible driver
Browse files Browse the repository at this point in the history
It calls ansible_runner.interface.run() by converting the testcase
description data to kwargs. It only overrides quiet and artifact_dir to
implement the Xtesting behavior.

Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com>

Change-Id: Ifd09810400babc0f2b81f2c33edf55a3ed88807b
Signed-off-by: Ajay kumar <ajay4.kumar@orange.com>
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
  • Loading branch information
Ajay Kumar authored and collivier committed Apr 27, 2021
1 parent 4950422 commit 95611ad
Show file tree
Hide file tree
Showing 12 changed files with 418 additions and 186 deletions.
1 change: 1 addition & 0 deletions ansible/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- fourth
- fifth
- sixth
- eighth
- container: xtesting-mts
tests:
- seventh
12 changes: 7 additions & 5 deletions docker/core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ ARG BRANCH=master
ARG OPENSTACK_TAG=master

RUN apk -U upgrade && \
apk --no-cache add --update python3 py3-pip py3-wheel bash git mailcap libxml2 libxslt && \
apk --no-cache add --update python3 py3-pip py3-wheel bash git mailcap libxml2 libxslt ansible && \
apk --no-cache add --virtual .build-deps --update \
python3-dev build-base libxml2-dev libxslt-dev && \
python3-dev build-base libxml2-dev libxslt-dev linux-headers && \
wget -q -O- https://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt > upper-constraints.txt && \
sed -i -E /^PyYAML==+.*$/d upper-constraints.txt && \
case $(uname -m) in aarch*|arm*) CFLAGS="-O0" \
pip3 install --no-cache-dir \
-chttps://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt \
-cupper-constraints.txt \
-chttps://git.opnfv.org/functest-xtesting/plain/upper-constraints.txt?h=$BRANCH \
lxml ;; esac && \
git init /src/functest-xtesting && \
(cd /src/functest-xtesting && \
git fetch --tags https://gerrit.opnfv.org/gerrit/functest-xtesting $BRANCH && \
git checkout FETCH_HEAD) && \
pip3 install --no-cache-dir --src /src \
-chttps://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt \
-cupper-constraints.txt \
-chttps://git.opnfv.org/functest-xtesting/plain/upper-constraints.txt?h=$BRANCH \
/src/functest-xtesting && \
rm -r /src/functest-xtesting && \
rm -r /src/functest-xtesting upper-constraints.txt && \
apk del .build-deps
COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
CMD ["run_tests", "-t", "all"]
154 changes: 77 additions & 77 deletions docker/core/testcases.yaml
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
---
tiers:
-
name: samples
- name: samples
description: ''
testcases:
- case_name: first
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
testcases:
-
case_name: first
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: 'first'

-
case_name: second
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: 'second'

-
case_name: third
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: 'bashfeature'
args:
cmd: 'echo -n Hello World; exit 0'

-
case_name: fourth
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: 'unit'
args:
name: 'xtesting.samples.fourth'

-
case_name: fifth
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: 'robotframework'
args:
suites:
- /usr/lib/python3.8/site-packages/xtesting/samples/HelloWorld.robot
variable:
- 'var01:foo'
- 'var02:bar'

-
case_name: sixth
project_name: xtesting
criteria: 100
blocking: false
clean_flag: false
description: ''
run:
name: 'behaveframework'
args:
suites:
- /usr/lib/python3.8/site-packages/xtesting/samples/features/
tags:
- foo
run:
name: first
- case_name: second
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: second
- case_name: third
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: bashfeature
args:
cmd: echo -n Hello World; exit 0
- case_name: fourth
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: unit
args:
name: xtesting.samples.fourth
- case_name: fifth
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: robotframework
args:
suites:
- >-
/usr/lib/python3.8/site-packages/xtesting/samples/HelloWorld.robot
variable:
- 'var01:foo'
- 'var02:bar'
- case_name: sixth
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: behaveframework
args:
suites:
- /usr/lib/python3.8/site-packages/xtesting/samples/features
tags:
- foo
- case_name: eighth
project_name: xtesting
criteria: 100
blocking: true
clean_flag: false
description: ''
run:
name: ansible
args:
private_data_dir: /usr/lib/python3.8/site-packages/xtesting/samples
playbook: helloworld.yml
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ os-testr # Apache-2.0
junitxml
boto3 # Apache-2.0
lxml!=3.7.0 # BSD
ansible-runner!=1.3.5 # Apache 2.0
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ xtesting.testcase =
first = xtesting.samples.first:Test
second = xtesting.samples.second:Test
mts = xtesting.core.mts:MTSLauncher
ansible = xtesting.core.ansible:Ansible

[build_sphinx]
all_files = 1
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ doc8 # Apache-2.0
bashate # Apache-2.0
ansible-lint
bandit
munch # MIT
Loading

0 comments on commit 95611ad

Please sign in to comment.