diff --git a/src/DevOpsMetrics.Core/Models/Common/DORASummaryItem.cs b/src/DevOpsMetrics.Core/Models/Common/DORASummaryItem.cs index 7370f379..83f06542 100644 --- a/src/DevOpsMetrics.Core/Models/Common/DORASummaryItem.cs +++ b/src/DevOpsMetrics.Core/Models/Common/DORASummaryItem.cs @@ -10,6 +10,10 @@ public string Repo { get; set; } + public float DeploymentFrequency + { + get; set; + } public string DeploymentFrequencyBadgeURL { get; set; @@ -18,6 +22,10 @@ public string DeploymentFrequencyBadgeWithMetricURL { get; set; } + public float LeadTimeForChanges + { + get; set; + } public string LeadTimeForChangesBadgeURL { get; set; @@ -26,6 +34,10 @@ public string LeadTimeForChangesBadgeWithMetricURL { get; set; } + public float MeanTimeToRestore + { + get; set; + } public string MeanTimeToRestoreBadgeURL { get; set; @@ -34,6 +46,10 @@ public string MeanTimeToRestoreBadgeWithMetricURL { get; set; } + public float ChangeFailureRate + { + get; set; + } public string ChangeFailureRateBadgeURL { get; set; diff --git a/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs b/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs index 72d33136..c5b27c4a 100644 --- a/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs +++ b/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs @@ -176,12 +176,16 @@ public async Task UpdateDORASummaryItem( { Owner = owner, Repo = repo, + DeploymentFrequency = deploymentFrequencyModel.DeploymentsPerDayMetric, DeploymentFrequencyBadgeURL = deploymentFrequencyModel.BadgeURL, DeploymentFrequencyBadgeWithMetricURL = deploymentFrequencyModel.BadgeWithMetricURL, + LeadTimeForChanges = leadTimeForChangesModel.LeadTimeForChangesMetric, LeadTimeForChangesBadgeURL = leadTimeForChangesModel.BadgeURL, LeadTimeForChangesBadgeWithMetricURL = leadTimeForChangesModel.BadgeWithMetricURL, + MeanTimeToRestore = meanTimeToRestoreModel.MTTRAverageDurationInHours, MeanTimeToRestoreBadgeURL = meanTimeToRestoreModel.BadgeURL, MeanTimeToRestoreBadgeWithMetricURL = meanTimeToRestoreModel.BadgeWithMetricURL, + ChangeFailureRate = changeFailureRateModel.ChangeFailureRateMetric, ChangeFailureRateBadgeURL = changeFailureRateModel.BadgeURL, ChangeFailureRateBadgeWithMetricURL = changeFailureRateModel.BadgeWithMetricURL }; diff --git a/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs b/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs index a96c4624..5dfb5e8d 100644 --- a/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs +++ b/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs @@ -72,8 +72,15 @@ public async Task DORASummaryControllerGitHubUpdateIntegrationTest() branch, workflowName, workflowId, resourceGroup, numberOfDays, maxNumberOfItems, null, true, true); + DORASummaryItem doraSummaryItem = controller.GetDORASummaryItem(organization, repository); + //Assert Assert.IsNotNull(model); + Assert.IsNotNull(doraSummaryItem); + Assert.IsTrue(doraSummaryItem.DeploymentFrequency >= 0); + Assert.IsTrue(doraSummaryItem.LeadTimeForChanges >= 0); + Assert.IsTrue(doraSummaryItem.MeanTimeToRestore >= 0); + Assert.IsTrue(doraSummaryItem.ChangeFailureRate >= -1); //Change failure rate is -1 when there is no data (since 0 means something different from this metric) } [TestMethod]