diff options
author | Dan Prince <dprince@redhat.com> | 2012-11-12 15:36:32 -0500 |
---|---|---|
committer | Dan Prince <dprince@redhat.com> | 2012-11-12 15:36:32 -0500 |
commit | 6443cfeecb9f7f9ac4ab84de27e2e0c4decf71d6 (patch) | |
tree | d765be7f29c3e65f1cf3f332fbb647fb3c22aec9 /smoketests | |
parent | 2243a9471a26b042f91c7511c8c5fa0af3841866 (diff) | |
download | nova-6443cfeecb9f7f9ac4ab84de27e2e0c4decf71d6.tar.gz |
Update vol mount smoketest to wait for volume.
Updates the test_003_can_mount_volume smoke test so that it
waits for the volume to show up in /proc/partitions for up
to 60 seconds before proceeding. This eliminates the need for
a hard coded sleep value which can cause intermittent test failures.
Change-Id: Ibdc56a00e141211e40068c22fc268efeba6affff
Diffstat (limited to 'smoketests')
-rw-r--r-- | smoketests/test_sysadmin.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/smoketests/test_sysadmin.py b/smoketests/test_sysadmin.py index d6491c9d4b..b05f0ac4ba 100644 --- a/smoketests/test_sysadmin.py +++ b/smoketests/test_sysadmin.py @@ -249,12 +249,24 @@ class VolumeTests(base.UserSmokeTestCase): self.assertTrue(volume.status.startswith('in-use')) - # Give instance time to recognize volume. - time.sleep(5) - def test_003_can_mount_volume(self): ip = self.data['instance'].private_ip_address conn = self.connect_ssh(ip, TEST_KEY) + + # NOTE(dprince): give some time for volume to show up in partitions + stdin, stdout, stderr = conn.exec_command( + 'COUNT="0";' + 'until cat /proc/partitions | grep "%s\\$"; do ' + '[ "$COUNT" -eq "60" ] && exit 1;' + 'COUNT=$(( $COUNT + 1 ));' + 'sleep 1; ' + 'done' + % self.device.rpartition('/')[2]) + out = stdout.read() + if not out.strip().endswith(self.device.rpartition('/')[2]): + self.fail('Timeout waiting for volume partition in instance. %s %s' + % (out, stderr.read())) + # NOTE(vish): this will create a dev for images that don't have # udev rules stdin, stdout, stderr = conn.exec_command( |