public void TestRebuildServer()
        {
            IComputeProvider provider = Bootstrapper.CreateComputeProvider();

            Flavor flavor = UserComputeTests.ListAllFlavorsWithDetails(provider).OrderBy(i => i.RAMInMB).ThenBy(i => i.DiskSizeInGB).FirstOrDefault();

            if (flavor == null)
            {
                Assert.Inconclusive("Couldn't find a flavor to use for the test server.");
            }

            SimpleServerImage[] images = UserComputeTests.ListAllImages(provider).ToArray();
            SimpleServerImage   image  = images.FirstOrDefault(i => i.Name.IndexOf(TestImageNameSubstring, StringComparison.OrdinalIgnoreCase) >= 0);

            if (image == null)
            {
                Assert.Inconclusive(string.Format("Couldn't find the {0} image to use for the test server.", TestImageNameSubstring));
            }

            Server rebuilt = provider.RebuildServer(_server.Id, null, image.Id, flavor.Id, _password);

            Assert.IsNotNull(rebuilt);
            Server rebuiltServer = provider.WaitForServerActive(rebuilt.Id);

            Assert.AreEqual(ServerState.Active, rebuiltServer.Status);
            _server = rebuiltServer;
        }
        public static void Init(TestContext context)
        {
            _testIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestIdentity);
            
            var provider = new CloudServersProvider(_testIdentity);

            _initImage = provider.ListImages(imageName: "CentOS 6.3").First();
            _initFlavor = provider.ListFlavors().OrderBy(f => f.Id).First();
        }
Beispiel #3
0
        public static void Init(TestContext context)
        {
            _testIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestIdentity);

            var provider = new CloudServersProvider(_testIdentity);

            _initImage  = provider.ListImages(imageName: "CentOS 6.3").First();
            _initFlavor = provider.ListFlavors().OrderBy(f => f.Id).First();
        }
        public static void Init(TestContext context)
        {
            _testIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestIdentity);
            
            var provider = new CloudServersProvider(_testIdentity);

            _initImage = provider.ListImages(imageName: "CentOS 6.3").First();
            _initFlavor = provider.ListFlavors().OrderBy(f => f.Id).First();

            var netProvider = new CloudNetworksProvider(_testIdentity);
            var networks = netProvider.ListNetworks();
            _testNetwork = networks.FirstOrDefault(n => !n.Label.Equals("public") && !n.Label.Equals("private"));
        }
Beispiel #5
0
        public static void Init(TestContext context)
        {
            _testIdentity = new RackspaceCloudIdentity(Bootstrapper.Settings.TestIdentity);

            var provider = new CloudServersProvider(_testIdentity);

            _initImage  = provider.ListImages(imageName: "CentOS 6.3").First();
            _initFlavor = provider.ListFlavors().OrderBy(f => f.Id).First();

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

            _testNetwork = networks.FirstOrDefault(n => !n.Label.Equals("public") && !n.Label.Equals("private"));
        }
        protected override void UpdateThis(SimpleServerImage serverImage)
        {
            base.UpdateThis(serverImage);

            var details = serverImage as ServerImage;

            if (details == null)
                return;

            DiskConfig = details.DiskConfig;
            Status = details.Status;
            Created = details.Created;
            Progress = details.Progress;
            Updated = details.Updated;
            MinDisk = details.MinDisk;
            MinRAM = details.MinRAM;
        }
Beispiel #7
0
        public static IEnumerable <SimpleServerImage> ListAllImages(IComputeProvider provider, int?blockSize = null, string server = null, string imageName = null, ImageState imageStatus = null, DateTimeOffset?changesSince = null, ImageType imageType = null, string region = null, CloudIdentity identity = null)
        {
            if (blockSize <= 0)
            {
                throw new ArgumentOutOfRangeException("blockSize");
            }

            SimpleServerImage lastImage = null;

            do
            {
                string marker = lastImage != null ? lastImage.Id : null;
                IEnumerable <SimpleServerImage> images = provider.ListImages(server, imageName, imageStatus, changesSince, marker, blockSize, imageType, region, identity);
                lastImage = null;
                foreach (SimpleServerImage image in images)
                {
                    lastImage = image;
                    yield return(image);
                }
            } while (lastImage != null);
        }
        public static void ClassInitialize(TestContext testContext)
        {
            IComputeProvider provider   = Bootstrapper.CreateComputeProvider();
            string           serverName = UserComputeTests.UnitTestServerPrefix + Path.GetRandomFileName();

            Flavor flavor = UserComputeTests.ListAllFlavorsWithDetails(provider).OrderBy(i => i.RAMInMB).ThenBy(i => i.DiskSizeInGB).FirstOrDefault();

            if (flavor == null)
            {
                Assert.Inconclusive("Couldn't find a flavor to use for the test server.");
            }

            SimpleServerImage[] images = UserComputeTests.ListAllImages(provider).ToArray();
            SimpleServerImage   image  = images.FirstOrDefault(i => i.Name.IndexOf(TestImageNameSubstring, StringComparison.OrdinalIgnoreCase) >= 0);

            if (image == null)
            {
                Assert.Inconclusive(string.Format("Couldn't find the {0} image to use for the test server.", TestImageNameSubstring));
            }

            Stopwatch timer = Stopwatch.StartNew();

            Console.Write("Creating server for image {0}...", image.Name);
            NewServer server = provider.CreateServer(serverName, image.Id, flavor.Id, attachToServiceNetwork: true);

            Assert.IsNotNull(server);
            Assert.IsFalse(string.IsNullOrEmpty(server.Id));

            _password = server.AdminPassword;

            _server = provider.WaitForServerActive(server.Id);
            Assert.IsNotNull(_server);
            Assert.AreEqual(server.Id, _server.Id);
            Assert.AreEqual(ServerState.Active, _server.Status);

            Console.WriteLine("done. {0} seconds", timer.Elapsed.TotalSeconds);
        }
Beispiel #9
0
        /// <inheritdoc/>
        protected override void UpdateThis(SimpleServerImage serverImage)
        {
            if (serverImage == null)
                throw new ArgumentNullException("serverImage");

            base.UpdateThis(serverImage);

            var details = serverImage as ServerImage;

            if (details == null)
                return;

            DiskConfig = details.DiskConfig;
            Status = details.Status;
            Created = details.Created;
            Progress = details.Progress;
            Updated = details.Updated;
            MinDisk = details.MinDisk;
            MinRAM = details.MinRAM;
        }