Integration: Added test_delete_host + use integration.yml

Change-Id: I95b36eabdcad6f91e25a20a3354530b9a095cb9b
This commit is contained in:
aviau 2015-05-28 15:46:07 -04:00
parent 0e78fe24da
commit 99ecad6205
4 changed files with 73 additions and 6 deletions

@ -0,0 +1,30 @@
surveil:
build: .
links:
- mongo
- influxdb
- alignak
ports:
- "8999:8080"
command: bash -c "cd /opt/surveil && ./setup.sh && python setup.py develop && ((sleep 40 && surveil-init --demo) &) && sleep 20 && surveil-api --reload"
alignak:
build: tools/docker/alignak_container/
links:
- mongo
- influxdb
environment:
SURVEIL_OS_AUTH_URL: "http://keystone:5000/v2.0"
SURVEIL_OS_USERNAME: "admin"
SURVEIL_OS_PASSWORD: "password"
SURVEIL_OS_TENANT_NAME: "admin"
mongo:
image: mongo
command:
"mongod --nojournal --smallfiles"
influxdb:
image: savoirfairelinux/influxdb
environment:
PRE_CREATE_DB: "db"

@ -37,8 +37,17 @@ class MergedIntegrationTest(base.BaseTestCase):
os.path.dirname(os.path.realpath(__file__)),
"../../../")
)
compose_file = os.path.join(surveil_dir, 'docker-compose.yml')
project_config = compose_config.load(compose_file)
compose_file = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'integration.yml'
)
project_config = compose_config.from_dictionary(
compose_config.load_yaml(compose_file),
working_dir=surveil_dir,
filename=compose_file
)
cls.project = compose_project.Project.from_dicts(
"surveilintegrationtest",
@ -50,8 +59,8 @@ class MergedIntegrationTest(base.BaseTestCase):
cls.project.up()
cls.client = sclient.Client(
'http://localhost:8080/v2',
auth_url='http://localhost:8080/v2/auth',
'http://localhost:8999/v2',
auth_url='http://localhost:8999/v2/auth',
version='2_0'
)

@ -23,7 +23,7 @@ class TestMergedIngegrationSurveil(
def test_hello(self):
self.assertEqual(
requests.get("http://localhost:8080/v2/hello").text,
requests.get("http://localhost:8999/v2/hello").text,
'Hello World!'
)
@ -67,3 +67,31 @@ class TestSeparatedIntegrationSurveil(
message="Could not find host in status."
)
)
def test_delete_host(self):
self.test_create_host()
TestSeparatedIntegrationSurveil.client.config.hosts.delete(
'integrationhosttest'
)
TestSeparatedIntegrationSurveil.client.config.reload_config()
def function():
# TODO(aviau): Use status API
status_hosts = (TestSeparatedIntegrationSurveil.
client.config.hosts.list())
self.assertFalse(
any(host['host_name'].decode() == 'integrationhosttest'
for host in status_hosts)
)
self.assertTrue(
self.try_for_x_seconds(
function,
time_to_wait=180,
cooldown=10,
exception=AssertionError,
message="Host was not deleted"
)
)

@ -9,4 +9,4 @@ mongomock
httpretty==0.8.3
sphinx_rtd_theme
docker-compose
python-surveilclient
python-surveilclient==0.6.0