Пример #1
0
        public void Should_Fail_Deleting_Network_When_Server_Is_Attached()
        {
            var provider = new CloudNetworksProvider(_testIdentity);

            try
            {
                provider.DeleteNetwork(_created_network_id2);
                Assert.Fail("Network should not be deletable if a server exists in it");
            }
            catch (Exception ex)
            {
                Assert.AreEqual(ex.GetType(), typeof(net.openstack.Core.Exceptions.UserAuthorizationException), "Expected UserAuthorizationException was not thrown when deleting network");
            }
        }
Пример #2
0
        public void CleanupTestNetworks()
        {
            INetworksProvider          provider = new CloudNetworksProvider(Bootstrapper.Settings.TestIdentity);
            IEnumerable <CloudNetwork> networks = provider.ListNetworks();

            Assert.IsNotNull(networks);

            foreach (CloudNetwork network in networks)
            {
                Assert.IsNotNull(network);
                if (!network.Label.StartsWith(UnitTestNetworkPrefix))
                {
                    continue;
                }

                Console.WriteLine("Removing network... {0}: {1}", network.Id, network.Label);
                provider.DeleteNetwork(network.Id);
            }
        }
Пример #3
0
        public void CleanupServers()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var srvs     = provider.ListServers();

            foreach (var svr in srvs.Where(s => s.Name == "net-sdk-test-server"))
            {
                provider.DeleteServer(svr.Id);
            }


            var networkProvider = new CloudNetworksProvider(_testIdentity);
            var networks        = networkProvider.ListNetworks();

            foreach (var network in networks.Where(n => n.Label == "net-sdk-test-network" || n.Label == "net-sdk-test-network-for-server"))
            {
                networkProvider.DeleteNetwork(network.Id);
            }
        }
Пример #4
0
        public void Should_Delete_Newly_Created_Network()
        {
            var provider = new CloudNetworksProvider(_testIdentity);

            Assert.IsTrue(provider.DeleteNetwork(_created_network_id));
        }
Пример #5
0
        public void Should_Delete_Network_After_Server_Deleted()
        {
            var provider = new CloudNetworksProvider(_testIdentity);

            Assert.IsTrue(provider.DeleteNetwork(_created_network_id2));
        }