Ejemplo n.º 1
0
        private static async Task <string> DeployNonZippedArtifact(
            ApplicationManager appManager,
            string type,
            string path,
            bool isAsync,
            bool?isClean,
            string expectedDeployPath = null)
        {
            TestTracer.Trace("Deploying file");

            var testFile = DeploymentTestHelper.CreateRandomTestFile();

            using (var fileStream = DeploymentTestHelper.CreateFileStream(testFile))
            {
                IList <KeyValuePair <string, string> > queryParams = GetOneDeployQueryParams(type, path, isAsync, isClean);

                var response = await appManager.OneDeployManager.PushDeployFromStream(fileStream, new ZipDeployMetadata(), queryParams);

                response.EnsureSuccessStatusCode();

                if (isAsync)
                {
                    await DeploymentTestHelper.WaitForDeploymentCompletionAsync(appManager, deployer);
                }
            }

            if (expectedDeployPath != null)
            {
                VerifyDeployedArtifact(appManager, testFile.Content, expectedDeployPath);
            }

            return(testFile.Content);
        }
Ejemplo n.º 2
0
        private static async Task <string> DeployNonZippedArtifact(
            ApplicationManager appManager,
            string type,
            string path,
            bool isAsync,
            bool?isClean,
            string expectedDeployPath = null,
            bool expectedSuccess      = true)
        {
            TestTracer.Trace($"Deploying file type={type} path={path} isAsync={isAsync} isClean={isClean} expectedDeployPath={expectedDeployPath} expectedSuccess={expectedSuccess}");

            var testFile = DeploymentTestHelper.CreateRandomTestFile();

            using (var fileStream = DeploymentTestHelper.CreateFileStream(testFile))
            {
                IList <KeyValuePair <string, string> > queryParams = GetOneDeployQueryParams(type, path, isAsync, isClean);

                var response = await appManager.OneDeployManager.PushDeployFromStream(fileStream, new ZipDeployMetadata(), queryParams);

                TestTracer.Trace($"Response code={response.StatusCode}");
                if (expectedSuccess)
                {
                    response.EnsureSuccessStatusCode();
                }
                else
                {
                    Assert.True(response.StatusCode == System.Net.HttpStatusCode.BadRequest, $"This test is expected to fail with status code == 400. Observed status code == {response.StatusCode}");
                }

                if (isAsync)
                {
                    await DeploymentTestHelper.WaitForDeploymentCompletionAsync(appManager, deployer);
                }
            }

            if (expectedDeployPath != null)
            {
                VerifyDeployedArtifact(appManager, testFile.Content, expectedDeployPath);
            }

            TestTracer.Trace($"Validation successful!");
            return(testFile.Content);
        }