Skip to content

Commit

Permalink
Bring system tests back to "full" coverage by testing update().
Browse files Browse the repository at this point in the history
We still don't test cluster.undelete() and don't explicitly
test cluster.delete() but it is used throughout (and a failure
would cause many tests to fail).
  • Loading branch information
dhermes committed Jul 28, 2015
1 parent a4c15a9 commit 6c0ae72
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions system_tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,29 @@ def test_create_cluster(self):
self.assertEqual(cluster, cluster_alt)
self.assertEqual(cluster.display_name, cluster_alt.display_name)
self.assertEqual(cluster.serve_nodes, cluster_alt.serve_nodes)

def test_update(self):
curr_display_name = self._cluster.display_name
self._cluster.display_name = 'Foo Bar Baz'
self._cluster.update()

# We want to make sure the operation completes.
time.sleep(2)
self.assertTrue(self._cluster.operation_finished())

# Create a new cluster instance and make sure it is the same.
cluster_alt = CLIENT.cluster(TEST_ZONE, TEST_CLUSTER_ID)
self.assertNotEqual(cluster_alt.display_name,
self._cluster.display_name)
cluster_alt.reload()
self.assertEqual(cluster_alt.display_name,
self._cluster.display_name)

# Make sure to put the cluster back the way it was for the
# other test cases.
self._cluster.display_name = curr_display_name
self._cluster.update()

# We want to make sure the operation completes.
time.sleep(2)
self.assertTrue(self._cluster.operation_finished())

0 comments on commit 6c0ae72

Please sign in to comment.