-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toxification of functional tests #456
Changes from all commits
2b28863
1458552
1fb5f5a
06f2183
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash -ex | ||
|
||
# Proxy script from tox. This is an intermediate script so that we can setup | ||
# the environment properly then call ceph-ansible for testing, and finally tear | ||
# down, while keeping tox features of simplicity and combinatorial confgiruation. | ||
# | ||
# NOTE: Do not run this script directly as it depends on a few environment | ||
# variables that tox will set, like ceph-ansible's scenario path | ||
|
||
# setup | ||
################################################################################# | ||
# XXX this should probably not install system dependencies like this, since now | ||
# it means we are tied to an apt-get distro | ||
sudo apt-get install -y --force-yes docker.io | ||
sudo apt-get install -y --force-yes xfsprogs | ||
git clone -b $CEPH_ANSIBLE_BRANCH --single-branch https://github.com/ceph/ceph-ansible.git ceph-ansible | ||
pip install -r $TOXINIDIR/ceph-ansible/tests/requirements.txt | ||
|
||
# pull requests tests should never have these directories here, but branches | ||
# do, so for the build scripts to work correctly, these neeed to be removed | ||
# XXX It requires sudo because these will appear with `root` ownership | ||
rm -rf "$WORKSPACE"/{daemon,demo,base} | ||
|
||
bash "$WORKSPACE"/travis-builds/purge_cluster.sh | ||
# XXX purge_cluster only stops containers, it doesn't really remove them so try to | ||
# remove them for real | ||
containers_to_remove=$(docker ps -a -q) | ||
|
||
if [ "${containers_to_remove}" ]; then | ||
docker rm -f $@ ${containers_to_remove} || echo failed to remove containers | ||
fi | ||
|
||
bash "$WORKSPACE"/travis-builds/build_imgs.sh | ||
|
||
# test | ||
################################################################################# | ||
|
||
# TODO: get the output image from build_imgs.sh to pass onto ceph-ansible | ||
|
||
# run vagrant and ceph-ansible tests | ||
################################################################################# | ||
cd "$CEPH_ANSIBLE_SCENARIO_PATH" | ||
vagrant up --no-provision --provider=$VAGRANT_PROVIDER | ||
|
||
bash $TOXINIDIR/ceph-ansible/tests/scripts/generate_ssh_config.sh $CEPH_ANSIBLE_SCENARIO_PATH | ||
|
||
export ANSIBLE_SSH_ARGS="-F $CEPH_ANSIBLE_SCENARIO_PATH/vagrant_ssh_config" | ||
|
||
ansible-playbook -vv -i $CEPH_ANSIBLE_SCENARIO_PATH/hosts $TOXINIDIR/ceph-ansible/site-docker.yml.sample --extra-vars="ceph_docker_dev_image=true fetch_directory=$CEPH_ANSIBLE_SCENARIO_PATH/fetch" | ||
|
||
ansible-playbook -vv -i $CEPH_ANSIBLE_SCENARIO_PATH/hosts $TOXINIDIR/ceph-ansible/tests/functional/setup.yml | ||
|
||
testinfra -n 4 --sudo -v --connection=ansible --ansible-inventory=$CEPH_ANSIBLE_SCENARIO_PATH/hosts $TOXINIDIR/ceph-ansible/tests/functional/tests | ||
|
||
# teardown | ||
################################################################################# | ||
cd $CEPH_ANSIBLE_SCENARIO_PATH | ||
vagrant destroy --force | ||
cd $WORKSPACE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[tox] | ||
envlist = {ceph_ansible2.1}-{jewel}-{xenial_cluster,centos7_cluster} | ||
skipsdist = True | ||
|
||
[testenv] | ||
whitelist_externals = | ||
vagrant | ||
bash | ||
pip | ||
git | ||
|
||
passenv=* | ||
setenv= | ||
TOXINIDIR = {toxinidir} | ||
ANSIBLE_ACTION_PLUGINS = {toxinidir}/ceph-ansible/plugins/actions | ||
# only available for ansible >= 2.2 | ||
ANSIBLE_STDOUT_CALLBACK = debug | ||
centos7_cluster: CEPH_ANSIBLE_SCENARIO_PATH = {toxinidir}/ceph-ansible/tests/functional/centos/7/docker-cluster | ||
xenial_cluster: CEPH_ANSIBLE_SCENARIO_PATH = {toxinidir}/ceph-ansible/tests/functional/ubuntu/xenial/docker-cluster | ||
ceph_ansible2.1: CEPH_ANSIBLE_BRANCH = stable-2.1 | ||
VAGRANT_PROVIDER={env:VAGRANT_PROVIDER:libvirt} | ||
deps= | ||
ansible==2.2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you need to install the test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't because ceph-ansible is not checked out yet at this point, so that would mean it would need to assume the right dependencies of ceph-ansible, with the possibility of them getting out of sync. That is why the dependencies are installed in tox.sh |
||
commands= | ||
bash {toxinidir}/tests/tox.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not an
ubuntu/xenial/docker-cluster
testing scenario in ceph-ansible. I'm guessing we'll need to use the same scenario fromcentos/7/docker-cluster
but tell it to use a different image.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, correct. I didn't think it would be an issue to just have it defined already