Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos
Commits
b0f63377
Commit
b0f63377
authored
Nov 22, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/slapos-sr-testing: enable test for grafana
parent
ab7ac63a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
8 deletions
+19
-8
software/grafana/test/test.py
software/grafana/test/test.py
+12
-6
software/slapos-sr-testing/buildout.hash.cfg
software/slapos-sr-testing/buildout.hash.cfg
+1
-1
software/slapos-sr-testing/instance.cfg
software/slapos-sr-testing/instance.cfg
+1
-1
software/slapos-sr-testing/software.cfg
software/slapos-sr-testing/software.cfg
+5
-0
No files found.
software/grafana/test/test.py
View file @
b0f63377
...
@@ -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
)
...
@@ -179,7 +179,8 @@ class TestLoki(GrafanaTestCase):
...
@@ -179,7 +179,8 @@ class TestLoki(GrafanaTestCase):
def
test_log_ingested
(
self
):
def
test_log_ingested
(
self
):
# create a logger logging to the file that we have
# create a logger logging to the file that we have
# configured in instance parameter.
# configured in instance parameter.
test_logger
=
logging
.
getLogger
(
self
.
id
())
# type: logging.Logger
test_logger
=
logging
.
getLogger
(
self
.
id
())
test_logger
.
setLevel
(
logging
.
INFO
)
test_handler
=
logging
.
FileHandler
(
filename
=
self
.
_logfile
.
name
)
test_handler
=
logging
.
FileHandler
(
filename
=
self
.
_logfile
.
name
)
test_handler
.
setFormatter
(
test_handler
.
setFormatter
(
logging
.
Formatter
(
logging
.
Formatter
(
...
@@ -197,13 +198,18 @@ class TestLoki(GrafanaTestCase):
...
@@ -197,13 +198,18 @@ class TestLoki(GrafanaTestCase):
'{self.loki_url}/api/prom/query?query={{job="TestLoki"}}'
.
format
(
'{self.loki_url}/api/prom/query?query={{job="TestLoki"}}'
.
format
(
**
locals
()),
**
locals
()),
verify
=
False
).
json
()
verify
=
False
).
json
()
if
not
resp
or
len
(
resp
[
'streams'
])
<
2
:
if
not
resp
:
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'
]
...
...
software/slapos-sr-testing/buildout.hash.cfg
View file @
b0f63377
...
@@ -15,4 +15,4 @@
...
@@ -15,4 +15,4 @@
[template]
[template]
filename = instance.cfg
filename = instance.cfg
md5sum =
4664f7dae66d3f582e34cec2ca627501
md5sum =
1cbab58e896ff63575f6a67db530d183
software/slapos-sr-testing/instance.cfg
View file @
b0f63377
...
@@ -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
...
...
software/slapos-sr-testing/software.cfg
View file @
b0f63377
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment