public void SubmitGetListCancelTest() { TestUtilities.StartTest(); try { UndoContext.Current.Start(); CommonTestFixture commonData = new CommonTestFixture(); var clientToUse = this.GetDataLakeAnalyticsJobManagementClient(); var accountClient = this.GetDataLakeAnalyticsManagementClient(); // Create a test account to submit the job to. AzureAsyncOperationResponse responseCreate = accountClient.DataLakeAnalyticsAccount.Create(resourceGroupName: commonData.ResourceGroupName, parameters: new DataLakeAnalyticsAccountCreateOrUpdateParameters { DataLakeAnalyticsAccount = new DataLakeAnalyticsAccount { Name = commonData.DataLakeAnalyticsAccountName, Location = commonData.Location, Properties = new DataLakeAnalyticsAccountProperties { DefaultDataLakeStoreAccount = commonData.DataLakeAccountName, DataLakeStoreAccounts = new List <DataLakeStoreAccount> { { new DataLakeStoreAccount { Name = commonData.DataLakeAccountName, Properties = new DataLakeStoreAccountProperties { Suffix = commonData.DataLakeAccountSuffix } } } } }, Tags = new Dictionary <string, string> { { "testkey", "testvalue" } } } }); Assert.True(responseCreate.Status == OperationStatus.Succeeded); // wait for provisioning state to be Succeeded // we will wait a maximum of 15 minutes for this to happen and then report failures DataLakeAnalyticsAccountGetResponse getResponse = accountClient.DataLakeAnalyticsAccount.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName); int timeToWaitInMinutes = 15; int minutesWaited = 0; while (getResponse.DataLakeAnalyticsAccount.Properties.ProvisioningState != DataLakeAnalyticsAccountStatus.Succeeded && getResponse.DataLakeAnalyticsAccount.Properties.ProvisioningState != DataLakeAnalyticsAccountStatus.Failed && getResponse.DataLakeAnalyticsAccount.Properties.ProvisioningState != DataLakeAnalyticsAccountStatus.Failed && minutesWaited <= timeToWaitInMinutes) { TestUtilities.Wait(60000); // Wait for one minute and then go again. minutesWaited++; getResponse = accountClient.DataLakeAnalyticsAccount.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName); } // Confirm that the account creation did succeed Assert.True(getResponse.DataLakeAnalyticsAccount.Properties.ProvisioningState == DataLakeAnalyticsAccountStatus.Succeeded); // TODO: Remove this sleep once defect 5022906 is fixed TestUtilities.Wait(120000); // Wait for two minutes to submit the job, which gives the CJS queue a chance to create. // We need to hardcode the job ID to use for the mocks. // TODO: come up with some way to re-generate this when necessary (i.e. re-running/running the test against the server). Guid jobId = TestUtilities.GenerateGuid(); var secondId = TestUtilities.GenerateGuid(); // Submit a job to the account var jobToSubmit = new JobInformation { Name = "azure sdk data lake analytics job", JobId = jobId, DegreeOfParallelism = 2, Type = JobType.USql, Properties = new USqlProperties { Type = JobType.USql, Script = "DROP DATABASE IF EXISTS testdb; CREATE DATABASE testdb;" } }; var createOrBuildParams = new JobInfoBuildOrCreateParameters { Job = jobToSubmit }; JobInfoBuildOrCreateResponse jobCreateResponse = clientToUse.Jobs.Create(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, createOrBuildParams); // TODO: Once the front end is no longer mocked, do response validation here as well as for all other requests Assert.NotNull(jobCreateResponse); // Cancel the job AzureOperationResponse cancelJobResponse = clientToUse.Jobs.Cancel(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, jobCreateResponse.Job.JobId); // Verify the job was successfully cancelled Assert.NotNull(cancelJobResponse); Assert.Equal(HttpStatusCode.OK, cancelJobResponse.StatusCode); // Get the job and ensure that it says it was cancelled. var getCancelledJobResponse = clientToUse.Jobs.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, jobCreateResponse.Job.JobId); Assert.Equal(HttpStatusCode.OK, getCancelledJobResponse.StatusCode); Assert.Equal(JobResult.Cancelled, getCancelledJobResponse.Job.Result); Assert.NotNull(getCancelledJobResponse.Job.ErrorMessage); Assert.NotEmpty(getCancelledJobResponse.Job.ErrorMessage); // Resubmit the job createOrBuildParams.Job.JobId = secondId; jobCreateResponse = clientToUse.Jobs.Create(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, createOrBuildParams); Assert.NotNull(jobCreateResponse); // Poll the job until it finishes JobInfoGetResponse getJobResponse = clientToUse.Jobs.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, jobCreateResponse.Job.JobId); Assert.NotNull(getJobResponse); int maxWaitInSeconds = 180; // 3 minutes should be long enough int curWaitInSeconds = 0; while (getJobResponse.Job.State != JobState.Ended && curWaitInSeconds < maxWaitInSeconds) { // wait 5 seconds before polling again TestUtilities.Wait(5000); curWaitInSeconds += 5; getJobResponse = clientToUse.Jobs.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, jobCreateResponse.Job.JobId); Assert.NotNull(getJobResponse); } Assert.True(curWaitInSeconds <= maxWaitInSeconds); // Verify the job completes successfully Assert.True( getJobResponse.Job.State == JobState.Ended && getJobResponse.Job.Result == JobResult.Succeeded, string.Format("Job: {0} did not return success. Current job state: {1}. Actual result: {2}. Error (if any): {3}", getJobResponse.Job.JobId, getJobResponse.Job.State, getJobResponse.Job.Result, getJobResponse.Job.ErrorMessage)); JobInfoListResponse listJobResponse = clientToUse.Jobs.List(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, null); Assert.NotNull(listJobResponse); Assert.True(listJobResponse.Value.Any(job => job.JobId == getJobResponse.Job.JobId)); // Just compile the job var compileResponse = clientToUse.Jobs.Build(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, createOrBuildParams); // list the jobs both with a hand crafted query string and using the parameters listJobResponse = clientToUse.Jobs.List(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, new JobListParameters { Select = "jobId" }); Assert.NotNull(listJobResponse); Assert.True(listJobResponse.Value.Any(job => job.JobId == getJobResponse.Job.JobId)); Assert.NotNull(compileResponse); listJobResponse = clientToUse.Jobs.ListWithQueryString(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, "$select=jobId"); Assert.NotNull(listJobResponse); Assert.True(listJobResponse.Value.Any(job => job.JobId == getJobResponse.Job.JobId)); Assert.NotNull(compileResponse); } finally { // we don't catch any exceptions, those should all be bubbled up. UndoContext.Current.UndoAll(); TestUtilities.EndTest(); } }
/// <summary> /// The Get Operation Status operation returns the status of the /// specified operation. After calling an asynchronous operation, you /// can call Get Operation Status to determine whether the operation /// has succeeded, failed, or is still in progress. /// </summary> /// <param name='azureAsyncOperation'> /// Required. Location value returned by the Begin operation. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// The response body contains the status of the specified asynchronous /// operation, indicating whether it has succeeded, is inprogress, or /// has failed. Note that this status is distinct from the HTTP status /// code returned for the Get Operation Status operation itself. If /// the asynchronous operation succeeded, the response body includes /// the HTTP status code for the successful request. If the /// asynchronous operation failed, the response body includes the HTTP /// status code for the failed request and error information regarding /// the failure. /// </returns> public async Task <AzureAsyncOperationResponse> GetLongRunningOperationStatusAsync(string azureAsyncOperation, CancellationToken cancellationToken) { // Validate if (azureAsyncOperation == null) { throw new ArgumentNullException("azureAsyncOperation"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("azureAsyncOperation", azureAsyncOperation); TracingAdapter.Enter(invocationId, this, "GetLongRunningOperationStatusAsync", tracingParameters); } // Construct URL string url = ""; url = url + azureAsyncOperation; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers httpRequest.Headers.Add("x-ms-version", "2015-05-01-preview"); // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Accepted) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result AzureAsyncOperationResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Accepted) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new AzureAsyncOperationResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { JToken statusValue = responseDoc["status"]; if (statusValue != null && statusValue.Type != JTokenType.Null) { string statusInstance = ((string)statusValue); result.Status = statusInstance; } JToken errorValue = responseDoc["error"]; if (errorValue != null && errorValue.Type != JTokenType.Null) { Error errorInstance = new Error(); result.Error = errorInstance; JToken codeValue = errorValue["code"]; if (codeValue != null && codeValue.Type != JTokenType.Null) { string codeInstance = ((string)codeValue); errorInstance.Code = codeInstance; } JToken messageValue = errorValue["message"]; if (messageValue != null && messageValue.Type != JTokenType.Null) { string messageInstance = ((string)messageValue); errorInstance.Message = messageInstance; } JToken targetValue = errorValue["target"]; if (targetValue != null && targetValue.Type != JTokenType.Null) { string targetInstance = ((string)targetValue); errorInstance.Target = targetInstance; } JToken detailsArray = errorValue["details"]; if (detailsArray != null && detailsArray.Type != JTokenType.Null) { foreach (JToken detailsValue in ((JArray)detailsArray)) { ErrorDetails errorDetailsInstance = new ErrorDetails(); errorInstance.Details.Add(errorDetailsInstance); JToken codeValue2 = detailsValue["code"]; if (codeValue2 != null && codeValue2.Type != JTokenType.Null) { string codeInstance2 = ((string)codeValue2); errorDetailsInstance.Code = codeInstance2; } JToken targetValue2 = detailsValue["target"]; if (targetValue2 != null && targetValue2.Type != JTokenType.Null) { string targetInstance2 = ((string)targetValue2); errorDetailsInstance.Target = targetInstance2; } JToken messageValue2 = detailsValue["message"]; if (messageValue2 != null && messageValue2.Type != JTokenType.Null) { string messageInstance2 = ((string)messageValue2); errorDetailsInstance.Message = messageInstance2; } } } JToken innerErrorValue = errorValue["innerError"]; if (innerErrorValue != null && innerErrorValue.Type != JTokenType.Null) { string innerErrorInstance = ((string)innerErrorValue); errorInstance.InnerError = innerErrorInstance; } } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return(result); } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } }
public void CreateGetUpdateDeleteTest() { TestUtilities.StartTest(); try { UndoContext.Current.Start(); CommonTestFixture commonData = new CommonTestFixture(); var clientToUse = this.GetDataLakeAnalyticsManagementClient(); // Create a test account AzureAsyncOperationResponse responseCreate = clientToUse.DataLakeAnalyticsAccount.Create(commonData.ResourceGroupName, parameters: new DataLakeAnalyticsAccountCreateOrUpdateParameters { DataLakeAnalyticsAccount = new DataLakeAnalyticsAccount { Name = commonData.DataLakeAnalyticsAccountName, Location = commonData.Location, Properties = new DataLakeAnalyticsAccountProperties { DefaultDataLakeStoreAccount = commonData.DataLakeStoreAccountName, DataLakeStoreAccounts = new List <DataLakeStoreAccount> { new DataLakeStoreAccount { Name = commonData.DataLakeStoreAccountName, Properties = new DataLakeStoreAccountProperties { Suffix = commonData.DataLakeStoreAccountSuffix } } } }, Tags = new Dictionary <string, string> { { "testkey", "testvalue" } } } }); Assert.Equal(HttpStatusCode.OK, responseCreate.StatusCode); // get the account and ensure that all the values are properly set. var responseGet = clientToUse.DataLakeAnalyticsAccount.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName); // validate the account creation process Assert.True(responseGet.DataLakeAnalyticsAccount.Properties.ProvisioningState == DataLakeAnalyticsAccountStatus.Creating || responseGet.DataLakeAnalyticsAccount.Properties.ProvisioningState == DataLakeAnalyticsAccountStatus.Succeeded); Assert.NotNull(responseCreate.RequestId); Assert.NotNull(responseGet.RequestId); Assert.Contains(commonData.DataLakeAnalyticsAccountName, responseGet.DataLakeAnalyticsAccount.Id); Assert.Equal(commonData.Location, responseGet.DataLakeAnalyticsAccount.Location); Assert.Equal(commonData.DataLakeAnalyticsAccountName, responseGet.DataLakeAnalyticsAccount.Name); Assert.Equal("Microsoft.DataLakeAnalytics/accounts", responseGet.DataLakeAnalyticsAccount.Type); Assert.True(responseGet.DataLakeAnalyticsAccount.Properties.DataLakeStoreAccounts.Count == 1); Assert.True(responseGet.DataLakeAnalyticsAccount.Properties.DataLakeStoreAccounts.ToList()[0].Name.Equals(commonData.DataLakeStoreAccountName)); // wait for provisioning state to be Succeeded // we will wait a maximum of 15 minutes for this to happen and then report failures int timeToWaitInMinutes = 15; int minutesWaited = 0; while (responseGet.DataLakeAnalyticsAccount.Properties.ProvisioningState != DataLakeAnalyticsAccountStatus.Succeeded && responseGet.DataLakeAnalyticsAccount.Properties.ProvisioningState != DataLakeAnalyticsAccountStatus.Failed && minutesWaited <= timeToWaitInMinutes) { TestUtilities.Wait(60000); // Wait for one minute and then go again. minutesWaited++; responseGet = clientToUse.DataLakeAnalyticsAccount.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName); } // Confirm that the account creation did succeed Assert.True(responseGet.DataLakeAnalyticsAccount.Properties.ProvisioningState == DataLakeAnalyticsAccountStatus.Succeeded); // Update the account and confirm the updates make it in. var newAccount = responseGet.DataLakeAnalyticsAccount; var firstStorageAccountName = newAccount.Properties.DataLakeStoreAccounts.ToList()[0].Name; newAccount.Tags = new Dictionary <string, string> { { "updatedKey", "updatedValue" } }; // need to null out deep properties to prevent an error newAccount.Properties.DataLakeStoreAccounts = null; newAccount.Properties.StorageAccounts = null; var updateResponse = clientToUse.DataLakeAnalyticsAccount.Update(commonData.ResourceGroupName, new DataLakeAnalyticsAccountCreateOrUpdateParameters { DataLakeAnalyticsAccount = newAccount, }); Assert.Equal(HttpStatusCode.OK, updateResponse.StatusCode); Assert.Equal(updateResponse.Status, OperationStatus.Succeeded); // get the account and ensure that all the values are properly set. var updateResponseGet = clientToUse.DataLakeAnalyticsAccount.Get(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName); Assert.NotNull(updateResponse.RequestId); Assert.Contains(responseGet.DataLakeAnalyticsAccount.Id, updateResponseGet.DataLakeAnalyticsAccount.Id); Assert.Equal(responseGet.DataLakeAnalyticsAccount.Location, updateResponseGet.DataLakeAnalyticsAccount.Location); Assert.Equal(newAccount.Name, updateResponseGet.DataLakeAnalyticsAccount.Name); Assert.Equal(responseGet.DataLakeAnalyticsAccount.Type, updateResponseGet.DataLakeAnalyticsAccount.Type); // verify the new tags. NOTE: sequence equal is not ideal if we have more than 1 tag, since the ordering can change. Assert.True(updateResponseGet.DataLakeAnalyticsAccount.Tags.SequenceEqual(newAccount.Tags)); Assert.True(updateResponseGet.DataLakeAnalyticsAccount.Properties.DataLakeStoreAccounts.Count == 1); Assert.True(updateResponseGet.DataLakeAnalyticsAccount.Properties.DataLakeStoreAccounts.ToList()[0].Name.Equals(firstStorageAccountName)); // Create another account and ensure that list account returns both var accountToChange = responseGet.DataLakeAnalyticsAccount; accountToChange.Name = accountToChange.Name + "secondacct"; var parameters = new DataLakeAnalyticsAccountCreateOrUpdateParameters { DataLakeAnalyticsAccount = accountToChange }; clientToUse.DataLakeAnalyticsAccount.Create(commonData.ResourceGroupName, parameters); DataLakeAnalyticsAccountListResponse listResponse = clientToUse.DataLakeAnalyticsAccount.List(commonData.ResourceGroupName, null); // Assert that there are at least two accounts in the list Assert.True(listResponse.Value.Count > 1); // Add, list and remove a data source to the first account var addDataSourceResponse = clientToUse.DataLakeAnalyticsAccount.AddDataLakeStoreAccount(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, commonData.SecondDataLakeStoreAccountName, new AddDataLakeStoreParameters { Properties = new DataLakeStoreAccountProperties { Suffix = commonData.DataLakeStoreAccountSuffix } }); Assert.Equal(HttpStatusCode.OK, addDataSourceResponse.StatusCode); // Get the data sources and confirm there are 2 var getDataSourceResponse = clientToUse.DataLakeAnalyticsAccount.ListDataLakeStoreAccounts(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, null); Assert.Equal(HttpStatusCode.OK, getDataSourceResponse.StatusCode); Assert.Equal(2, getDataSourceResponse.Value.Count); // get the specific data source var getSingleDataSourceResponse = clientToUse.DataLakeAnalyticsAccount.GetDataLakeStoreAccount(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, commonData.SecondDataLakeStoreAccountName); Assert.Equal(HttpStatusCode.OK, getSingleDataSourceResponse.StatusCode); Assert.Equal(commonData.SecondDataLakeStoreAccountName, getSingleDataSourceResponse.DataLakeStoreAccount.Name); Assert.Equal(commonData.SecondDataLakeStoreAccountSuffix, getSingleDataSourceResponse.DataLakeStoreAccount.Properties.Suffix); // Remove the data source we added var removeDataSourceResponse = clientToUse.DataLakeAnalyticsAccount.DeleteDataLakeStoreAccount(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, commonData.SecondDataLakeStoreAccountName); Assert.Equal(HttpStatusCode.OK, removeDataSourceResponse.StatusCode); // Confirm that there is now only one data source. getDataSourceResponse = clientToUse.DataLakeAnalyticsAccount.ListDataLakeStoreAccounts(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, null); Assert.Equal(HttpStatusCode.OK, getDataSourceResponse.StatusCode); Assert.Equal(1, getDataSourceResponse.Value.Count); // Add, list and remove an azure blob source to the first account var addDataSourceBlobResponse = clientToUse.DataLakeAnalyticsAccount.AddStorageAccount(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, commonData.StorageAccountName, new AddStorageAccountParameters { Properties = new StorageAccountProperties { Suffix = commonData.StorageAccountSuffix, AccessKey = commonData.StorageAccountAccessKey } }); Assert.Equal(HttpStatusCode.OK, addDataSourceBlobResponse.StatusCode); // Get the data sources and confirm there is 1 var getDataSourceBlobResponse = clientToUse.DataLakeAnalyticsAccount.ListStorageAccounts(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, null); Assert.Equal(HttpStatusCode.OK, getDataSourceBlobResponse.StatusCode); Assert.Equal(1, getDataSourceBlobResponse.Value.Count); // Get the specific data source we added and confirm that it has the same properties var getSingleDataSourceBlobResponse = clientToUse.DataLakeAnalyticsAccount.GetStorageAccount(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, commonData.StorageAccountName); Assert.Equal(HttpStatusCode.OK, getSingleDataSourceBlobResponse.StatusCode); Assert.Equal(commonData.StorageAccountName, getSingleDataSourceBlobResponse.StorageAccount.Name); Assert.True(string.IsNullOrEmpty(getSingleDataSourceBlobResponse.StorageAccount.Properties.AccessKey)); Assert.Equal(commonData.StorageAccountSuffix, getSingleDataSourceBlobResponse.StorageAccount.Properties.Suffix); // Remove the data source we added var removeDataSourceBlobResponse = clientToUse.DataLakeAnalyticsAccount.DeleteStorageAccount(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, commonData.StorageAccountName); Assert.Equal(HttpStatusCode.OK, removeDataSourceBlobResponse.StatusCode); // Confirm that there no azure data sources. getDataSourceBlobResponse = clientToUse.DataLakeAnalyticsAccount.ListStorageAccounts(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName, null); Assert.Equal(HttpStatusCode.OK, getDataSourceResponse.StatusCode); Assert.Equal(0, getDataSourceBlobResponse.Value.Count); // Delete the account and confirm that it is deleted. AzureOperationResponse deleteResponse = clientToUse.DataLakeAnalyticsAccount.Delete(commonData.ResourceGroupName, newAccount.Name); // define the list of accepted status codes when deleting an account. List <HttpStatusCode> acceptedStatusCodes = new List <HttpStatusCode> { HttpStatusCode.OK, HttpStatusCode.Accepted, HttpStatusCode.NotFound, HttpStatusCode.NoContent }; Assert.Contains <HttpStatusCode>(deleteResponse.StatusCode, acceptedStatusCodes); Assert.NotNull(deleteResponse.RequestId); // delete the account again and make sure it continues to result in a succesful code. deleteResponse = clientToUse.DataLakeAnalyticsAccount.Delete(commonData.ResourceGroupName, newAccount.Name); Assert.Contains <HttpStatusCode>(deleteResponse.StatusCode, acceptedStatusCodes); // delete the account with its old name, which should also succeed. deleteResponse = clientToUse.DataLakeAnalyticsAccount.Delete(commonData.ResourceGroupName, commonData.DataLakeAnalyticsAccountName); Assert.Contains <HttpStatusCode>(deleteResponse.StatusCode, acceptedStatusCodes); // delete the second account that was created to ensure that we properly clean up after ourselves. deleteResponse = clientToUse.DataLakeAnalyticsAccount.Delete(commonData.ResourceGroupName, accountToChange.Name); Assert.Contains <HttpStatusCode>(deleteResponse.StatusCode, acceptedStatusCodes); } finally { // we don't catch any exceptions, those should all be bubbled up. UndoContext.Current.UndoAll(); TestUtilities.EndTest(); } }