Esempio n. 1
0
        // create site and counters
        private TestArtifacts GetTestArtifacts(string testName, string gitUrl)
        {
            if (!testArtifactStore.ContainsKey(testName))
            {
                lock (initializationLockObj)
                {
                    if (!testArtifactStore.ContainsKey(testName))
                    {
                        // create site & start w3wp.exe with a request
                        ApplicationManager stressAppManager = ApplicationManager.CreateApplication(testName);
                        Uri siteUri;
                        Uri.TryCreate(new Uri(stressAppManager.SiteUrl), "hostingstart.html", out siteUri);
                        StressUtils.VerifySite(siteUri.AbsoluteUri, "successfully");

                        // create counter objects & do init log
                        W3wpResourceMonitor counterManager = new W3wpResourceMonitor(testName);
                        counterManager.CheckAndLogResourceUsage();

                        TestRepository testRepository = Git.Clone(testName, gitUrl);

                        testArtifactStore.TryAdd(testName, new TestArtifacts()
                        {
                            appManager = stressAppManager, resourceMonitor = counterManager, testRespository = testRepository
                        });
                    }
                }
            }
            TestArtifacts testArtifacts;

            testArtifactStore.TryGetValue(testName, out testArtifacts);
            return(testArtifacts);
        }
Esempio n. 2
0
        private void DoGitPush(ApplicationManager appManager, TestRepository testRepository, string appName, string verificationContent)
        {
            appManager.GitDeploy(testRepository.PhysicalPath, "master");

            var results = appManager.DeploymentManager.GetResultsAsync().Result.ToList();

            if (results[0].Status != Kudu.Core.Deployment.DeployStatus.Success)
            {
                string msg = string.Format("Deployment of app {0} failed.  Deployment count:  {1} .   Deployment Status:  {2}", appName, results.Count, results[0].Status);
                throw new ApplicationException(msg);
            }
            StressUtils.VerifySite(appManager.SiteUrl, verificationContent);
        }
Esempio n. 3
0
        private void DoGitRedeploy(ApplicationManager appManager, string commitId, string verificationContent)
        {
            DeployResult result = null;

            try
            {
                appManager.DeploymentManager.DeployAsync(commitId).Wait();
                var results = appManager.DeploymentManager.GetResultsAsync().Result.ToList();
                result = results.Where(r => r.Id == commitId).FirstOrDefault();
            }
            catch (Exception ex)
            {
                string msg = string.Format("Redeploy operation failed for commit ID:  {0}.  Exception:  {1}", commitId, ex.ToString());
                throw new ApplicationException(msg);
            }

            if (result == null)
            {
                string msg = string.Format("Redeploy operation completed but expected commit Id was not deployed.  Commit ID:  {0}.", commitId);
                throw new ApplicationException(msg);
            }

            StressUtils.VerifySite(appManager.SiteUrl, verificationContent);
        }