Exemplo n.º 1
0
        public async Task InitialCloneBasicTests(IScenario scenario)
        {
            // this contains zip files for each scenario
            using (var repo = Git.Clone("WebDeploySamples"))
            {
                string zipFile = Path.Combine(repo.PhysicalPath, scenario.Name + ".zip");
                Assert.True(File.Exists(zipFile), "Could not find " + zipFile);

                await ApplicationManager.RunAsync(scenario.Name, async appManager =>
                {
                    // moodle takes 5 mins to zip deploy (< 100s default timeout).
                    // appManager.ZipManager.Client.Timeout = TimeSpan.FromMinutes(10);

                    // deploy zip file using /zip
                    appManager.ZipManager.PutZipFile("site/wwwroot", zipFile);

                    // sanity validate content
                    scenario.DeployVerify(appManager.SiteUrl);

                    // simulate LocalGit env
                    // this is actually done at create site.
                    // however, the site reuse cleared this up.
                    await appManager.SettingsManager.SetValue(SettingsKeys.ScmType, "LocalGit");

                    // initial clone to temp folder
                    // this will clone from wwwroot
                    string repositoryPath = Git.CloneToLocal(appManager.GitUrl);

                    try
                    {
                        // we should have set the SCM_REPOSITORY_PATH to wwwroot
                        var value = await appManager.SettingsManager.GetValue(SettingsKeys.RepositoryPath);
                        Assert.Equal("wwwroot", value);

                        // make local modification
                        scenario.ApplyChange(repositoryPath);

                        // commit and push
                        Git.Commit(repositoryPath, "new change");
                        Git.Push(repositoryPath, appManager.GitUrl);

                        // validate deployment status
                        var results = (await appManager.DeploymentManager.GetResultsAsync()).ToList();
                        Assert.Equal(1, results.Count);
                        Assert.Equal(DeployStatus.Success, results[0].Status);

                        // validate changed content
                        scenario.ChangeVerify(appManager.SiteUrl);
                    }
                    finally
                    {
                        SafeExecute(() => Directory.Delete(repositoryPath, recursive: true));
                    }
                });
            }
        }
        public async Task InitialCloneBasicTests(IScenario scenario)
        {
            // this contains zip files for each scenario
            using (var repo = Git.Clone("WebDeploySamples"))
            {
                string zipFile = Path.Combine(repo.PhysicalPath, scenario.Name + ".zip");
                Assert.True(File.Exists(zipFile), "Could not find " + zipFile);

                await ApplicationManager.RunAsync(scenario.Name, async appManager =>
                {
                    // moodle takes 5 mins to zip deploy (< 100s default timeout).
                    // appManager.ZipManager.Client.Timeout = TimeSpan.FromMinutes(10);

                    // deploy zip file using /zip
                    appManager.ZipManager.PutZipFile("site/wwwroot", zipFile);

                    // sanity validate content
                    scenario.DeployVerify(appManager.SiteUrl);

                    // simulate LocalGit env
                    // this is actually done at create site.
                    // however, the site reuse cleared this up.
                    await appManager.SettingsManager.SetValue(SettingsKeys.ScmType, "LocalGit");

                    // initial clone to temp folder
                    // this will clone from wwwroot
                    string repositoryPath = Git.CloneToLocal(appManager.GitUrl);

                    try
                    {
                        // we should have set the SCM_REPOSITORY_PATH to wwwroot
                        var value = await appManager.SettingsManager.GetValue(SettingsKeys.RepositoryPath);
                        Assert.Equal("wwwroot", value);

                        // make local modification
                        scenario.ApplyChange(repositoryPath);

                        // commit and push
                        Git.Commit(repositoryPath, "new change");
                        Git.Push(repositoryPath, appManager.GitUrl);

                        // validate deployment status
                        var results = (await appManager.DeploymentManager.GetResultsAsync()).ToList();
                        Assert.Equal(1, results.Count);
                        Assert.Equal(DeployStatus.Success, results[0].Status);

                        // validate changed content
                        scenario.ChangeVerify(appManager.SiteUrl);
                    }
                    finally
                    {
                        SafeExecute(() => Directory.Delete(repositoryPath, recursive: true));
                    }
                });
            }
        }