public void TestShowVolume() { IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity); IEnumerable <Volume> volumes = provider.ListVolumes(); Assert.IsNotNull(volumes); if (!volumes.Any()) { Assert.Inconclusive("The test could not proceed because the specified account and/or region does not appear to contain any configured volumes."); } foreach (Volume volume in volumes) { Assert.IsNotNull(volume); Assert.IsFalse(string.IsNullOrEmpty(volume.Id)); Volume showVolume = provider.ShowVolume(volume.Id); Assert.IsNotNull(showVolume); Assert.AreEqual(volume.AvailabilityZone, showVolume.AvailabilityZone); Assert.AreEqual(volume.CreatedAt, showVolume.CreatedAt); Assert.AreEqual(volume.DisplayDescription, showVolume.DisplayDescription); Assert.AreEqual(volume.DisplayName, showVolume.DisplayName); Assert.AreEqual(volume.Id, showVolume.Id); Assert.AreEqual(volume.Size, showVolume.Size); Assert.AreEqual(volume.SnapshotId, showVolume.SnapshotId); Assert.IsNotNull(volume.Status); Assert.AreEqual(volume.VolumeType, showVolume.VolumeType); } }
public void Should_Delete_Test_Volume() { var provider = new CloudBlockStorageProvider(); var volumeListResponse = provider.ListVolumes(identity: _testIdentity); if (volumeListResponse != null && volumeListResponse.Any()) { var testVolume = volumeListResponse.FirstOrDefault(x => x.DisplayName == volumeDisplayName); if (testVolume == null) { Assert.Fail("Could not find test volume to delete."); } var deleteVolumeResult = provider.DeleteVolume(testVolume.Id, identity: _testIdentity); if (deleteVolumeResult) { var volumeWaitForDeletedResult = provider.WaitForVolumeDeleted(testVolume.Id, identity: _testIdentity); Assert.IsTrue(volumeWaitForDeletedResult); } else { Assert.Fail("Test volume was not deleted."); } } else { Assert.Fail("No volumes present to test delete."); } }
public void Should_Return_Volume_List() { var provider = new CloudBlockStorageProvider(); var volumeListResponse = provider.ListVolumes(identity: _testIdentity); Assert.IsNotNull(volumeListResponse); Assert.IsTrue(volumeListResponse.Any()); }
public void Should_Cleanup_CloudBlockStorage_Environment() { var provider = new CloudBlockStorageProvider(); var volumeListResponse = provider.ListVolumes(identity: _testIdentity); if (volumeListResponse == null || !volumeListResponse.Any()) { return; } var testVolumeList = volumeListResponse.Where(x => x.DisplayName == volumeDisplayName); if (!testVolumeList.Any()) { return; } var snapshotList = provider.ListSnapshots(identity: _testIdentity); if (snapshotList != null && snapshotList.Any()) { foreach (var testVolume in testVolumeList) { var testVolumeSnapshots = snapshotList.Where(x => x.VolumeId == testVolume.Id); if (testVolumeSnapshots.Any()) { foreach (var testSnapshot in testVolumeSnapshots) { var deleteSnapshotResult = provider.DeleteSnapshot(testSnapshot.Id, identity: _testIdentity); if (deleteSnapshotResult) { var snapshotDeleteDetails = provider.WaitForSnapshotDeleted(testSnapshot.Id, identity: _testIdentity); Assert.IsTrue(snapshotDeleteDetails); } else { Assert.Fail(string.Format("Snapshot (Volume ID: {0} -- Snapshot ID:{1}) could not be deleted.", testVolume.Id, testSnapshot.Id)); } } } } } foreach (var testVolume in testVolumeList) { var deleteVolumeResults = provider.DeleteVolume(testVolume.Id, identity: _testIdentity); Assert.IsTrue(deleteVolumeResults); var volumeWaitForDeletedResult = provider.WaitForVolumeDeleted(testVolume.Id, identity: _testIdentity); Assert.IsTrue(volumeWaitForDeletedResult); } }
public void CleanupTestVolumes() { IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity); IEnumerable<Volume> volumes = provider.ListVolumes(); foreach (Volume volume in volumes) { if (string.IsNullOrEmpty(volume.DisplayName)) continue; if (!volume.DisplayName.StartsWith(UnitTestVolumePrefix)) continue; Console.WriteLine("Deleting unit test volume... {0} ({1})", volume.DisplayName, volume.Id); provider.DeleteVolume(volume.Id); } }
public void TestListVolumes() { IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity); IEnumerable<Volume> volumes = provider.ListVolumes(); Assert.IsNotNull(volumes); if (!volumes.Any()) Assert.Inconclusive("The test could not proceed because the specified account and/or region does not appear to contain any configured volumes."); Console.WriteLine("Volumes"); foreach (Volume volume in volumes) { Assert.IsNotNull(volume); Assert.IsFalse(string.IsNullOrEmpty(volume.Id)); Console.WriteLine(JsonConvert.SerializeObject(volume, Formatting.Indented)); } }
public void TestListVolumes() { IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity); IEnumerable <Volume> volumes = provider.ListVolumes(); Assert.IsNotNull(volumes); if (!volumes.Any()) { Assert.Inconclusive("The test could not proceed because the specified account and/or region does not appear to contain any configured volumes."); } Console.WriteLine("Volumes"); foreach (Volume volume in volumes) { Assert.IsNotNull(volume); Assert.IsFalse(string.IsNullOrEmpty(volume.Id)); Console.WriteLine(JsonConvert.SerializeObject(volume, Formatting.Indented)); } }
public void Should_Create_Snapshot_Only_Required_Parameters() { var provider = new CloudBlockStorageProvider(); var volumeListResponse = provider.ListVolumes(identity: _testIdentity); if (volumeListResponse != null && volumeListResponse.Any()) { var testVolume = volumeListResponse.FirstOrDefault(x => x.DisplayName == volumeDisplayName); if (testVolume == null) { Assert.Fail("Could not find test volume to create snapshot."); } var snapshotCreatedResponse = provider.CreateSnapshot(testVolume.Id, identity: _testIdentity); Assert.IsNotNull(snapshotCreatedResponse); } else { Assert.Fail("No volumes present to create a snapshot."); } }
public void CleanupTestVolumes() { IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity); IEnumerable <Volume> volumes = provider.ListVolumes(); foreach (Volume volume in volumes) { if (string.IsNullOrEmpty(volume.DisplayName)) { continue; } if (!volume.DisplayName.StartsWith(UnitTestVolumePrefix)) { continue; } Console.WriteLine("Deleting unit test volume... {0} ({1})", volume.DisplayName, volume.Id); provider.DeleteVolume(volume.Id); } }
public void Should_Return_Test_Volume() { var provider = new CloudBlockStorageProvider(); var volumeListResponse = provider.ListVolumes(identity: _testIdentity); if (volumeListResponse != null && volumeListResponse.Any()) { var testVolume = volumeListResponse.FirstOrDefault(x => x.DisplayName == volumeDisplayName); if (testVolume == null) { Assert.Fail("Could not retrieve test volume."); } var singleVolumeResponse = provider.ShowVolume(testVolume.Id, identity: _testIdentity); Assert.IsNotNull(singleVolumeResponse); Assert.IsTrue(singleVolumeResponse.Id == testVolume.Id); } else { Assert.Fail("No volumes present to query."); } }
public void Should_Wait_Until_Test_Volume_Becomes_Available_Or_Exceeds_Timeout_For_Becoming_Available() { var provider = new CloudBlockStorageProvider(); var volumeListResponse = provider.ListVolumes(identity: _testIdentity); if (volumeListResponse != null && volumeListResponse.Any()) { var testVolume = volumeListResponse.FirstOrDefault(x => x.DisplayName == volumeDisplayName); if (testVolume == null) { Assert.Fail("Could not find test volume to query for Available status."); } var volumeDetails = provider.WaitForVolumeAvailable(testVolume.Id, identity: _testIdentity); Assert.IsNotNull(volumeDetails); Assert.AreEqual(VolumeState.Available, volumeDetails.Status); } else { Assert.Fail("No volumes present to obtain Available status."); } }
public void Should_Cleanup_CloudBlockStorage_Environment() { var provider = new CloudBlockStorageProvider(); var volumeListResponse = provider.ListVolumes(identity: _testIdentity); if (volumeListResponse == null || !volumeListResponse.Any()) return; var testVolumeList = volumeListResponse.Where(x => x.DisplayName == volumeDisplayName); if (!testVolumeList.Any()) return; var snapshotList = provider.ListSnapshots(identity: _testIdentity); if (snapshotList != null && snapshotList.Any()) { foreach (var testVolume in testVolumeList) { var testVolumeSnapshots = snapshotList.Where(x => x.VolumeId == testVolume.Id); if (testVolumeSnapshots.Any()) { foreach (var testSnapshot in testVolumeSnapshots) { var deleteSnapshotResult = provider.DeleteSnapshot(testSnapshot.Id, identity: _testIdentity); if (deleteSnapshotResult) { var snapshotDeleteDetails = provider.WaitForSnapshotDeleted(testSnapshot.Id, identity: _testIdentity); Assert.IsTrue(snapshotDeleteDetails); } else { Assert.Fail(string.Format("Snapshot (Volume ID: {0} -- Snapshot ID:{1}) could not be deleted.", testVolume.Id, testSnapshot.Id)); } } } } } foreach (var testVolume in testVolumeList) { var deleteVolumeResults = provider.DeleteVolume(testVolume.Id, identity: _testIdentity); Assert.IsTrue(deleteVolumeResults); var volumeWaitForDeletedResult = provider.WaitForVolumeDeleted(testVolume.Id, identity: _testIdentity); Assert.IsTrue(volumeWaitForDeletedResult); } }
public void Should_Create_Snapshot_Full_Parameters() { var provider = new CloudBlockStorageProvider(); var volumeListResponse = provider.ListVolumes(identity: _testIdentity); if (volumeListResponse != null && volumeListResponse.Any()) { var testVolume = volumeListResponse.FirstOrDefault(x => x.DisplayName == volumeDisplayName); if (testVolume == null) { Assert.Fail("Could not find test volume to create snapshot."); } var snapshotCreatedResponse = provider.CreateSnapshot(testVolume.Id, true, snapshotDisplayName, snapshotDisplayDescription, identity: _testIdentity); Assert.IsNotNull(snapshotCreatedResponse); } else { Assert.Fail("No volumes present to create a snapshot."); } }
public void TestShowVolume() { IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity); IEnumerable<Volume> volumes = provider.ListVolumes(); Assert.IsNotNull(volumes); if (!volumes.Any()) Assert.Inconclusive("The test could not proceed because the specified account and/or region does not appear to contain any configured volumes."); foreach (Volume volume in volumes) { Assert.IsNotNull(volume); Assert.IsFalse(string.IsNullOrEmpty(volume.Id)); Volume showVolume = provider.ShowVolume(volume.Id); Assert.IsNotNull(showVolume); Assert.AreEqual(volume.AvailabilityZone, showVolume.AvailabilityZone); Assert.AreEqual(volume.CreatedAt, showVolume.CreatedAt); Assert.AreEqual(volume.DisplayDescription, showVolume.DisplayDescription); Assert.AreEqual(volume.DisplayName, showVolume.DisplayName); Assert.AreEqual(volume.Id, showVolume.Id); Assert.AreEqual(volume.Size, showVolume.Size); Assert.AreEqual(volume.SnapshotId, showVolume.SnapshotId); Assert.IsNotNull(volume.Status); Assert.AreEqual(volume.VolumeType, showVolume.VolumeType); } }