public void DisassociateFloatingIPFromServer() { var compute = new ComputeService(Stubs.AuthenticationProvider, "region"); using (var httpTest = new HttpTest()) { Identifier serverId = Guid.NewGuid(); const string ip = "10.0.0.1"; httpTest.RespondWithJson(new Server { Id = serverId, Addresses = { ["network1"] = new List <ServerAddress> { new ServerAddress { IP = ip, Type = AddressType.Floating } } } }); httpTest.RespondWith((int)HttpStatusCode.OK, "ip disassociated!"); var server = compute.GetServer(serverId); server.DisassociateFloatingIP(ip); Assert.Null(server.Addresses["network1"].FirstOrDefault(a => a.IP == ip && a.Type == AddressType.Floating)); } }
public async Task EvacuateServer() { using (var httpTest = new HttpTest()) { Identifier serverId = Guid.NewGuid(); httpTest.RespondWithJson(new Server { Id = serverId }); httpTest.RespondWith((int)HttpStatusCode.Accepted, "Roger that, boss"); var server = _compute.GetServer(serverId); await server.EvacuateAsync(new EvacuateServerRequest(false)); httpTest.ShouldHaveCalled($"*/servers/{serverId}/action"); string lastRequest = httpTest.CallLog.Last().RequestBody; Assert.True(lastRequest.Contains("evacuate")); } }
public void DisassociateFloatingIPFromServer() { var compute = new ComputeService(Stubs.AuthenticationProvider, "region"); using (var httpTest = new HttpTest()) { Identifier serverId = Guid.NewGuid(); const string ip = "10.0.0.1"; httpTest.RespondWithJson(new Server { Id = serverId, Addresses = { ["network1"] = new List<ServerAddress> { new ServerAddress {IP = ip, Type = AddressType.Floating} } } }); httpTest.RespondWith((int)HttpStatusCode.OK, "ip disassociated!"); var server = compute.GetServer(serverId); server.DisassociateFloatingIP(ip); Assert.Null(server.Addresses["network1"].FirstOrDefault(a => a.IP == ip && a.Type == AddressType.Floating)); } }