Created
July 5, 2022 08:48
-
-
Save hibri/5f6cbc807f602327ec61c49363e79de0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public async Task Should_have_a_successfull_pipeline_run() | |
{ | |
var tenantId = "xx"; | |
var context = | |
new AuthenticationContext($"https://login.microsoftonline.com/{tenantId}/"); | |
var clientId = "x"; | |
var clientSecret = "x"; | |
var cc = new ClientCredential(clientId, | |
clientSecret); | |
var authResult = await context.AcquireTokenAsync("https://management.azure.com/", cc); | |
// prepare ADF client | |
var cred = new TokenCredentials(authResult.AccessToken); | |
var subscriptionId = "x"; | |
using (var adfClient = new DataFactoryManagementClient(cred)) | |
{ | |
adfClient.SubscriptionId = subscriptionId; | |
var factoryName = "adf-test-spike"; | |
var resourceGroupName = "adf-testing"; | |
string pipelineName = "superawesomepipeline"; | |
var pipelines = await adfClient.Pipelines.ListByFactoryAsync(resourceGroupName, factoryName); | |
Assert.That(pipelines.Any(p => p.Name.Equals(pipelineName)), Is.True); | |
var myPipeline = await adfClient.Pipelines.GetAsync(resourceGroupName, factoryName, pipelineName); | |
myPipeline.Validate(); | |
var runResponse = await adfClient.Pipelines.CreateRunAsync(resourceGroupName, factoryName, pipelineName); | |
var pipelineRun = await adfClient.PipelineRuns.GetAsync(resourceGroupName, factoryName, runResponse.RunId); | |
while (pipelineRun.Status.Equals("Queued") || pipelineRun.Status.Equals("InProgress")) | |
{ | |
Thread.Sleep(1000); | |
pipelineRun = await adfClient.PipelineRuns.GetAsync(resourceGroupName, factoryName, runResponse.RunId); | |
} | |
Assert.That(pipelineRun.Status, Is.EqualTo("Succeeded")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment