diff options
| author | Stephen Newey <stephen.newey@arm.com> | 2015-07-02 13:24:51 +0100 |
|---|---|---|
| committer | Stephen Newey <stephen.newey@arm.com> | 2015-07-02 13:24:51 +0100 |
| commit | 7bbec93f64b36bb055ebbe1a6c40c2ba1ca3b8cf (patch) | |
| tree | ce0f743c8cff57492632b79018603b5ac07fe790 | |
| parent | a12818a8a864846c4bcc7c0d3eab1d8ae038b2d3 (diff) | |
| download | docker-py-7bbec93f64b36bb055ebbe1a6c40c2ba1ca3b8cf.tar.gz | |
Add test for root user as default exec_create behaviour
| -rw-r--r-- | tests/integration_test.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/integration_test.py b/tests/integration_test.py index f0064fa..9ce3e3e 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -847,6 +847,23 @@ class TestExecuteCommandStringAsUser(BaseTestCase): @unittest.skipIf(not EXEC_DRIVER_IS_NATIVE, 'Exec driver not native') +class TestExecuteCommandStringAsRoot(BaseTestCase): + def runTest(self): + container = self.client.create_container('busybox', 'cat', + detach=True, stdin_open=True) + id = container['Id'] + self.client.start(id) + self.tmp_containers.append(id) + + res = self.client.exec_create(id, 'whoami') + self.assertIn('Id', res) + + exec_log = self.client.exec_start(res) + expected = b'root' if six.PY3 else 'root\n' + self.assertEqual(exec_log, expected) + + +@unittest.skipIf(not EXEC_DRIVER_IS_NATIVE, 'Exec driver not native') class TestExecuteCommandStreaming(BaseTestCase): def runTest(self): container = self.client.create_container('busybox', 'cat', |
