Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
9da139e8
Commit
9da139e8
authored
7 years ago
by
Michael Lange
Browse files
Options
Download
Email Patches
Plain Diff
Update tests for the ModifyIndex column and sort change
parent
11327501
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ui/tests/acceptance/client-detail-test.js
+18
-10
ui/tests/acceptance/client-detail-test.js
ui/tests/acceptance/task-group-detail-test.js
+48
-38
ui/tests/acceptance/task-group-detail-test.js
with
66 additions
and
48 deletions
+66
-48
ui/tests/acceptance/client-detail-test.js
+
18
-
10
View file @
9da139e8
...
...
@@ -127,12 +127,20 @@ test('each allocation should have high-level details for the allocation', functi
.
find
(
'
td:eq(1)
'
)
.
text
()
.
trim
(),
allocation
.
modifyIndex
,
'
Allocation modify index
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(2)
'
)
.
text
()
.
trim
(),
allocation
.
name
,
'
Allocation name
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
2
)
'
)
.
find
(
'
td:eq(
3
)
'
)
.
text
()
.
trim
(),
allocation
.
clientStatus
,
...
...
@@ -140,41 +148,41 @@ test('each allocation should have high-level details for the allocation', functi
);
assert
.
ok
(
allocationRow
.
find
(
'
td:eq(
3
)
'
)
.
find
(
'
td:eq(
4
)
'
)
.
text
()
.
includes
(
server
.
db
.
jobs
.
find
(
allocation
.
jobId
).
name
),
'
Job name
'
);
assert
.
ok
(
allocationRow
.
find
(
'
td:eq(
3
) .is-faded
'
)
.
find
(
'
td:eq(
4
) .is-faded
'
)
.
text
()
.
includes
(
allocation
.
taskGroup
),
'
Task group name
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
4
)
'
)
.
find
(
'
td:eq(
5
)
'
)
.
text
()
.
trim
(),
allocStats
.
resourceUsage
.
CpuStats
.
Percent
,
'
CPU %
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
4
) .tooltip
'
).
attr
(
'
aria-label
'
),
allocationRow
.
find
(
'
td:eq(
5
) .tooltip
'
).
attr
(
'
aria-label
'
),
`
${
Math
.
floor
(
allocStats
.
resourceUsage
.
CpuStats
.
TotalTicks
)}
/
${
cpuUsed
}
MHz`
,
'
Detailed CPU information is in a tooltip
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
5
)
'
)
.
find
(
'
td:eq(
6
)
'
)
.
text
()
.
trim
(),
allocStats
.
resourceUsage
.
MemoryStats
.
RSS
/
1024
/
1024
/
memoryUsed
,
'
Memory used
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
5
) .tooltip
'
).
attr
(
'
aria-label
'
),
allocationRow
.
find
(
'
td:eq(
6
) .tooltip
'
).
attr
(
'
aria-label
'
),
`
${
formatBytes
([
allocStats
.
resourceUsage
.
MemoryStats
.
RSS
])}
/
${
memoryUsed
}
MiB`
,
'
Detailed memory information is in a tooltip
'
);
...
...
@@ -209,14 +217,14 @@ test('each allocation should show job information even if the job is incomplete
assert
.
ok
(
allocationRow
.
find
(
'
td:eq(
3
)
'
)
.
find
(
'
td:eq(
4
)
'
)
.
text
()
.
includes
(
server
.
db
.
jobs
.
find
(
allocation
.
jobId
).
name
),
'
Job name
'
);
assert
.
ok
(
allocationRow
.
find
(
'
td:eq(
3
) .is-faded
'
)
.
find
(
'
td:eq(
4
) .is-faded
'
)
.
text
()
.
includes
(
allocation
.
taskGroup
),
'
Task group name
'
...
...
@@ -252,7 +260,7 @@ test('each allocation should link to the job the allocation belongs to', functio
const
job
=
server
.
db
.
jobs
.
find
(
allocation
.
jobId
);
andThen
(()
=>
{
click
(
$
(
'
.allocations tbody tr:eq(0) td:eq(
3
) a
'
).
get
(
0
));
click
(
$
(
'
.allocations tbody tr:eq(0) td:eq(
4
) a
'
).
get
(
0
));
});
andThen
(()
=>
{
...
...
This diff is collapsed.
Click to expand it.
ui/tests/acceptance/task-group-detail-test.js
+
48
-
38
View file @
9da139e8
...
...
@@ -140,43 +140,53 @@ test('/jobs/:id/:task-group should list one page of allocations for the task gro
});
test
(
'
each allocation should show basic information about the allocation
'
,
function
(
assert
)
{
const
allocation
=
allocations
.
sortBy
(
'
name
'
)[
0
];
const
allocation
=
allocations
.
sortBy
(
'
modifyIndex
'
).
reverse
(
)[
0
];
const
allocationRow
=
$
(
findAll
(
'
.allocations tbody tr
'
)[
0
]);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(0)
'
)
.
text
()
.
trim
(),
allocation
.
id
.
split
(
'
-
'
)[
0
],
'
Allocation short id
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(1)
'
)
.
text
()
.
trim
(),
allocation
.
name
,
'
Allocation name
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(2)
'
)
.
text
()
.
trim
(),
allocation
.
clientStatus
,
'
Client status
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(3)
'
)
.
text
()
.
trim
(),
server
.
db
.
nodes
.
find
(
allocation
.
nodeId
).
id
.
split
(
'
-
'
)[
0
],
'
Node ID
'
);
andThen
(()
=>
{
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(0)
'
)
.
text
()
.
trim
(),
allocation
.
id
.
split
(
'
-
'
)[
0
],
'
Allocation short id
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(1)
'
)
.
text
()
.
trim
(),
allocation
.
modifyIndex
,
'
Allocation modify index
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(2)
'
)
.
text
()
.
trim
(),
allocation
.
name
,
'
Allocation name
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(3)
'
)
.
text
()
.
trim
(),
allocation
.
clientStatus
,
'
Client status
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(4)
'
)
.
text
()
.
trim
(),
server
.
db
.
nodes
.
find
(
allocation
.
nodeId
).
id
.
split
(
'
-
'
)[
0
],
'
Node ID
'
);
});
click
(
allocationRow
.
find
(
'
td:eq(
3
) a
'
).
get
(
0
));
click
(
allocationRow
.
find
(
'
td:eq(
4
) a
'
).
get
(
0
));
andThen
(()
=>
{
assert
.
equal
(
currentURL
(),
`/nodes/
${
allocation
.
nodeId
}
`
,
'
Node links to node page
'
);
...
...
@@ -196,7 +206,7 @@ test('each allocation should show stats about the allocation, retrieved directly
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
4
)
'
)
.
find
(
'
td:eq(
5
)
'
)
.
text
()
.
trim
(),
allocStats
.
resourceUsage
.
CpuStats
.
Percent
,
...
...
@@ -204,14 +214,14 @@ test('each allocation should show stats about the allocation, retrieved directly
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
4
) .tooltip
'
).
attr
(
'
aria-label
'
),
allocationRow
.
find
(
'
td:eq(
5
) .tooltip
'
).
attr
(
'
aria-label
'
),
`
${
Math
.
floor
(
allocStats
.
resourceUsage
.
CpuStats
.
TotalTicks
)}
/
${
cpuUsed
}
MHz`
,
'
Detailed CPU information is in a tooltip
'
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
5
)
'
)
.
find
(
'
td:eq(
6
)
'
)
.
text
()
.
trim
(),
allocStats
.
resourceUsage
.
MemoryStats
.
RSS
/
1024
/
1024
/
memoryUsed
,
...
...
@@ -219,7 +229,7 @@ test('each allocation should show stats about the allocation, retrieved directly
);
assert
.
equal
(
allocationRow
.
find
(
'
td:eq(
5
) .tooltip
'
).
attr
(
'
aria-label
'
),
allocationRow
.
find
(
'
td:eq(
6
) .tooltip
'
).
attr
(
'
aria-label
'
),
`
${
formatBytes
([
allocStats
.
resourceUsage
.
MemoryStats
.
RSS
])}
/
${
memoryUsed
}
MiB`
,
'
Detailed memory information is in a tooltip
'
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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