@@ -273,11 +273,14 @@ def test_valid_log_driver_and_log_opt(self):
273273
274274 def test_invalid_log_driver_raises_exception (self ):
275275 log_config = docker .types .LogConfig (
276- type = 'asdf-nope ' ,
276+ type = 'asdf' ,
277277 config = {}
278278 )
279279
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+ ]
281284 with pytest .raises (docker .errors .APIError ) as excinfo :
282285 # raises an internal server error 500
283286 container = self .client .create_container (
@@ -287,7 +290,7 @@ def test_invalid_log_driver_raises_exception(self):
287290 )
288291 self .client .start (container )
289292
290- assert excinfo .value .explanation == expected_msg
293+ assert excinfo .value .explanation in expected_msgs
291294
292295 def test_valid_no_log_driver_specified (self ):
293296 log_config = docker .types .LogConfig (
@@ -1102,6 +1105,8 @@ def test_port(self):
11021105
11031106
11041107class ContainerTopTest (BaseAPIIntegrationTest ):
1108+ @pytest .mark .xfail (reason = 'Output of docker top depends on host distro, '
1109+ 'and is not formalized.' )
11051110 def test_top (self ):
11061111 container = self .client .create_container (
11071112 TEST_IMG , ['sleep' , '60' ]
@@ -1112,28 +1117,25 @@ def test_top(self):
11121117 self .client .start (container )
11131118 res = self .client .top (container )
11141119 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' ]
11181121 assert len (res ['Processes' ]) == 1
11191122 assert res ['Processes' ][0 ][- 1 ] == 'sleep 60'
11201123 self .client .kill (container )
11211124
11221125 @pytest .mark .skipif (
11231126 IS_WINDOWS_PLATFORM , reason = 'No psargs support on windows'
11241127 )
1128+ @pytest .mark .xfail (reason = 'Output of docker top depends on host distro, '
1129+ 'and is not formalized.' )
11251130 def test_top_with_psargs (self ):
11261131 container = self .client .create_container (
11271132 TEST_IMG , ['sleep' , '60' ])
11281133
11291134 self .tmp_containers .append (container )
11301135
11311136 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' ]
11371139 assert len (res ['Processes' ]) == 1
11381140 assert res ['Processes' ][0 ][10 ] == 'sleep 60'
11391141
0 commit comments