public void TestConfigOnlyFabricUpgradeWithRunAs()
        {
            string currentExecutingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string configurationCsvFilePath  = Path.Combine(currentExecutingDirectory, "Configurations.csv");

            string[]        manifests     = new string[] { "ClusterManifest-WithoutDiagnostics.xml", "ClusterManifest-WithRunAs.xml" };
            FabricVersion[] fabricVersion = new FabricVersion[2];
            for (int i = 0; i < 2; i++)
            {
                using (FabricLayoutInfo fabricLayoutInfo = new FabricLayoutInfo(this.imageStore, manifests[i]))
                {
                    fabricLayoutInfo.PatchVersion = null;

                    string codePath, configPath, infrastructureManifestFilePath;
                    fabricLayoutInfo.Create(out codePath, out configPath, out infrastructureManifestFilePath);
                    fabricVersion[i] = this.imageBuilder.GetFabricVersionInfo(codePath, configPath, TestUtility.ImageStoreDefaultTimeout);

                    this.imageBuilder.ProvisionFabric(
                        codePath,
                        configPath,
                        configurationCsvFilePath,
                        infrastructureManifestFilePath,
                        TimeSpan.MaxValue);

                    TestUtility.VerifyWinFabLayout(fabricLayoutInfo);
                }
            }

            this.imageBuilder.UpgradeFabric(
                fabricVersion[0].ToString(),
                fabricVersion[1].ToString(),
                configurationCsvFilePath,
                TimeSpan.MaxValue);
        }
        public void TestGetFabricVersionInfo()
        {
            using (FabricLayoutInfo fabricLayoutInfo = new FabricLayoutInfo(this.imageStore))
            {
                string codePath, configPath, infrastructureManifestFilePath;

                fabricLayoutInfo.Create(out codePath, out configPath, out infrastructureManifestFilePath);
                FabricVersion fabricVersion = this.imageBuilder.GetFabricVersionInfo(codePath, configPath, TestUtility.ImageStoreDefaultTimeout);

                Verify.AreEqual(fabricVersion.CodeVersion, fabricLayoutInfo.PatchVersion);
                Verify.AreEqual(fabricVersion.ConfigVersion, fabricLayoutInfo.ClusterManifest.Version);
            }
        }
        public void TestFabricUpgradeWithInvalidPath()
        {
            using (FabricLayoutInfo fabricLayoutInfo = new FabricLayoutInfo(this.imageStore))
            {
                fabricLayoutInfo.PatchVersion = null;

                string codePath, configPath, infrastructureManifestFilePath;
                fabricLayoutInfo.Create(out codePath, out configPath, out infrastructureManifestFilePath);

                string directoryName = Path.GetDirectoryName(configPath);

                Verify.Throws <FabricImageBuilderValidationException>(
                    () => this.imageBuilder.GetFabricVersionInfo(codePath, directoryName, TestUtility.ImageStoreDefaultTimeout));
            }
        }
        public void TestProvisionFabricWithMSI()
        {
            using (FabricLayoutInfo fabricLayoutInfo = new FabricLayoutInfo(this.imageStore))
            {
                string codePath, configPath, infrastructureManifestFilePath;
                fabricLayoutInfo.Create(out codePath, out configPath, out infrastructureManifestFilePath);

                ImageBuilderExeTestWrapper exeWrapper = new ImageBuilderExeTestWrapper(this.imageStore);

                int exitCode = exeWrapper.ProvisionFabric(
                    codePath,
                    configPath,
                    infrastructureManifestFilePath);

                Verify.AreEqual(exitCode, 0);
                TestUtility.VerifyWinFabLayout(fabricLayoutInfo);
            }
        }
        public void TestProvisionOfDefaultImageStoreConnectionString()
        {
            using (FabricLayoutInfo fabricLayoutInfo = new FabricLayoutInfo(this.imageStore))
            {
                string defaultImageStoreConnectionString = "_default_";
                fabricLayoutInfo.PatchVersion = null;

                TestUtility.AddToFabricSettings(
                    FabricValidatorConstants.SectionNames.Management,
                    FabricValidatorConstants.ParameterNames.ImageStoreConnectionString,
                    defaultImageStoreConnectionString,
                    false /*isEncrypted*/,
                    fabricLayoutInfo.ClusterManifest);

                string codePath, configPath, infrastructureManifestFilePath;
                fabricLayoutInfo.Create(out codePath, out configPath, out infrastructureManifestFilePath);

                string currentExecutingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                string configurationCsvFilePath  = Path.Combine(currentExecutingDirectory, "Configurations.csv");

                this.imageBuilder.ProvisionFabric(
                    codePath,
                    configPath,
                    configurationCsvFilePath,
                    infrastructureManifestFilePath,
                    TimeSpan.MaxValue);

                string clusterManifestPath = Path.Combine(
                    "WindowsFabricStore",
                    string.Format("ClusterManifest.{0}.xml",
                                  fabricLayoutInfo.ClusterManifest.Version));
                var provisionedClusterManifest = fabricLayoutInfo.ImageStoreWrapper.GetFromStore <ClusterManifestType>(clusterManifestPath, TestUtility.ImageStoreDefaultTimeout);

                var imageStoreConnectionStringValue = provisionedClusterManifest.FabricSettings.First(
                    section => TestUtility.Equals(section.Name, FabricValidatorConstants.SectionNames.Management)).Parameter.First(
                    parameter => TestUtility.Equals(parameter.Name, FabricValidatorConstants.ParameterNames.ImageStoreConnectionString)).Value;

                Verify.AreNotEqual(imageStoreConnectionStringValue, defaultImageStoreConnectionString);

                Verify.IsTrue(imageStoreConnectionStringValue.StartsWith("file:"));

                TestUtility.VerifyWinFabLayout(fabricLayoutInfo);
            }
        }
        public void TestProvisionFabricWithMSI()
        {
            using (FabricLayoutInfo fabricLayoutInfo = new FabricLayoutInfo(this.imageStore))
            {
                string codePath, configPath, infrastructureManifestFilePath;
                fabricLayoutInfo.Create(out codePath, out configPath, out infrastructureManifestFilePath);

                string currentExecutingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                string configurationCsvFilePath  = Path.Combine(currentExecutingDirectory, "Configurations.csv");

                this.imageBuilder.ProvisionFabric(
                    codePath,
                    configPath,
                    configurationCsvFilePath,
                    infrastructureManifestFilePath,
                    TimeSpan.MaxValue);

                TestUtility.VerifyWinFabLayout(fabricLayoutInfo);
            }
        }
        public void TestGetFabricVersion()
        {
            using (FabricLayoutInfo fabricLayoutInfo = new FabricLayoutInfo(this.imageStore))
            {
                string codePath, configPath, infrastructureManifestFilePath;
                fabricLayoutInfo.Create(out codePath, out configPath, out infrastructureManifestFilePath);

                ImageBuilderExeTestWrapper exeWrapper = new ImageBuilderExeTestWrapper(this.imageStore);

                string codeVersion, configVersion;
                int    exitCode = exeWrapper.GetFabricVersion(
                    codePath,
                    configPath,
                    out codeVersion,
                    out configVersion);

                Verify.AreEqual(exitCode, 0);
                Verify.AreEqual(codeVersion, fabricLayoutInfo.PatchVersion);
                Verify.AreEqual(configVersion, fabricLayoutInfo.ClusterManifest.Version);
            }
        }
