From 0f42220c6e0c74e122c87644b54fcc77b2822c66 Mon Sep 17 00:00:00 2001 From: Jerjou Cheng Date: Thu, 22 Oct 2015 10:12:45 -0700 Subject: [PATCH] Make create_instance_test fail on bad output. --- compute/api/create_instance_test.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/compute/api/create_instance_test.py b/compute/api/create_instance_test.py index 226fef355a4..1374d821b9d 100644 --- a/compute/api/create_instance_test.py +++ b/compute/api/create_instance_test.py @@ -11,6 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import re + from nose.plugins.attrib import attr import tests @@ -21,10 +23,20 @@ class TestComputeGettingStarted(tests.CloudBaseTest): def test_main(self): - with tests.capture_stdout(): + with tests.capture_stdout() as mock_stdout: main( self.project_id, self.bucket_name, 'us-central1-f', 'test-instance', wait=False) + + stdout = mock_stdout.getvalue() + + expected_output = re.compile( + (r'Instances in project %s and zone us-central1-.* - test-instance' + r'.*Deleting instance.*done..$') % self.project_id, + re.DOTALL) + self.assertRegexpMatches( + stdout, + expected_output)