public async Task ICannotSubmitAHttpDisableConnectivityRequestToAnUnsupportedClusterVersion() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); var client = ServiceLocator.Instance.Locate <IHDInsightClientFactory>() .Create(new HDInsightCertificateCredential(credentials.SubscriptionId, credentials.Certificate)); var clusterDetails = GetRandomCluster(); try { var manager = ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>(); var pocoClient = manager.Create(credentials, GetAbstractionContext(), false); clusterDetails.Version = "1.6.0.0.LargeSKU-amd64-134231"; client.CreateCluster(clusterDetails); // Try disabling first var opId = await pocoClient.DisableHttp(clusterDetails.Name, clusterDetails.Location); } catch (HttpLayerException clientEx) { Assert.IsTrue(clientEx.Message.Contains("connectivity changes are not supported for this cluster version")); Help.DoNothing(clientEx); } finally { client.DeleteCluster(clusterDetails.Name); } }
public void UserSuppliedVersionValid_LowLimit() { var userVersion = new Version(HDInsightSDKSupportedVersions.MinVersion.Major, HDInsightSDKSupportedVersions.MinVersion.Minor, 0, 0); var client = new VersionFinderClient(IntegrationTestBase.GetValidCredentials(), GetAbstractionContext(), false); Assert.AreEqual(client.GetVersionStatus(userVersion), VersionStatus.Compatible); }
[Timeout(30 * 60 * 1000)] // ms public void CreateDeleteContainer_SyncClient_AgainstManualEnvironment() { // Dissables the simulator this.ApplyIndividualTestMockingOnly(); // Sets the simulator var runManager = ServiceLocator.Instance.Locate <IServiceLocationIndividualTestManager>(); runManager.Override <IConnectionCredentialsFactory>(new AlternativeEnvironmentConnectionCredentialsFactory()); // Creates the client if (IntegrationTestBase.TestCredentials.AlternativeEnvironment == null) { Assert.Inconclusive("Alternative Azure Endpoint wasn't set up"); } var client = new HDInsightSyncClient( IntegrationTestBase.TestCredentials.AlternativeEnvironment.SubscriptionId, IntegrationTestBase.GetValidCredentials().Certificate); client.PollingInterval = TimeSpan.FromSeconds(1); // Runs the test TestValidAdvancedCluster( client.ListContainers, client.ListContainer, client.CreateContainer, client.DeleteContainer); }
public async Task ICanPerformA_DeleteNonExistingContainerInternal_Using_PocoClientAbstraction() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); await ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>() .Create(credentials, GetAbstractionContext(), false) .DeleteContainer(GetRandomClusterName(), "East US"); }
public void UserSuppliedVersionTooHigh() { var userVersion = new Version(HDInsightSDKSupportedVersions.MaxVersion.Major, HDInsightSDKSupportedVersions.MaxVersion.Minor + 1, 0, 0); var client = new VersionFinderClient(IntegrationTestBase.GetValidCredentials(), GetAbstractionContext(), false); Assert.AreEqual(client.GetVersionStatus(userVersion), VersionStatus.ToolsUpgradeRequired); }
[Timeout(5 * 60 * 1000)] // ms public async Task ICanPerformA_BasicCreateDeleteContainersOnUnregisteredLocation_Using_PocoClient() { // ADD SUBSCRIPTION VALIDATOR IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); // Unregisters subscription (just in case) var location = "North Europe"; var registrationClient = ServiceLocator.Instance.Locate <ISubscriptionRegistrationClientFactory>().Create(credentials, GetAbstractionContext(), false); if (await registrationClient.ValidateSubscriptionLocation(location)) { await registrationClient.UnregisterSubscriptionLocation(location); } var storageAccountsInLocation = from creationDetails in IntegrationTestBase.TestCredentials.Environments where creationDetails.Location == location select creationDetails; var storageAccount = storageAccountsInLocation.FirstOrDefault(); Assert.IsNotNull(storageAccount, "could not find any storage accounts in location {0}", location); var cluster = GetRandomCluster(); cluster.Location = location; cluster.DefaultStorageAccountName = storageAccount.DefaultStorageAccount.Name; cluster.DefaultStorageAccountKey = storageAccount.DefaultStorageAccount.Key; cluster.DefaultStorageContainer = storageAccount.DefaultStorageAccount.Container; await ValidateCreateClusterSucceeds(cluster); }
public async Task ICannotPerformA_CreateContainersOnUnregisterdSubscription_Using_RestClient() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); // Unregisters location var location = "North Europe"; DeleteClusters(credentials, location); var client = ServiceLocator.Instance.Locate <ISubscriptionRegistrationClientFactory>().Create(credentials, GetAbstractionContext(), false); if (await client.ValidateSubscriptionLocation(location)) { await client.UnregisterSubscriptionLocation(location); } Assert.IsFalse(await client.ValidateSubscriptionLocation(location), "Subscription location '{0}' is still registered.", location); try { // Creates the cluster var restClient = ServiceLocator.Instance.Locate <IHDInsightManagementRestClientFactory>().Create(credentials, GetAbstractionContext(), false); var cluster = GetRandomCluster(); string payload = new PayloadConverter().SerializeClusterCreateRequest(cluster); await restClient.CreateContainer(cluster.Name, location, payload); Assert.Fail("Expected exception."); } catch (HttpLayerException e) { Assert.AreEqual(HttpStatusCode.NotFound, e.RequestStatusCode); // Error looks like The cloud service with name [namespace] was not found. Assert.IsTrue(e.RequestContent.Contains("The cloud service with name")); Assert.IsTrue(e.RequestContent.Contains("was not found.")); } }
public async Task ICanPerformA_DeleteContainerInvalidLocationInternal_Using_PocoClientAbstraction() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); await ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>() .Create(credentials, GetAbstractionContext(), false) .DeleteContainer(TestCredentials.WellKnownCluster.DnsName, "Nowhere"); }
public async Task ICannotPerformA_RepeatedUnregistration_Using_SubscriptionRegistrationAbstraction() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); string location = "North Europe"; DeleteClusters(credentials, location); // Need to delete clusters, otherwise unregister will no-op var client = ServiceLocator.Instance.Locate <ISubscriptionRegistrationClientFactory>().Create(credentials, GetAbstractionContext(), false); try { await client.UnregisterSubscriptionLocation("North Europe"); await client.UnregisterSubscriptionLocation("North Europe"); Assert.Fail("Expected exception."); } catch (HttpLayerException e) { Assert.AreEqual(HttpStatusCode.NotFound, e.RequestStatusCode); // Error looks like The cloud service with name [namespace] was not found. Assert.IsTrue(e.RequestContent.Contains("The cloud service with name")); Assert.IsTrue(e.RequestContent.Contains("was not found.")); } Assert.IsFalse(await client.ValidateSubscriptionLocation(location)); }
public async Task ICanPerformA_Put_Using_HttpClientAbstraction() { // Given I want to use an X509 Cert for authentication IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); // And I have an Http Client using (var client = ServiceLocator.Instance.Locate <IHttpClientAbstractionFactory>().Create(credentials.Certificate, false)) { // And I set the uri for the request object client.RequestUri = new Uri("http://httpbin.org/put"); // And I set the method to Post client.Method = HttpMethod.Put; // And I set the content to "Hello World" client.Content = new StringContent("Hello World"); // When I call Client.SendAsync var responseTask = client.SendAsync(); var response = await responseTask; // Then I should receive a response Assert.IsNotNull(response); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Content); // And the response should have been successful. Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); // And the content should have a non zero length Assert.AreNotEqual(0, response.Content.Length); // And the content should contain "Hello World" Assert.IsTrue(response.Content.Contains("\"data\": \"Hello World\"")); } }
public async Task GetProviderPropertiesPerformsARetryWhenAnAttemptDoesNotSucced() { var manager = ServiceLocator.Instance.Locate <IServiceLocationSimulationManager>().MockingLevel = ServiceLocationMockingLevel.ApplyIndividualTestMockingOnly; var individual = ServiceLocator.Instance.Locate <IServiceLocationIndividualTestManager>(); dynamic xml = DynaXmlBuilder.Create(false, Formatting.None); xml.xmlns("http://schemas.microsoft.com/windowsazure") .Root .b .ResourceProviderProperty .b .Key("Test") .Value("Value") .d .d .End(); var content = xml.ToString(); IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); var client = ServiceLocator.Instance.Locate <IRdfeServiceRestClientFactory>().Create(credentials, GetAbstractionContext(), false); this.AddHttpResponse(new HttpResponseMessageAbstraction(HttpStatusCode.InternalServerError, new HttpResponseHeadersAbstraction(), "Server Problem")); this.AddHttpResponse(new HttpResponseMessageAbstraction(HttpStatusCode.OK, new HttpResponseHeadersAbstraction(), content)); var properties = await client.GetResourceProviderProperties(); Assert.AreEqual(2, this.attempts); Assert.AreEqual(0, this.responses.Count); Assert.AreEqual("Test", properties.First().Key); Assert.AreEqual("Value", properties.First().Value); Assert.AreEqual(1, properties.Count()); }
public async Task ICanHandleA_ErrorStatus_Using_HttpClientAbstraction() { // Given I want to use an X509 Cert for authentication IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); // And I have an Http Client using (var client = ServiceLocator.Instance.Locate <IHttpClientAbstractionFactory>().Create(credentials.Certificate, false)) { // And I set the uri for a http that will trigger a 404 (NotFound) client.RequestUri = new Uri("http://httpbin.org/status/404"); client.RequestHeaders.Add("x-ms-version", "2012-08-01"); client.RequestHeaders.Add("accept", "application/xml"); // When I call Client.SendAsync var responseTask = client.SendAsync(); var response = await responseTask; // Then I should receive a response Assert.IsNotNull(response); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Content); // And the response should have been unsuccessful. Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode); // And the content should be empty Assert.AreEqual(string.Empty, response.Content); } }
public async Task ICanHandleA_AuthenticationError_Using_HttpClientAbstraction() { // Given I want to use an X509 Cert for authentication IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); // And I have an Http Client using (var client = ServiceLocator.Instance.Locate <IHttpClientAbstractionFactory>().Create(credentials.Certificate, false)) { // And I set the uri to the base of Azure Services client.RequestUri = new Uri(credentials.Endpoint, new Uri(Guid.Empty.ToString(), UriKind.Relative)); client.RequestHeaders.Add("x-ms-version", "2012-08-01"); client.RequestHeaders.Add("accept", "application/xml"); // And I set the method to Get client.Method = HttpMethod.Get; // When I call Client.SendAsync var responseTask = client.SendAsync(); var response = await responseTask; // Then I should receive a response Assert.IsNotNull(response); Console.WriteLine(response.StatusCode); Console.WriteLine(response.Content); // And the response should have been successful. Assert.AreEqual(HttpStatusCode.Forbidden, response.StatusCode); // And the content should contain the error Assert.AreNotEqual(string.Empty, response.Content); } }
public async Task ICanHandleA_ClientTimeout_Using_HttpClientAbstraction() { try { // Given I want to use an X509 Cert for authentication IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); // And I have an Http Client using (var client = ServiceLocator.Instance.Locate <IHttpClientAbstractionFactory>().Create(credentials.Certificate, false)) { // And I set the uri for a http that will take 30 sec to complete client.RequestUri = new Uri("http://httpbin.org/delay/30000"); client.RequestHeaders.Add("x-ms-version", "2012-08-01"); client.RequestHeaders.Add("accept", "application/xml"); // And I set the client timeout to a value << 30 sec client.Timeout = TimeSpan.FromMilliseconds(1); // The call Client.SendAsync to trigger exception var responseTask = client.SendAsync(); var response = await responseTask; Console.WriteLine(response.Content); Console.WriteLine(response.ToString()); Console.WriteLine(response.StatusCode); } } catch (TimeoutException ex) { Assert.IsTrue(ex.Message.Contains("operation timed out")); } }
public async Task NegativeTest_InvalidAsvConfig_Using_PocoClientAbstraction() { var cluster = GetRandomCluster(); IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); cluster.DefaultStorageAccountKey = "invalid"; try { await ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>().Create(credentials, GetAbstractionContext(), false).CreateContainer(cluster); } catch (ConfigurationErrorsException e) { // NEIN: This needs to validate at least one parameter of the exception. Console.WriteLine("THIS TEST SUCCEDED because the expected negative result was found"); Console.WriteLine("ASV Validation failed. Details: {0}", e.ToString()); return; } catch (Exception e) { Assert.Fail("Expected exception 'ConfigurationErrorsException'; found '{0}'. Message:{1}", e.GetType(), e.Message); } Assert.Fail("ASV Validation should have failed."); }
private async Task ValidateCreateClusterSucceeds(ClusterCreateParametersV2 cluster, Action <ClusterDetails> postCreateValidation) { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); using (var client = ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>().Create(credentials, GetAbstractionContext(), false)) { client.CreateContainer(cluster).Wait(); await client.WaitForClusterInConditionOrError(null, cluster.Name, cluster.Location, TimeSpan.FromMinutes(30), HDInsightClient.DefaultPollingInterval, GetAbstractionContext(), this.CreatingStates); var task = client.ListContainer(cluster.Name); task.WaitForResult(); var container = task.Result; Assert.IsNotNull(container); if (container.Error.IsNotNull()) { Assert.Fail("The Container was not expected to return an error but returned ({0}) ({1})", container.Error.HttpCode, container.Error.Message); } if (postCreateValidation != null) { postCreateValidation(container); } await client.DeleteContainer(cluster.Name); await client.WaitForClusterNullOrError(cluster.Name, cluster.Location, TimeSpan.FromMinutes(10), IntegrationTestBase.GetAbstractionContext().CancellationToken); Assert.IsNull(container.Error); Assert.IsNull(client.ListContainer(cluster.Name).WaitForResult()); } }
public async Task ICanAddAndDeleteRDPUser() { IHDInsightSubscriptionCredentials credentials = IntegrationTestBase.GetValidCredentials(); IHDInsightClient client = HDInsightClient.Connect(credentials); ClusterCreateParametersV2 clusterCreationDetails = GetRandomCluster(); clusterCreationDetails.Version = "1.6"; ClusterDetails clusterDetails = client.CreateCluster(clusterCreationDetails); // add a rdp user - rdp is OFF by default, hence we enable it first string userName = "******"; string password = GetRandomValidPassword(); client.EnableRdp(clusterDetails.Name, clusterDetails.Location, userName, password, DateTime.UtcNow.AddHours(1)); ClusterDetails cluster = await client.GetClusterAsync(clusterDetails.Name); Assert.AreEqual(userName, cluster.RdpUserName, "Rdp user name has not been updated"); // now disable the rdp user await client.DisableRdpAsync(clusterDetails.Name, clusterDetails.Location); cluster = await client.GetClusterAsync(clusterDetails.Name); Assert.IsFalse(String.IsNullOrEmpty(cluster.Name), "Cluster user name is empty, maybe cluster was not created."); Assert.IsTrue(String.IsNullOrEmpty(cluster.RdpUserName), "Rdp user name has not been cleared"); // delete the cluster if (!string.Equals(clusterDetails.Name, IntegrationTestBase.TestCredentials.WellKnownCluster.DnsName)) { client.DeleteCluster(clusterDetails.Name); } }
public async Task ICanPerformA_ListCloudServices_Using_RestClientAbstraction() { IHDInsightSubscriptionCredentials credentials = IntegrationTestBase.GetValidCredentials(); var client = ServiceLocator.Instance.Locate <IHDInsightManagementRestClientFactory>().Create(credentials, GetAbstractionContext(), false); var result = await client.ListCloudServices(); Assert.IsTrue(this.ContainsContainer(TestCredentials.WellKnownCluster.DnsName, result.Content)); }
public async Task NegativeTest_InvalidAsv_Using_PocoClient() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); var cluster = GetRandomCluster(); cluster.AdditionalStorageAccounts.Add(new WabStorageAccountConfiguration(IntegrationTestBase.TestCredentials.Environments[0].AdditionalStorageAccounts[0].Name, IntegrationTestBase.TestCredentials.Environments[0].DefaultStorageAccount.Key)); await ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>().Create(credentials, GetAbstractionContext(), false).CreateContainer(cluster); }
public async Task ICanPerformA_PositiveSubscriptionValidation_Using_SubscriptionRegistrationAbstraction() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); var client = ServiceLocator.Instance.Locate <ISubscriptionRegistrationClientFactory>().Create(credentials, GetAbstractionContext(), false); Assert.IsTrue(await client.ValidateSubscriptionLocation("East US 2")); Assert.IsFalse(await client.ValidateSubscriptionLocation("No Where")); }
public void ICanGetCertificateInformation() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); Assert.IsNotNull(credentials.Endpoint); Assert.AreNotEqual(Guid.Empty, credentials.SubscriptionId); Assert.IsNotNull(credentials.Certificate); }
public void ICanPerformA_EmptyXmlParsing_RdfePropertyFinderXmlParsing() { string xml = @"<root/>"; IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); var rdfeCapabilitiesClient = ServiceLocator.Instance.Locate <IRdfeServiceRestClientFactory>().Create(credentials, GetAbstractionContext(), false); var capabilities = rdfeCapabilitiesClient.ParseCapabilities(xml); Assert.AreEqual(0, capabilities.Count()); }
public async Task ICanPerformA_ListNonExistingContainer_Using_PocoClientAbstraction() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); using (var client = ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>().Create(credentials, GetAbstractionContext(), false)) { var result = await client.ListContainer(GetRandomClusterName()); Assert.IsNull(result); } }
public void ICanContinuePollingWhenClusterStateIsValid() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); using (var client = ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>().Create(credentials, GetAbstractionContext(), false)) { var test = new ClusterDetails("TestCluster", ClusterState.ReadyForDeployment.ToString()); var result = client.PollSignal(test, ClusterState.Operational, ClusterState.Running); Assert.AreEqual(result, IHDInsightManagementPocoClientExtensions.PollResult.Continue); } }
public async Task ICanPerformA_UnregisterSubscription_Using_SubscriptionRegistrationAbstraction() { IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); DeleteClusters(credentials, "North Europe"); var client = ServiceLocator.Instance.Locate <ISubscriptionRegistrationClientFactory>().Create(credentials, GetAbstractionContext(), false); await client.RegisterSubscriptionLocation("North Europe"); await client.UnregisterSubscriptionLocation("North Europe"); }
public void ICanPerformA_PositiveAdditionalProppertiesXmlParsing_RdfePropertyFinderXmlParsing() { string xml = @"<ResourceProviderProperties xmlns=""http://schemas.microsoft.com/windowsazure"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"">" + "<P><Key>My Key</Key><Value>My Value</Value></P>" + "<ResourceProviderProperty><Key>CAPABILITY_REGION_EAST_US</Key><Value>East US</Value></ResourceProviderProperty>" + "</ResourceProviderProperties>"; IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); var rdfeCapabilitiesClient = ServiceLocator.Instance.Locate <IRdfeServiceRestClientFactory>().Create(credentials, GetAbstractionContext(), false); var capabilities = rdfeCapabilitiesClient.ParseCapabilities(xml); Assert.AreEqual(0, capabilities.Count(capability => capability.Key == "My Key")); }
public RdfeServiceRestSimulatorClient(IHDInsightCertificateCredential credentials, IAbstractionContext context) { var validCreds = IntegrationTestBase.GetValidCredentials() as IHDInsightCertificateCredential; if (validCreds == null || (credentials.Certificate.SubjectName != validCreds.Certificate.SubjectName && credentials.SubscriptionId != validCreds.SubscriptionId)) { throw new HttpLayerException(HttpStatusCode.Unauthorized, "User " + validCreds.SubscriptionId + " is not authorized"); } this.context = context; this.credentials = credentials; this.PollInterval = TimeSpan.FromMilliseconds(10); }
[Timeout(30 * 1000)] // ms public void CreateDeleteContainer_SyncClient() { // Creates the client IHDInsightCertificateConnectionCredentials credentials = IntegrationTestBase.GetValidCredentials(); var client = new HDInsightSyncClient(credentials.SubscriptionId, credentials.Certificate); client.PollingInterval = TimeSpan.FromMilliseconds(100); TestValidAdvancedCluster( client.ListContainers, client.ListContainer, client.CreateContainer, client.DeleteContainer); }
public void InternalValidation_HDInsightManagementRestClient_GetCloudServiceName() { IHDInsightSubscriptionCredentials credentials = IntegrationTestBase.GetValidCredentials(); var resolver = ServiceLocator.Instance.Locate <ICloudServiceNameResolver>(); var serviceName = resolver.GetCloudServiceName(Guid.Empty, "hdInsight", "EastUS"); Assert.AreEqual("hdInsightCK4TO7F6PZOJJ2FHBWOSHEUVEPIUV6UVI6JRGD4KHFM4POCJVSUA-EastUS", serviceName); var serviceName1 = resolver.GetCloudServiceName(credentials.SubscriptionId, credentials.DeploymentNamespace, "EastUS"); var serviceName2 = resolver.GetCloudServiceName(credentials.SubscriptionId, credentials.DeploymentNamespace, "EastUS"); Assert.AreEqual(serviceName1, serviceName2); }
public async Task ICannotSubmitAChangeHttpUserOperationWhileAnotherIsInProgress() { IHadoopClientExtensions.GetPollingInterval = () => 5; this.SetHDInsightManagementRestSimulatorClientOperationTime(100); IHDInsightCertificateCredential credentials = IntegrationTestBase.GetValidCredentials(); var client = ServiceLocator.Instance.Locate <IHDInsightClientFactory>().Create(new HDInsightCertificateCredential(credentials.SubscriptionId, credentials.Certificate)); var manager = ServiceLocator.Instance.Locate <IHDInsightManagementPocoClientFactory>(); var pocoClient = manager.Create(credentials, GetAbstractionContext(), false); var containers = await pocoClient.ListContainers(); ClusterDetails clusterDetails = containers.Last(); var clusterCreationDetails = GetRandomCluster(); clusterDetails = client.CreateCluster(clusterCreationDetails); var operationId = Guid.Empty; var userName = "******"; var password = GetRandomValidPassword(); try { // disable then enable without waiting operationId = await pocoClient.DisableHttp(clusterDetails.Name, clusterDetails.Location); await pocoClient.EnableHttp(clusterDetails.Name, clusterDetails.Location, userName, password); Assert.Fail("Adding http user twice did not throw an exception"); } catch (HttpLayerException ex) { Assert.AreEqual(HttpStatusCode.Conflict, ex.RequestStatusCode); } finally { if (operationId != Guid.Empty) { WaitforCompletion(pocoClient, clusterDetails.Name, clusterDetails.Location, operationId).WaitForResult(); Thread.Sleep(HDInsightManagementRestSimulatorClient.OperationTimeToCompletionInMilliseconds * 2); operationId = pocoClient.EnableHttp(clusterDetails.Name, clusterDetails.Location, userName, password).WaitForResult(); WaitforCompletion(pocoClient, clusterDetails.Name, clusterDetails.Location, operationId).WaitForResult(); } // delete the cluster if (!string.Equals(clusterDetails.Name, IntegrationTestBase.TestCredentials.WellKnownCluster.DnsName)) { client.DeleteCluster(clusterDetails.Name); } } }