@@ -273,11 +273,14 @@ def test_valid_log_driver_and_log_opt(self):
273
273
274
274
def test_invalid_log_driver_raises_exception (self ):
275
275
log_config = docker .types .LogConfig (
276
- type = 'asdf-nope ' ,
276
+ type = 'asdf' ,
277
277
config = {}
278
278
)
279
279
280
- expected_msg = "logger: no log driver named 'asdf-nope' is registered"
280
+ expected_msgs = [
281
+ "logger: no log driver named 'asdf' is registered" ,
282
+ "looking up logging plugin asdf: plugin \" asdf\" not found" ,
283
+ ]
281
284
with pytest .raises (docker .errors .APIError ) as excinfo :
282
285
# raises an internal server error 500
283
286
container = self .client .create_container (
@@ -287,7 +290,7 @@ def test_invalid_log_driver_raises_exception(self):
287
290
)
288
291
self .client .start (container )
289
292
290
- assert excinfo .value .explanation == expected_msg
293
+ assert excinfo .value .explanation in expected_msgs
291
294
292
295
def test_valid_no_log_driver_specified (self ):
293
296
log_config = docker .types .LogConfig (
@@ -1102,6 +1105,8 @@ def test_port(self):
1102
1105
1103
1106
1104
1107
class ContainerTopTest (BaseAPIIntegrationTest ):
1108
+ @pytest .mark .xfail (reason = 'Output of docker top depends on host distro, '
1109
+ 'and is not formalized.' )
1105
1110
def test_top (self ):
1106
1111
container = self .client .create_container (
1107
1112
TEST_IMG , ['sleep' , '60' ]
@@ -1112,28 +1117,25 @@ def test_top(self):
1112
1117
self .client .start (container )
1113
1118
res = self .client .top (container )
1114
1119
if not IS_WINDOWS_PLATFORM :
1115
- assert res ['Titles' ] == [
1116
- 'UID' , 'PID' , 'PPID' , 'C' , 'STIME' , 'TTY' , 'TIME' , 'CMD'
1117
- ]
1120
+ assert res ['Titles' ] == [u'PID' , u'USER' , u'TIME' , u'COMMAND' ]
1118
1121
assert len (res ['Processes' ]) == 1
1119
1122
assert res ['Processes' ][0 ][- 1 ] == 'sleep 60'
1120
1123
self .client .kill (container )
1121
1124
1122
1125
@pytest .mark .skipif (
1123
1126
IS_WINDOWS_PLATFORM , reason = 'No psargs support on windows'
1124
1127
)
1128
+ @pytest .mark .xfail (reason = 'Output of docker top depends on host distro, '
1129
+ 'and is not formalized.' )
1125
1130
def test_top_with_psargs (self ):
1126
1131
container = self .client .create_container (
1127
1132
TEST_IMG , ['sleep' , '60' ])
1128
1133
1129
1134
self .tmp_containers .append (container )
1130
1135
1131
1136
self .client .start (container )
1132
- res = self .client .top (container , 'waux' )
1133
- assert res ['Titles' ] == [
1134
- 'USER' , 'PID' , '%CPU' , '%MEM' , 'VSZ' , 'RSS' ,
1135
- 'TTY' , 'STAT' , 'START' , 'TIME' , 'COMMAND'
1136
- ]
1137
+ res = self .client .top (container , '-eopid,user' )
1138
+ assert res ['Titles' ] == [u'PID' , u'USER' ]
1137
1139
assert len (res ['Processes' ]) == 1
1138
1140
assert res ['Processes' ][0 ][10 ] == 'sleep 60'
1139
1141
0 commit comments