PyKMIP/.travis/run.sh
Peter Hamilton b5e7323845 Add functional tests for server auth and access control
This change adds a new integration test suite, named 'functional',
that is specifically intended to test third-party authentication
and group-based access control with the PyKMIP server. A new tox
environment is added to handle running these tests separately from
the existing 'integration' test suite. New Travis CI configuration
and setup files have also been added to facilitate running these
tests automatically.
2018-05-09 01:21:03 -04:00

37 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
set -x
if [[ "${RUN_INTEGRATION_TESTS}" == "1" ]]; then
sudo mkdir -p /etc/pykmip/certs
sudo mkdir -p /etc/pykmip/policies
cd /etc/pykmip/certs
sudo openssl req -x509 -subj "/CN=test" -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
cd -
sudo cp ./.travis/pykmip.conf /etc/pykmip/pykmip.conf
sudo cp ./.travis/server.conf /etc/pykmip/server.conf
sudo cp ./.travis/policy.json /etc/pykmip/policies/policy.json
sudo mkdir /var/log/pykmip
sudo chmod 777 /var/log/pykmip
python ./bin/run_server.py &
tox -e integration -- --config client
elif [[ "${RUN_INTEGRATION_TESTS}" == "2" ]]; then
# Set up the SLUGS instance
cp -r ./.travis/functional/slugs /tmp/
slugs -c /tmp/slugs/slugs.conf &
# Set up the PyKMIP server
cp -r ./.travis/functional/pykmip /tmp/
python ./bin/create_certificates.py
mv *.pem /tmp/pykmip/certs/
sudo mkdir /var/log/pykmip
sudo chmod 777 /var/log/pykmip
pykmip-server -f /tmp/pykmip/server.conf -l /tmp/pykmip/server.log &
# Run the functional tests
tox -e functional -- --config-file /tmp/pykmip/client.conf
else
tox
fi