Skip to content

Commit 5c03371

Browse files
yuting-liuKostyaSha
authored andcommitted
Add the unit test for blkioStats
1 parent 3567fab commit 5c03371

2 files changed

Lines changed: 68 additions & 18 deletions

File tree

src/test/java/com/github/dockerjava/api/model/StatisticsTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ public void serderJson1() throws IOException {
8787
assertThat(blkioStats.getIoServiceBytesRecursive().size(), is(2));
8888
assertThat(blkioStats.getIoServiceBytesRecursive().get(0).getValue(), is(26214L));
8989
assertThat(blkioStats.getIoServicedRecursive().size(), is(2));
90+
assertThat(blkioStats.getIoServiceBytesRecursive(), equalTo(Arrays.asList(
91+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Read").withValue(823296L),
92+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Write").withValue(122880L),
93+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Sync").withValue(835584L),
94+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Async").withValue(110592L),
95+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Total").withValue(946176L)
96+
)));
97+
assertThat(blkioStats.getIoServicedRecursive(), equalTo(Arrays.asList(
98+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Read").withValue(145L),
99+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Write").withValue(4L),
100+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Sync").withValue(148L),
101+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Async").withValue(1L),
102+
new BlkioStatEntry().withMajor(259L).withMinor(0L).withOp("Total").withValue(149L)
103+
)));
90104
assertThat(blkioStats.getIoQueueRecursive(), is(empty()));
91105
assertThat(blkioStats.getIoServiceTimeRecursive(), is(empty()));
92106
assertThat(blkioStats.getIoWaitTimeRecursive(), is(empty()));

src/test/resources/samples/1.27/containers/container/stats/stats1.json

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,68 @@
55
"current":2
66
},
77
"blkio_stats":{
8-
"io_service_bytes_recursive": [
8+
"io_service_bytes_recursive":[
99
{
10-
"major": 8,
11-
"minor": "0",
12-
"op": "Read",
13-
"value": 26214
10+
"major":259,
11+
"minor":0,
12+
"op":"Read",
13+
"value":823296
1414
},
1515
{
16-
"major": 8,
17-
"minor": "0",
18-
"op": "Write",
19-
"value": 26214
16+
"major":259,
17+
"minor":0,
18+
"op":"Write",
19+
"value":122880
20+
},
21+
{
22+
"major":259,
23+
"minor":0,
24+
"op":"Sync",
25+
"value":835584
26+
},
27+
{
28+
"major":259,
29+
"minor":0,
30+
"op":"Async",
31+
"value":110592
32+
},
33+
{
34+
"major":259,
35+
"minor":0,
36+
"op":"Total",
37+
"value":946176
2038
}
2139
],
22-
"io_serviced_recursive": [
40+
"io_serviced_recursive":[
41+
{
42+
"major":259,
43+
"minor":0,
44+
"op":"Read",
45+
"value":145
46+
},
47+
{
48+
"major":259,
49+
"minor":0,
50+
"op":"Write",
51+
"value":4
52+
},
53+
{
54+
"major":259,
55+
"minor":0,
56+
"op":"Sync",
57+
"value":148
58+
},
2359
{
24-
"major": 8,
25-
"minor": 0,
26-
"op": "Read",
27-
"value": 41771
60+
"major":259,
61+
"minor":0,
62+
"op":"Async",
63+
"value":1
2864
},
2965
{
30-
"major": 8,
31-
"minor": 0,
32-
"op": "Write",
33-
"value": 72796
66+
"major":259,
67+
"minor":0,
68+
"op":"Total",
69+
"value":149
3470
}
3571
],
3672
"io_queue_recursive":[

0 commit comments

Comments
 (0)