Commit d1c804fc authored by Jérome Perrin's avatar Jérome Perrin

software/slapos-sr-testing: enable test for grafana

parent 32445b30
...@@ -107,7 +107,7 @@ class TestInfluxDb(GrafanaTestCase): ...@@ -107,7 +107,7 @@ class TestInfluxDb(GrafanaTestCase):
query_url = '{self.influxdb_url}/query'.format(**locals()) query_url = '{self.influxdb_url}/query'.format(**locals())
connection_params = self.computer_partition.getConnectionParameterDict() connection_params = self.computer_partition.getConnectionParameterDict()
for i in range(5): for i in range(10):
# retry, as it may take a little delay to create databases # retry, as it may take a little delay to create databases
resp = requests.get( resp = requests.get(
query_url, query_url,
...@@ -118,7 +118,7 @@ class TestInfluxDb(GrafanaTestCase): ...@@ -118,7 +118,7 @@ class TestInfluxDb(GrafanaTestCase):
p=connection_params['influxdb-password'])) p=connection_params['influxdb-password']))
self.assertEqual(requests.codes.ok, resp.status_code) self.assertEqual(requests.codes.ok, resp.status_code)
result, = resp.json()['results'] result, = resp.json()['results']
if result['series']: if result['series'] and 'values' in result['series'][0]:
break break
time.sleep(0.5 * i) time.sleep(0.5 * i)
...@@ -201,9 +201,14 @@ class TestLoki(GrafanaTestCase): ...@@ -201,9 +201,14 @@ class TestLoki(GrafanaTestCase):
time.sleep(0.5 * i) time.sleep(0.5 * i)
continue continue
warn_stream, = [stream for stream in resp['streams'] if 'level="WARNING"' in stream['labels']] warn_stream_list = [stream for stream in resp['streams'] if 'level="WARNING"' in stream['labels']]
self.assertEqual(1, len(warn_stream_list), resp['streams'])
warn_stream, = warn_stream_list
self.assertIn("testing warn", warn_stream['entries'][0]['line']) self.assertIn("testing warn", warn_stream['entries'][0]['line'])
info_stream, = [stream for stream in resp['streams'] if 'level="INFO"' in stream['labels']]
info_stream_list = [stream for stream in resp['streams'] if 'level="INFO"' in stream['labels']]
self.assertEqual(1, len(info_stream_list), resp['streams'])
info_stream, = info_stream_list
self.assertTrue( self.assertTrue(
[ [
line for line in info_stream['entries'] line for line in info_stream['entries']
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[template] [template]
filename = instance.cfg filename = instance.cfg
md5sum = 4664f7dae66d3f582e34cec2ca627501 md5sum = 1cbab58e896ff63575f6a67db530d183
...@@ -28,7 +28,7 @@ bin = $${buildout:directory}/bin ...@@ -28,7 +28,7 @@ bin = $${buildout:directory}/bin
working-dir = $${buildout:directory}/tmp working-dir = $${buildout:directory}/tmp
[test-list] [test-list]
path_list = ${slapos.cookbook-setup:setup},${slapos.test.caddy-frontend-setup:setup},${slapos.test.erp5-setup:setup},${slapos.test.slapos-master-setup:setup},${slapos.test.kvm-setup:setup},${slapos.test.monitor-setup:setup},${slapos.test.plantuml-setup:setup},${slapos.test.powerdns-setup:setup},${slapos.test.proftpd-setup:setup},${slapos.test.re6stnet-setup:setup},${slapos.test.seleniumserver-setup:setup},${slapos.test.slaprunner-setup:setup},${slapos.test.helloworld-setup:setup},${slapos.test.jupyter-setup:setup},${slapos.test.nextcloud-setup:setup},${slapos.test.turnserver-setup:setup},${slapos.test.theia-setup:setup} path_list = ${slapos.cookbook-setup:setup},${slapos.test.caddy-frontend-setup:setup},${slapos.test.erp5-setup:setup},${slapos.test.slapos-master-setup:setup},${slapos.test.kvm-setup:setup},${slapos.test.monitor-setup:setup},${slapos.test.plantuml-setup:setup},${slapos.test.powerdns-setup:setup},${slapos.test.proftpd-setup:setup},${slapos.test.re6stnet-setup:setup},${slapos.test.seleniumserver-setup:setup},${slapos.test.slaprunner-setup:setup},${slapos.test.helloworld-setup:setup},${slapos.test.jupyter-setup:setup},${slapos.test.nextcloud-setup:setup},${slapos.test.turnserver-setup:setup},${slapos.test.theia-setup:setup},${slapos.test.grafana-setup:setup}
[slapos-test-runner] [slapos-test-runner]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
......
...@@ -107,6 +107,11 @@ setup = ${slapos-repository:location}/software/turnserver/test/ ...@@ -107,6 +107,11 @@ setup = ${slapos-repository:location}/software/turnserver/test/
egg = slapos.test.theia egg = slapos.test.theia
setup = ${slapos-repository:location}/software/theia/test/ setup = ${slapos-repository:location}/software/theia/test/
[slapos.test.grafana-setup]
<= setup-develop-egg
egg = slapos.test.grafana
setup = ${slapos-repository:location}/software/grafana/test/
[slapos.core-repository] [slapos.core-repository]
<= git-clone-repository <= git-clone-repository
repository = https://lab.nexedi.com/nexedi/slapos.core.git repository = https://lab.nexedi.com/nexedi/slapos.core.git
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment