public void TestRevertServerResize() { IComputeProvider provider = Bootstrapper.CreateComputeProvider(); string serverName = UserComputeTests.UnitTestServerPrefix + Path.GetRandomFileName(); Flavor flavor = UserComputeTests.ListAllFlavorsWithDetails(provider).OrderBy(i => i.RAMInMB).ThenBy(i => i.DiskSizeInGB).FirstOrDefault(i => !i.Id.Equals(_server.Flavor.Id, StringComparison.OrdinalIgnoreCase)); if (flavor == null) { Assert.Inconclusive("Couldn't find a flavor to use for the test server."); } bool resized = provider.ResizeServer(_server.Id, serverName, flavor.Id); Assert.IsTrue(resized); Server resizedServer = provider.WaitForServerState(_server.Id, ServerState.VerifyResize, new[] { ServerState.Active, ServerState.Error, ServerState.Unknown, ServerState.Suspended }); Assert.AreEqual(ServerState.VerifyResize, resizedServer.Status); _server = resizedServer; bool reverted = provider.RevertServerResize(resizedServer.Id); Assert.IsTrue(reverted); Server revertedServer = provider.WaitForServerActive(_server.Id); Assert.AreEqual(ServerState.Active, revertedServer.Status); _server = revertedServer; }
public void TestRescueServer() { IComputeProvider provider = Bootstrapper.CreateComputeProvider(); string rescueResult = provider.RescueServer(_server.Id); Assert.IsFalse(string.IsNullOrEmpty(rescueResult)); Server rescueServer = provider.WaitForServerState(_server.Id, ServerState.Rescue, new[] { ServerState.Active, ServerState.Error, ServerState.Unknown, ServerState.Suspended }); Assert.AreEqual(ServerState.Rescue, rescueServer.Status); bool unrescueResult = provider.UnRescueServer(_server.Id); Assert.IsTrue(unrescueResult); Server unrescueServer = provider.WaitForServerActive(_server.Id); Assert.AreEqual(ServerState.Active, unrescueServer.Status); }