Exemple #1
0
        public static FabricDeployment CreateDeployment(string testcaseName)
        {
            var    parameters     = FabricDeploymentParameters.CreateDefault(Constants.TestDllName, testcaseName, 1);
            string fabricFilePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // add the host related files into the node folder for each node so that we can start the host
            parameters.AdditionalFilesToDeployToNodeRoot.Add(Path.Combine(fabricFilePath, "System.Fabric.dll"));
            parameters.AdditionalFilesToDeployToNodeRoot.Add(Path.Combine(fabricFilePath, "System.Fabric.Strings.dll"));
            parameters.AdditionalFilesToDeployToNodeRoot.Add(Path.Combine(fabricFilePath, "System.Fabric.Test.Host.exe"));
            parameters.AdditionalFilesToDeployToNodeRoot.Add(Assembly.GetExecutingAssembly().Location);

            var deployment = new FabricDeployment(parameters);

            LogHelper.Log("Starting deployment");
            deployment.Start();

            return(deployment);
        }
Exemple #2
0
        private static FabricDeployment StartApp()
        {
            var nodeCount  = 3;
            var parameters = FabricDeploymentParameters.CreateDefault(
                System.Fabric.Services.Scenarios.Test.Constants.TestDllName,
                "FabricStore",
                nodeCount,
                true);

            LogHelper.Log("Creating deployment");
            var deployment = new FabricDeployment(parameters);

            for (var ix = 1; ix <= nodeCount; ++ix)
            {
                var logDir = Path.Combine(deployment.LogPath, "Node" + ix);

                if (!Directory.Exists(logDir))
                {
                    LogHelper.Log("Creating directory: {0}", logDir);
                    Directory.CreateDirectory(logDir);
                }
            }

            LogHelper.Log("Starting Deployment");
            deployment.Start();

            DateTime startTimeUtc = DateTime.UtcNow;

            LogHelper.Log("Creating, packing and uploading app");
            var dep = CreateDeployer(deployment.TestOutputPath);

            deployment.UploadProvisionAndStartApplication(dep);

            LogHelper.Log("Wait for secondaries");
            if (!deployment.WaitForPartitionToBeStable(Constants.ApplicationName, Constants.ServiceTypeName, startTimeUtc, TimeSpan.FromSeconds(120 * 5), (p) => true))
            {
                LogHelper.Log("Failed waiting for partitions to be assigned");
                Assert.Fail("Failed wait for partitions to be assigned");
            }

            return(deployment);
        }