Integration test use the new API
Change-Id: I60a39eb236bbe1e97b447dc0ca913405a49bbaaa
This commit is contained in:
parent
5452dd574b
commit
9e3131e1f6
@ -67,7 +67,7 @@ class DockerBackend():
|
|||||||
now = time.time()
|
now = time.time()
|
||||||
while True:
|
while True:
|
||||||
print("Waiting for surveil... %s" % int(time.time() - now))
|
print("Waiting for surveil... %s" % int(time.time() - now))
|
||||||
if time.time() < (now + 280):
|
if time.time() < (now + 380):
|
||||||
try:
|
try:
|
||||||
# If 'ws-arbiter' is found, Surveil is ready!
|
# If 'ws-arbiter' is found, Surveil is ready!
|
||||||
configured_hosts = self.surveil_client.status.hosts.list()
|
configured_hosts = self.surveil_client.status.hosts.list()
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
ambassador:
|
||||||
|
image: cpuguy83/docker-grand-ambassador
|
||||||
|
volumes:
|
||||||
|
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||||
|
command: "-name surveilintegrationtest_surveil_1 -name surveilintegrationtest_alignak_1"
|
||||||
|
|
||||||
surveil:
|
surveil:
|
||||||
build: .
|
build: .
|
||||||
links:
|
links:
|
||||||
@ -14,6 +20,7 @@ alignak:
|
|||||||
- mongo
|
- mongo
|
||||||
- influxdb
|
- influxdb
|
||||||
- redis
|
- redis
|
||||||
|
- "ambassador:surveil"
|
||||||
environment:
|
environment:
|
||||||
SURVEIL_OS_AUTH_URL: "http://keystone:5000/v2.0"
|
SURVEIL_OS_AUTH_URL: "http://keystone:5000/v2.0"
|
||||||
SURVEIL_OS_USERNAME: "admin"
|
SURVEIL_OS_USERNAME: "admin"
|
||||||
@ -26,7 +33,7 @@ mongo:
|
|||||||
"mongod --nojournal --smallfiles"
|
"mongod --nojournal --smallfiles"
|
||||||
|
|
||||||
influxdb:
|
influxdb:
|
||||||
image: savoirfairelinux/influxdb:0.9.0
|
image: surveil/influxdb:0.9.2
|
||||||
environment:
|
environment:
|
||||||
PRE_CREATE_DB: "db"
|
PRE_CREATE_DB: "db"
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class TestSeparatedIntegrationSurveil(
|
|||||||
self.get_surveil_client().config.hosts.create(
|
self.get_surveil_client().config.hosts.create(
|
||||||
host_name='integrationhosttest',
|
host_name='integrationhosttest',
|
||||||
address='127.0.0.1',
|
address='127.0.0.1',
|
||||||
use='generic-host',
|
use=['generic-host'],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.get_surveil_client().config.reload_config()
|
self.get_surveil_client().config.reload_config()
|
||||||
@ -106,10 +106,14 @@ class TestSeparatedIntegrationSurveil(
|
|||||||
def function():
|
def function():
|
||||||
status_host = (self.get_surveil_client().
|
status_host = (self.get_surveil_client().
|
||||||
config.hosts.get(host_name='host_name_up'))
|
config.hosts.get(host_name='host_name_up'))
|
||||||
|
use = []
|
||||||
|
for status_host_use in status_host['use']:
|
||||||
|
use.append(status_host_use.decode())
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
status_host['host_name'].decode() == 'host_name_up' and
|
status_host['host_name'].decode() == 'host_name_up' and
|
||||||
status_host['address'].decode() == '127.0.1.1' and
|
status_host['address'].decode() == '127.0.1.1' and
|
||||||
status_host['use'].decode() == 'generic-host'
|
use == ['generic-host']
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
@ -130,9 +134,9 @@ class TestSeparatedIntegrationSurveil(
|
|||||||
check_command="check_integrationhosttest",
|
check_command="check_integrationhosttest",
|
||||||
check_interval="5",
|
check_interval="5",
|
||||||
check_period="24x7",
|
check_period="24x7",
|
||||||
contact_groups="admins",
|
contact_groups=["admins"],
|
||||||
contacts="admin",
|
contacts=["admin"],
|
||||||
host_name="integrationhosttest",
|
host_name=["integrationhosttest"],
|
||||||
max_check_attempts="5",
|
max_check_attempts="5",
|
||||||
notification_interval="30",
|
notification_interval="30",
|
||||||
notification_period="24x7",
|
notification_period="24x7",
|
||||||
@ -143,16 +147,22 @@ class TestSeparatedIntegrationSurveil(
|
|||||||
|
|
||||||
self.get_surveil_client().config.reload_config()
|
self.get_surveil_client().config.reload_config()
|
||||||
self.get_surveil_client().status.services.submit_check_result(
|
self.get_surveil_client().status.services.submit_check_result(
|
||||||
host_name='integrationhosttest',
|
host_name=['integrationhosttest'],
|
||||||
service_description='check_integrationhosttest',
|
service_description='check_integrationhosttest',
|
||||||
output="Hello",
|
output="Hello",
|
||||||
return_code=0
|
return_code=0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_host_name(service):
|
||||||
|
host_name_list = []
|
||||||
|
for host_name in service['host_name']:
|
||||||
|
host_name_list.append(host_name.decode())
|
||||||
|
return host_name_list
|
||||||
|
|
||||||
def function():
|
def function():
|
||||||
status_services = self.get_surveil_client().status.services.list()
|
status_services = self.get_surveil_client().status.services.list()
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
any(service['host_name'].decode() == 'integrationhosttest' and
|
any(get_host_name(service) == ['integrationhosttest'] and
|
||||||
service['service_description'].decode() ==
|
service['service_description'].decode() ==
|
||||||
'check_integrationhosttest' and
|
'check_integrationhosttest' and
|
||||||
service['plugin_output'].decode() == 'Hello' and
|
service['plugin_output'].decode() == 'Hello' and
|
||||||
@ -194,9 +204,9 @@ class TestSeparatedIntegrationSurveil(
|
|||||||
check_command="check_integrationhosttest",
|
check_command="check_integrationhosttest",
|
||||||
check_interval="5",
|
check_interval="5",
|
||||||
check_period="24x7",
|
check_period="24x7",
|
||||||
contact_groups="admins",
|
contact_groups=["admins"],
|
||||||
contacts="admin",
|
contacts=["admin"],
|
||||||
host_name="integrationhosttest",
|
host_name=["integrationhosttest"],
|
||||||
max_check_attempts="5",
|
max_check_attempts="5",
|
||||||
notification_interval="30",
|
notification_interval="30",
|
||||||
notification_period="24x7",
|
notification_period="24x7",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user