Exemple #8
0
        public static void VerifyWinFabLayout(FabricLayoutInfo fabircLayoutInfo)
        {
            string winFabLayoutPath = "WindowsFabricStore";

            if (fabircLayoutInfo.ClusterManifest != null)
            {
                string configPath = Path.Combine(winFabLayoutPath, string.Format("ClusterManifest.{0}.xml", fabircLayoutInfo.ClusterManifest.Version));
                Assert.IsTrue(fabircLayoutInfo.ImageStore.DoesContentExist(configPath, TimeSpan.MaxValue));
            }

            if (!string.IsNullOrEmpty(fabircLayoutInfo.PatchVersion))
            {
                if (fabircLayoutInfo.UseMSI)
                {
                    string codePath = Path.Combine(winFabLayoutPath, string.Format("WindowsFabric.{0}.msi", fabircLayoutInfo.PatchVersion));
                    Assert.IsTrue(fabircLayoutInfo.ImageStore.DoesContentExist(codePath, TimeSpan.MaxValue));
                }
                else
                {
                    string codePackageFolder = Path.Combine(winFabLayoutPath, string.Format(FabricLayoutInfo.WindowsFabricCodePackageFolderNamePattern, fabircLayoutInfo.PatchVersion));
                    Assert.IsTrue(fabircLayoutInfo.ImageStore.DoesContentExist(codePackageFolder, TimeSpan.MaxValue));
                }
            }
        }