From 7f06d468271c5e8aad6a280621455e407894219d Mon Sep 17 00:00:00 2001 From: Mark Steve Samson Date: Sun, 20 Jul 2014 16:27:05 +0800 Subject: [PATCH] Add test for building with --no-cache Signed-off-by: Mark Steve Samson --- tests/fixtures/simple-dockerfile/fig.yml | 2 ++ tests/integration/cli_test.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/fixtures/simple-dockerfile/fig.yml diff --git a/tests/fixtures/simple-dockerfile/fig.yml b/tests/fixtures/simple-dockerfile/fig.yml new file mode 100644 index 000000000..a3f56d46f --- /dev/null +++ b/tests/fixtures/simple-dockerfile/fig.yml @@ -0,0 +1,2 @@ +simple: + build: tests/fixtures/simple-dockerfile diff --git a/tests/integration/cli_test.py b/tests/integration/cli_test.py index 92aed85fc..9ab21b446 100644 --- a/tests/integration/cli_test.py +++ b/tests/integration/cli_test.py @@ -46,6 +46,18 @@ class CLITestCase(DockerClientTestCase): self.assertNotIn('multiplefigfiles_another_1', output) self.assertIn('multiplefigfiles_yetanother_1', output) + @patch('sys.stdout', new_callable=StringIO) + def test_build_no_cache(self, mock_stdout): + self.command.base_dir = 'tests/fixtures/simple-dockerfile' + self.command.dispatch(['build', 'simple'], None) + mock_stdout.truncate(0) + cache_indicator = 'Using cache' + self.command.dispatch(['build', 'simple'], None) + self.assertIn(cache_indicator, output) + mock_stdout.truncate(0) + self.command.dispatch(['build', '--no-cache', 'simple'], None) + self.assertNotIn(cache_indicator, output) + def test_up(self): self.command.dispatch(['up', '-d'], None) service = self.command.project.get_service('simple') @@ -193,3 +205,4 @@ class CLITestCase(DockerClientTestCase): self.command.scale({'SERVICE=NUM': ['simple=0', 'another=0']}) self.assertEqual(len(project.get_service('simple').containers()), 0) self.assertEqual(len(project.get_service('another').containers()), 0) +