public void TestListClustersInResourceGroup() { string suiteName = GetType().FullName; string testName = "TestListClustersInResourceGroup"; HDInsightManagementTestUtilities.RunTestInNewResourceGroup(suiteName, testName, (resClient, client, rgName) => { string clusterName1 = "hdisdk-cluster1"; string clusterName2 = "hdisdk-cluster2"; try { var list = client.Clusters.ListByResourceGroup(rgName); Assert.DoesNotContain(list, c => c.Name.Equals(clusterName1, StringComparison.OrdinalIgnoreCase)); Assert.DoesNotContain(list, c => c.Name.Equals(clusterName2, StringComparison.OrdinalIgnoreCase)); // Create one cluster with ADLS so both clusters aren't using the same storage account at the same time ClusterCreateParameters parameters1 = ClusterCreateParametersHelpers.GetCustomCreateParametersIaas(testName); ClusterCreateParameters parameters2 = ClusterCreateParametersHelpers.GetCustomCreateParametersForAdl(testName); Parallel.Invoke( () => client.Clusters.Create(rgName, clusterName1, parameters1), () => client.Clusters.Create(rgName, clusterName2, parameters2)); list = client.Clusters.ListByResourceGroup(rgName); Assert.Contains(list, c => c.Name.Equals(clusterName1, StringComparison.OrdinalIgnoreCase)); Assert.Contains(list, c => c.Name.Equals(clusterName2, StringComparison.OrdinalIgnoreCase)); } finally { client.Clusters.BeginDelete(rgName, clusterName1); client.Clusters.BeginDelete(rgName, clusterName2); } }); }
public void TestCreateWithDataLakeStorage() { string testName = "TestCreateWithDataLakeStorage"; ClusterCreateParameters parameters = ClusterCreateParametersHelpers.GetCustomCreateParametersForAdl(testName); RunCreateClusterTestInNewResourceGroup(GetType().FullName, testName, "hdisdk-adl", parameters); }
public void TestListClustersInSubscription() { string suiteName = GetType().FullName; string testName = "TestListClustersInSubscription"; using (MockContext context = MockContext.Start(suiteName, testName)) { var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; var resourceClient = HDInsightManagementTestUtilities.GetResourceManagementClient(context, handler); var client = HDInsightManagementTestUtilities.GetHDInsightManagementClient(context, handler); string rgName1 = string.Empty; string rgName2 = string.Empty; string clusterName1 = "hdisdk-cluster-rg1"; string clusterName2 = "hdisdk-cluster-rg2"; try { rgName1 = HDInsightManagementTestUtilities.CreateResourceGroup(resourceClient); rgName2 = HDInsightManagementTestUtilities.CreateResourceGroup(resourceClient); var list = client.Clusters.List(); Assert.DoesNotContain(list, c => c.Name.Equals(clusterName1, StringComparison.OrdinalIgnoreCase)); Assert.DoesNotContain(list, c => c.Name.Equals(clusterName2, StringComparison.OrdinalIgnoreCase)); // Create one cluster with ADLS so both clusters aren't using the same storage account at the same time ClusterCreateParameters parameters1 = ClusterCreateParametersHelpers.GetCustomCreateParametersIaas(testName); ClusterCreateParameters parameters2 = ClusterCreateParametersHelpers.GetCustomCreateParametersForAdl(testName); Parallel.Invoke( () => client.Clusters.Create(rgName1, clusterName1, parameters1), () => client.Clusters.Create(rgName2, clusterName2, parameters2)); list = client.Clusters.List(); Assert.Contains(list, c => c.Name.Equals(clusterName1, StringComparison.OrdinalIgnoreCase)); Assert.Contains(list, c => c.Name.Equals(clusterName2, StringComparison.OrdinalIgnoreCase)); } finally { resourceClient.ResourceGroups.BeginDelete(rgName1); resourceClient.ResourceGroups.BeginDelete(rgName2); } } }