diff --git a/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs b/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs index efe2209a..14dd4635 100644 --- a/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs +++ b/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs @@ -9,6 +9,7 @@ using Microsoft.Build.Framework; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; namespace DevOpsMetrics.Service.Controllers { @@ -215,10 +216,20 @@ public async Task UpdateDORASummaryItem( owner, repo, branch, workflowName, numberOfDays, maxNumberOfItems); - await Task.WhenAll(deploymentFrequencyTask, leadTimeForChangesTask, meanTimeToRestoreTask, changeFailureRateTask); + if (meanTimeToRestoreTask != null) + { + await Task.WhenAll(deploymentFrequencyTask, leadTimeForChangesTask, meanTimeToRestoreTask, changeFailureRateTask); + } + else + { + await Task.WhenAll(deploymentFrequencyTask, leadTimeForChangesTask, changeFailureRateTask); + } deploymentFrequencyModel = await deploymentFrequencyTask; leadTimeForChangesModel = await leadTimeForChangesTask; - meanTimeToRestoreModel = await meanTimeToRestoreTask; + if (meanTimeToRestoreTask != null) + { + meanTimeToRestoreModel = await meanTimeToRestoreTask; + } changeFailureRateModel = await changeFailureRateTask; } else diff --git a/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs b/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs index e46ebd14..bf90ba94 100644 --- a/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs +++ b/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs @@ -50,18 +50,18 @@ public async Task DORASummaryControllerGetIntegrationTest2() public async Task DORASummaryControllerGitHubUpdateIntegrationTest() { //Arrange - string organization = "DeveloperMetrics"; - string repository = "DevOpsMetrics"; - string branch = "main"; - string workflowName = "CI/CD"; - string workflowId = "1162561"; - string resourceGroup = "DevOpsMetrics"; - //string organization = "samsmithnz"; - //string repository = "AzurePipelinesToGitHubActionsConverter"; + //string organization = "DeveloperMetrics"; + //string repository = "DevOpsMetrics"; //string branch = "main"; - //string workflowName = "CI/ CD"; - //string workflowId = "38158"; - //string resourceGroup = null; + //string workflowName = "CI/CD"; + //string workflowId = "1162561"; + //string resourceGroup = "DevOpsMetrics"; + string organization = "samsmithnz"; + string repository = "AzurePipelinesToGitHubActionsConverter"; + string branch = "main"; + string workflowName = "CI/ CD"; + string workflowId = "38158"; + string resourceGroup = null; //string organization = "samsmithnz"; //string repository = "AzurePipelinesToGitHubActionsConverterWeb"; //string branch = "main";