diff options
author | Svyatoslav Ilinskiy <ilinskiy.sv@gmail.com> | 2017-12-02 18:36:31 -0600 |
---|---|---|
committer | Svyatoslav Ilinskiy <ilinskiy.sv@gmail.com> | 2017-12-02 18:37:21 -0600 |
commit | be0b9026317eab47dc0c9a67a2d77105c7330c2a (patch) | |
tree | 16194ee5bc9f1532a2e986807574faf180666567 /tests/acceptance/cli_test.py | |
parent | 5924c6366e7351299c3541279508a32fae3bbdfe (diff) |
Add ability to list and filter services in `ps`
Also, rename --filter "option=..." to --filter "key=..."
Signed-off-by: Svyatoslav Ilinskiy <ilinskiy.sv@gmail.com>
Diffstat (limited to 'tests/acceptance/cli_test.py')
-rw-r--r-- | tests/acceptance/cli_test.py | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index a4c19afc..d15d5c5f 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -440,32 +440,6 @@ class CLITestCase(DockerClientTestCase): }, } - def test_config_services_filter_option(self): - self.base_dir = 'tests/fixtures/config-services-filter' - image = self.dispatch(['config', '--services', '--filter', 'option=image']) - build = self.dispatch(['config', '--services', '--filter', 'option=build']) - - self.assertIn('with_build', build.stdout) - self.assertNotIn('with_build', image.stdout) - self.assertIn('with_image', image.stdout) - self.assertNotIn('with_image', build.stdout) - - def test_config_services_filter_status(self): - self.base_dir = 'tests/fixtures/config-services-filter' - self.dispatch(['up', '-d']) - self.dispatch(['pause', 'with_image']) - paused = self.dispatch(['config', '--services', '--filter', 'status=paused']) - stopped = self.dispatch(['config', '--services', '--filter', 'status=stopped']) - running = self.dispatch(['config', '--services', '--filter', 'status=running', - '--filter', 'option=build']) - - self.assertNotIn('with_build', stopped.stdout) - self.assertNotIn('with_image', stopped.stdout) - self.assertNotIn('with_build', paused.stdout) - self.assertIn('with_image', paused.stdout) - self.assertIn('with_build', running.stdout) - self.assertNotIn('with_image', running.stdout) - def test_ps(self): self.project.get_service('simple').create_container() result = self.dispatch(['ps']) @@ -493,6 +467,35 @@ class CLITestCase(DockerClientTestCase): self.assertNotIn('multiplecomposefiles_another_1', result.stdout) self.assertIn('multiplecomposefiles_yetanother_1', result.stdout) + def test_ps_services_filter_option(self): + self.base_dir = 'tests/fixtures/ps-services-filter' + image = self.dispatch(['ps', '--services', '--filter', 'key=image']) + build = self.dispatch(['ps', '--services', '--filter', 'key=build']) + all_services = self.dispatch(['ps', '--services']) + + self.assertIn('with_build', all_services.stdout) + self.assertIn('with_image', all_services.stdout) + self.assertIn('with_build', build.stdout) + self.assertNotIn('with_build', image.stdout) + self.assertIn('with_image', image.stdout) + self.assertNotIn('with_image', build.stdout) + + def test_ps_services_filter_status(self): + self.base_dir = 'tests/fixtures/ps-services-filter' + self.dispatch(['up', '-d']) + self.dispatch(['pause', 'with_image']) + paused = self.dispatch(['ps', '--services', '--filter', 'status=paused']) + stopped = self.dispatch(['ps', '--services', '--filter', 'status=stopped']) + running = self.dispatch(['ps', '--services', '--filter', 'status=running', + '--filter', 'key=build']) + + self.assertNotIn('with_build', stopped.stdout) + self.assertNotIn('with_image', stopped.stdout) + self.assertNotIn('with_build', paused.stdout) + self.assertIn('with_image', paused.stdout) + self.assertIn('with_build', running.stdout) + self.assertNotIn('with_image', running.stdout) + def test_pull(self): result = self.dispatch(['pull']) assert sorted(result.stderr.split('\n'))[1:] == [ |