Added snapstack test.
Tweaked tox.ini to invoke snapstack, and added test_snapstack.py to tests dir. Also added neutron.sh to neutron/tests, as part of the plan to move those scripts from snap-test to the individual snaps. Change-Id: Ie0e7d3211b99ace8f5c19e2781d928f3a589acce
This commit is contained in:
parent
3082fc6290
commit
6f54b6ccfb
38
tests/neutron.sh
Executable file
38
tests/neutron.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
source $BASE_DIR/admin-openrc
|
||||
|
||||
openstack user show neutron || {
|
||||
openstack user create --domain default --password neutron neutron
|
||||
openstack role add --project service --user neutron admin
|
||||
}
|
||||
|
||||
openstack service show network || {
|
||||
openstack service create --name neutron \
|
||||
--description "OpenStack Network" network
|
||||
|
||||
for endpoint in public internal admin; do
|
||||
openstack endpoint create --region RegionOne \
|
||||
network $endpoint http://localhost:9696 || :
|
||||
done
|
||||
}
|
||||
|
||||
while sudo [ ! -d /var/snap/neutron/common/etc/neutron/ ]; do sleep 0.1; done;
|
||||
sudo cp -r $BASE_DIR/etc/snap-neutron/* /var/snap/neutron/common/etc/
|
||||
|
||||
# Manually define alias if snap isn't installed from snap store.
|
||||
# Otherwise, snap store defines this alias automatically.
|
||||
snap aliases neutron | grep neutron-db-manage || sudo snap alias neutron.manage neutron-db-manage
|
||||
|
||||
sudo neutron-db-manage upgrade head
|
||||
|
||||
sudo systemctl restart snap.neutron.*
|
||||
|
||||
while ! nc -z localhost 9696; do sleep 0.1; done;
|
||||
|
||||
neutron net-show test || {
|
||||
neutron net-create test
|
||||
neutron subnet-create --name test_subnet test 192.168.222.0/24
|
||||
}
|
26
tests/snapstack_test.py
Normal file
26
tests/snapstack_test.py
Normal file
@ -0,0 +1,26 @@
|
||||
import unittest
|
||||
|
||||
from snapstack import Plan, Setup, Step
|
||||
|
||||
class SnapstackTest(unittest.TestCase):
|
||||
|
||||
def test_snapstack(self):
|
||||
'''
|
||||
_test_snapstack_
|
||||
|
||||
Run a basic smoke test, utilizing our snapstack testing harness.
|
||||
|
||||
'''
|
||||
# snapstack already installs neutron. Override the 'neutron'
|
||||
# step with a locally built snap. keystone, nova, etc. will still
|
||||
# be installed as normal from the store.
|
||||
setup = Setup()
|
||||
setup.add_steps(('neutron', Step(
|
||||
snap='neutron',
|
||||
script_loc='./tests/',
|
||||
scripts=['neutron.sh'],
|
||||
snap_store=False)))
|
||||
|
||||
# Execute the snapstack tests
|
||||
plan = Plan(base_setup=setup.steps())
|
||||
plan.run()
|
14
tox.ini
14
tox.ini
@ -5,14 +5,18 @@ skipsdist = True
|
||||
[testenv]
|
||||
basepython = python3.5
|
||||
install_command = pip install {opts} {packages}
|
||||
passenv = HOME TERM
|
||||
passenv =
|
||||
HOME
|
||||
TERM
|
||||
SNAP_BUILD_PROXY
|
||||
whitelist_externals =
|
||||
sudo
|
||||
snapcraft
|
||||
|
||||
[testenv:snap]
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
git+https://github.com/openstack-snaps/snapstack
|
||||
pytest
|
||||
commands =
|
||||
sudo snap install core
|
||||
snapcraft clean
|
||||
snapcraft snap
|
||||
py.test -s tests/
|
||||
|
Loading…
x
Reference in New Issue
Block a user