예제 #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);
        }
예제 #2
0
파일: StressTestCases.cs 프로젝트: 40a/kudu
        // 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 = SitePool.CreateApplicationAsync().Result;
                        Uri siteUri;
                        Uri.TryCreate(new Uri(stressAppManager.SiteUrl), "hostingstart.html", out siteUri);
                        StressUtils.VerifySite(siteUri.AbsoluteUri, "successfully");

                        string appName = stressAppManager.ApplicationName;
                        // create counter objects & do init log
                        W3wpResourceMonitor counterManager = new W3wpResourceMonitor(appName);
                        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;
        }