Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pony
rework_ui
Commits
fce85523c9f9
Commit
36b441cf
authored
Dec 19, 2018
by
Aurélien Campéas
Browse files
test: track monitors tab output
parent
a9c1268396d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/data/monitors-table-1-task.html
0 → 100644
View file @
fce85523
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
<br>
<table
class=
"table table-sm table-bordered table-striped table-hover"
>
<thead
class=
"thead-inverse"
><tr>
<th>
#
</th>
<th>
domain
</th>
<th>
seen last
</th>
<th>
options
</th>
</tr></thead>
<tr>
<td><x></x></td>
<td>
default
</td>
<td
style=
"color: DarkGreen"
><x>
-
<x>
-
<x>
<x>
:
<x>
:
<x>
+
<x></x></x></x></x></x></x></x></td>
<td>
debugport=
<x>
, maxmem=
<x>
, maxruns=
<x>
, maxworkers=
<x>
, minworkers=
<x></x></x></x></x></x>
</td>
</tr>
</table>
<table
class=
"table table-sm table-bordered table-striped table-hover"
>
<thead
class=
"thead-inverse"
><tr>
<th>
#
</th>
<th>
pid@host
</th>
<th>
domain
</th>
<th>
memory (Mb)
</th>
<th>
debug port
</th>
<th>
action
</th>
</tr></thead>
<tr>
<th
scope=
"row"
><x></x></th>
<td><x>
@
<x>
.
<x>
.
<x>
.
<x></x></x></x></x></x></td>
<td>
default
</td>
<td><x></x></td>
<td></td>
<td>
<button
type=
"button"
class=
"btn btn-warning btn-sm"
onclick=
"shutdown_worker(<X>)"
>
shutdown
</button><span>
</span><button
type=
"button"
class=
"btn btn-danger btn-sm"
onclick=
"kill_worker(<X>)"
>
kill
</button>
</td>
</tr>
</table>
</body></html>
tests/data/monitors-table.html
0 → 100644
View file @
fce85523
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
<br>
<table
class=
"table table-sm table-bordered table-striped table-hover"
>
<thead
class=
"thead-inverse"
><tr>
<th>
#
</th>
<th>
domain
</th>
<th>
seen last
</th>
<th>
options
</th>
</tr></thead>
<tr>
<td><x></x></td>
<td>
default
</td>
<td
style=
"color: DarkGreen"
><x>
-
<x>
-
<x>
<x>
:
<x>
:
<x>
+
<x></x></x></x></x></x></x></x></td>
<td>
debugport=
<x>
, maxmem=
<x>
, maxruns=
<x>
, maxworkers=
<x>
, minworkers=
<x></x></x></x></x></x>
</td>
</tr>
</table>
<table
class=
"table table-sm table-bordered table-striped table-hover"
>
<thead
class=
"thead-inverse"
><tr>
<th>
#
</th>
<th>
pid@host
</th>
<th>
domain
</th>
<th>
memory (Mb)
</th>
<th>
debug port
</th>
<th>
action
</th>
</tr></thead>
<tr>
<th
scope=
"row"
><x></x></th>
<td><x>
@
<x>
.
<x>
.
<x>
.
<x></x></x></x></x></x></td>
<td>
default
</td>
<td><x></x></td>
<td></td>
<td>
<button
type=
"button"
class=
"btn btn-warning btn-sm"
onclick=
"shutdown_worker(<X>)"
>
shutdown
</button><span>
</span><button
type=
"button"
class=
"btn btn-danger btn-sm"
onclick=
"kill_worker(<X>)"
>
kill
</button>
</td>
</tr>
</table>
</body></html>
tests/test_rui.py
View file @
fce85523
...
...
@@ -14,6 +14,12 @@ DATADIR = Path(__file__).parent / 'data'
# html editor
def
normalize
(
htmlstr
):
tree
=
etree
.
fromstring
(
htmlstr
,
parser
=
etree
.
HTMLParser
())
return
etree
.
tostring
(
tree
.
getroottree
(),
pretty_print
=
True
,
method
=
'html'
)
def
edittag
(
tag
,
editor
,
anstr
):
if
isinstance
(
tag
,
str
):
tags
=
[
tag
]
...
...
@@ -146,6 +152,30 @@ def test_task_life_cycle(engine, client, refresh):
assert
html
==
refpath
.
read_bytes
()
def
test_monitors_table
(
engine
,
client
,
refresh
):
with
engine
.
begin
()
as
cn
:
cn
.
execute
(
'delete from rework.monitor'
)
cn
.
execute
(
'delete from rework.worker'
)
with
workers
(
engine
):
res
=
client
.
get
(
'/workers-table'
)
html
=
normalize
(
scrub
(
res
.
text
))
refpath
=
DATADIR
/
'monitors-table.html'
if
refresh
:
refpath
.
write_bytes
(
html
)
assert
html
==
refpath
.
read_bytes
()
t
=
api
.
schedule
(
engine
,
'abortme'
)
t
.
join
(
'running'
)
res
=
client
.
get
(
'/workers-table'
)
html
=
normalize
(
scrub
(
res
.
text
))
refpath
=
DATADIR
/
'monitors-table-1-task.html'
if
refresh
:
refpath
.
write_bytes
(
html
)
assert
html
==
refpath
.
read_bytes
()
def
test_tasks_table
(
engine
,
client
,
refresh
):
with
engine
.
begin
()
as
cn
:
cn
.
execute
(
'delete from rework.task'
)
...
...
@@ -213,7 +243,7 @@ def test_tasks_table(engine, client, refresh):
t
.
join
()
taskstable
.
refresh_tasks_file
(
engine
)
res
=
client
.
get
(
'/tasks-table-hash?domain=uranus'
)
assert
res
.
text
==
'
98cc14b1de9bdd660aaa61f8b2ac4144
'
assert
res
.
text
==
'
cbcf36e551ad8fdc0aef16fbefd7c6be
'
res
=
client
.
get
(
'/tasks-table?domain=uranus'
)
refpath
=
DATADIR
/
'tasks-table-uranus.html'
if
refresh
:
...
...
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