diff --git a/GitVersion.yml b/GitVersion.yml index 7993277d..67dd9aed 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1 +1 @@ -next-version: 1.7.0 +next-version: 1.8.0 diff --git a/src/DevOpsMetrics.Core/DataAccess/TableStorage/AzureTableStorageDA.cs b/src/DevOpsMetrics.Core/DataAccess/TableStorage/AzureTableStorageDA.cs index cf02f20b..bf9d15b5 100644 --- a/src/DevOpsMetrics.Core/DataAccess/TableStorage/AzureTableStorageDA.cs +++ b/src/DevOpsMetrics.Core/DataAccess/TableStorage/AzureTableStorageDA.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.ComponentModel.Design; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; @@ -397,10 +398,18 @@ public async Task UpdateProjectLogInStorage(TableStorageConfiguration tabl } public static async Task UpdateDORASummaryItem(TableStorageConfiguration tableStorageConfig, - string owner, string repo, DORASummaryItem DORASummaryItem) + string owner, string project, string repo, DORASummaryItem DORASummaryItem) { string partitionKey = owner; - string rowKey = repo; + string rowKey = ""; + if (project != null) + { + rowKey = project; + } + else + { + rowKey = repo; + } string json = JsonConvert.SerializeObject(DORASummaryItem); AzureStorageTableModel newItem = new(partitionKey, rowKey, json); TableStorageCommonDA tableDA = new(tableStorageConfig.StorageAccountConnectionString, tableStorageConfig.TableDORASummaryItem); diff --git a/src/DevOpsMetrics.Function/NightlyProcessor.cs b/src/DevOpsMetrics.Function/NightlyProcessor.cs index 30ef0803..07c55e8e 100644 --- a/src/DevOpsMetrics.Function/NightlyProcessor.cs +++ b/src/DevOpsMetrics.Function/NightlyProcessor.cs @@ -6,8 +6,6 @@ using DevOpsMetrics.Core.Models.AzureDevOps; using DevOpsMetrics.Core.Models.Common; using DevOpsMetrics.Core.Models.GitHub; -//using DevOpsMetrics.Service; -//using DevOpsMetrics.Service.Controllers; using Microsoft.Azure.KeyVault; using Microsoft.Azure.Services.AppAuthentication; using Microsoft.Azure.WebJobs; @@ -48,45 +46,32 @@ public static async Task Run( string clientId = Configuration["AppSettings:GitHubClientId"]; string clientSecret = Configuration["AppSettings:GitHubClientSecret"]; AzureTableStorageDA azureTableStorageDA = new(); - //SettingsController settingsController = new(Configuration, azureTableStorageDA); - //DORASummaryController doraSummaryController = new(Configuration); List azSettings = await serviceApiClient.GetAzureDevOpsSettings(); List ghSettings = await serviceApiClient.GetGitHubSettings(); - //TableStorageConfiguration tableStorageConfig = Common.GenerateTableStorageConfiguration(Configuration); //Loop through each setting to update the runs, pull requests and pull request commits int numberOfDays = 30; int maxNumberOfItems = 20; int totalResults = 0; - foreach (AzureDevOpsSettings item in azSettings) + foreach (AzureDevOpsSettings azSetting in azSettings) { - // (int, string) buildsUpdated = (0, null); - // (int, string) prsUpdated = (0, null); - // try - // { - log.LogInformation($"Processing Azure DevOps organization {item.Organization}, project {item.Project}"); - // buildsUpdated = await api.UpdateAzureDevOpsBuilds(item.Organization, item.Project, item.Repository, item.Branch, item.BuildName, item.BuildId, numberOfDays, maxNumberOfItems); - // prsUpdated = await api.UpdateAzureDevOpsPullRequests(item.Organization, item.Project, item.Repository, numberOfDays, maxNumberOfItems); - // log.LogInformation($"Processed Azure DevOps organization {item.Organization}, project {item.Project}. {buildsUpdated.Item1} builds and {prsUpdated.Item1} prs/commits updated"); - // totalResults += buildsUpdated.Item1 + prsUpdated.Item1; - // await api.UpdateAzureDevOpsProjectLog(item.Organization, item.Project, item.Repository, buildsUpdated.Item1, prsUpdated.Item1, buildsUpdated.Item2, prsUpdated.Item2, null, null); - // } - // catch (Exception ex) - // { - // string error = $"Exception while processing Azure DevOps organization {item.Organization}, project {item.Project}. {buildsUpdated.Item1} builds and {prsUpdated.Item1} prs/commits updated"; - // log.LogInformation(error); - // await api.UpdateAzureDevOpsProjectLog(item.Organization, item.Project, item.Repository, buildsUpdated.Item1, prsUpdated.Item1, buildsUpdated.Item2, prsUpdated.Item2, ex.Message, error); - // } + log.LogInformation($"Processing Azure DevOps organization {azSetting.Organization}, project {azSetting.Project}"); + ProcessingResult ghResult = await serviceApiClient.UpdateDORASummaryItem( + azSetting.Organization, azSetting.Project, azSetting.Repository, + azSetting.Branch, azSetting.BuildName, azSetting.BuildId, + azSetting.ProductionResourceGroup, + numberOfDays, maxNumberOfItems, false); + totalResults = ghResult.TotalResults; } foreach (GitHubSettings ghSetting in ghSettings) { - + log.LogInformation($"Processing GitHub owner {ghSetting.Owner}, repo {ghSetting.Repo}"); ProcessingResult ghResult = await serviceApiClient.UpdateDORASummaryItem( - ghSetting.Owner, ghSetting.Repo, ghSetting.Branch, + ghSetting.Owner, "", ghSetting.Repo, ghSetting.Branch, ghSetting.WorkflowName, ghSetting.WorkflowId, ghSetting.ProductionResourceGroup, - numberOfDays, maxNumberOfItems); + numberOfDays, maxNumberOfItems, true); totalResults = ghResult.TotalResults; } log.LogInformation($"C# Timer trigger function complete at: {DateTime.Now} after updating {totalResults} records"); diff --git a/src/DevOpsMetrics.Function/ServiceApiClient.cs b/src/DevOpsMetrics.Function/ServiceApiClient.cs index 2497dafb..2bea3472 100644 --- a/src/DevOpsMetrics.Function/ServiceApiClient.cs +++ b/src/DevOpsMetrics.Function/ServiceApiClient.cs @@ -8,6 +8,7 @@ using DevOpsMetrics.Core.Models.Common; using DevOpsMetrics.Core.Models.GitHub; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; using Newtonsoft.Json; namespace DevOpsMetrics.Function @@ -38,9 +39,13 @@ public async Task> GetGitHubSettings() return await GetResponse>(Client, url); } - public async Task UpdateDORASummaryItem(string owner, string repository, string branch, string workflowName, string workflowId, string resourceGroup, int numberOfDays, int maxNumberOfItems) + public async Task UpdateDORASummaryItem( + string owner, string project, string repository, + string branch, string workflowName, string workflowId, + string resourceGroup, int numberOfDays, int maxNumberOfItems, + bool isGitHub = true) { - string url = $"/api/DORASummary/UpdateDORASummaryItem?owner={owner}&repository={repository}&branch={branch}&workflowName={workflowName}&workflowId={workflowId}&resourceGroup={resourceGroup}&numberOfDays={numberOfDays}&maxNumberOfItems={maxNumberOfItems}"; + string url = $"/api/DORASummary/UpdateDORASummaryItem?owner={owner}&project={project}&repository={repository}&branch={branch}&workflowName={workflowName}&workflowId={workflowId}&resourceGroup={resourceGroup}&numberOfDays={numberOfDays}&maxNumberOfItems={maxNumberOfItems}&log=&useCache=true&isGitHub={isGitHub}"; return await GetResponse(Client, url); } diff --git a/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs b/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs index 45f21a45..4ec67697 100644 --- a/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs +++ b/src/DevOpsMetrics.Service/Controllers/DORASummaryController.cs @@ -42,34 +42,58 @@ public DORASummaryItem GetDORASummaryItem(string owner, string repository) [HttpGet("UpdateDORASummaryItem")] public async Task UpdateDORASummaryItem( - string owner, - string repo, - string branch, - string workflowName, - string workflowId, - string resourceGroup, - int numberOfDays, - int maxNumberOfItems, - ILogger log = null, - bool useCache = true) + string owner, + string project, + string repo, + string branch, + string workflowName, + string workflowId, + string resourceGroup, + int numberOfDays, + int maxNumberOfItems, + ILogger log = null, + bool useCache = true, + bool isGitHub = true) { AzureTableStorageDA azureTableStorageDA = new(); TableStorageConfiguration tableStorageConfig = Common.GenerateTableStorageConfiguration(Configuration); - //Get the client id and secret from the settings - string clientIdName = PartitionKeys.CreateGitHubSettingsPartitionKeyClientId(owner, repo); - string clientSecretName = PartitionKeys.CreateGitHubSettingsPartitionKeyClientSecret(owner, repo); - string clientId = Configuration[clientIdName]; - string clientSecret = Configuration[clientSecretName]; - if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(clientSecret)) + string clientId = null; + string clientSecret = null; + string patToken = null; + if (isGitHub == true) + { //Get the client id and secret from the settings + string clientIdName = PartitionKeys.CreateGitHubSettingsPartitionKeyClientId(owner, repo); + string clientSecretName = PartitionKeys.CreateGitHubSettingsPartitionKeyClientSecret(owner, repo); + clientId = Configuration[clientIdName]; + clientSecret = Configuration[clientSecretName]; + if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(clientSecret)) + { + throw new Exception($"clientId '{clientId}' or clientSecret '{clientSecret}' not found in key vault"); + } + } + else { - throw new Exception($"clientId '{clientId}' or clientSecret '{clientSecret}' not found in key vault"); + string patTokenName = PartitionKeys.CreateAzureDevOpsSettingsPartitionKeyPatToken(owner, project, repo); + patToken = Configuration[patTokenName]; + if (string.IsNullOrEmpty(patToken)) + { + throw new Exception($"patToken '{patTokenName}' not found in key vault"); + } } ProcessingResult result = new(); try { + string message = ""; + if (isGitHub == true) + { + message = $"Processing GitHub owner {owner}, repo {repo}"; + } + else + { + message = $"Processing Azure DevOps organization {owner}, project {project}, repo {repo}"; + } //TODO: fix this - should be using a common interface, not this null hack - string message = $"Processing GitHub owner {owner}, repo {repo}"; if (log == null) { Console.WriteLine(message); @@ -78,13 +102,22 @@ public async Task UpdateDORASummaryItem( { log.LogInformation(message); } - result.BuildsUpdated = await azureTableStorageDA.UpdateGitHubActionRunsInStorage(clientId, clientSecret, tableStorageConfig, - owner, repo, branch, workflowName, workflowId, numberOfDays, maxNumberOfItems); - //log.LogInformation($"Processing GitHub owner {item.Owner}, repo {item.Repo}: {buildsUpdated} builds updated"); - result.PRsUpdated = await azureTableStorageDA.UpdateGitHubActionPullRequestsInStorage(clientId, clientSecret, tableStorageConfig, + if (isGitHub == true) + { + result.BuildsUpdated = await azureTableStorageDA.UpdateGitHubActionRunsInStorage(clientId, clientSecret, tableStorageConfig, + owner, repo, branch, workflowName, workflowId, numberOfDays, maxNumberOfItems); + result.PRsUpdated = await azureTableStorageDA.UpdateGitHubActionPullRequestsInStorage(clientId, clientSecret, tableStorageConfig, owner, repo, branch, numberOfDays, maxNumberOfItems); - //log.LogInformation($"Processing GitHub owner {item.Owner}, repo {item.Repo}: {prsUpdated} pull requests updated"); - message = $"Processed GitHub owner {owner}, repo {repo}. {result.BuildsUpdated} builds and {result.PRsUpdated} prs/commits updated"; + message = $"Processed GitHub owner {owner}, repo {repo}. {result.BuildsUpdated} builds and {result.PRsUpdated} prs/commits updated"; + } + else + { + result.BuildsUpdated = await azureTableStorageDA.UpdateAzureDevOpsBuildsInStorage(patToken, tableStorageConfig, + owner, repo, branch, workflowName, workflowId, numberOfDays, maxNumberOfItems); + result.PRsUpdated = await azureTableStorageDA.UpdateAzureDevOpsPullRequestsInStorage(patToken, tableStorageConfig, + owner, repo, branch, numberOfDays, maxNumberOfItems); + message = $"Processed Azure DevOps organization {owner}, project {project}, repo {repo}. {result.BuildsUpdated} builds and {result.PRsUpdated} prs/commits updated"; + } if (log == null) { Console.WriteLine(message); @@ -97,21 +130,35 @@ public async Task UpdateDORASummaryItem( //Process summary results for last 90 days, creating badges for the four metrics //Get the DORA metrics for the last 90 days - DeploymentFrequencyModel deploymentFrequencyModel = await DeploymentFrequencyDA.GetGitHubDeploymentFrequency(false, clientId, clientSecret, tableStorageConfig, - owner, repo, branch, workflowName, workflowId, - numberOfDays, maxNumberOfItems, useCache); + DeploymentFrequencyModel deploymentFrequencyModel = new(); + LeadTimeForChangesModel leadTimeForChangesModel = new(); + if (isGitHub == true) + { + deploymentFrequencyModel = await DeploymentFrequencyDA.GetGitHubDeploymentFrequency(false, clientId, clientSecret, tableStorageConfig, + owner, repo, branch, workflowName, workflowId, + numberOfDays, maxNumberOfItems, useCache); - LeadTimeForChangesModel leadTimeForChangesModel = await LeadTimeForChangesDA.GetGitHubLeadTimesForChanges(false, clientId, clientSecret, tableStorageConfig, - owner, repo, branch, workflowName, workflowId, - numberOfDays, maxNumberOfItems, useCache); + leadTimeForChangesModel = await LeadTimeForChangesDA.GetGitHubLeadTimesForChanges(false, clientId, clientSecret, tableStorageConfig, + owner, repo, branch, workflowName, workflowId, + numberOfDays, maxNumberOfItems, useCache); + } + else + { + deploymentFrequencyModel = await DeploymentFrequencyDA.GetAzureDevOpsDeploymentFrequency(false, patToken, tableStorageConfig, + owner, project, branch, workflowName, + numberOfDays, maxNumberOfItems, useCache); + leadTimeForChangesModel = await LeadTimeForChangesDA.GetAzureDevOpsLeadTimesForChanges(false, patToken, tableStorageConfig, + owner, project, repo, branch, workflowName, + numberOfDays, maxNumberOfItems, useCache); + } MeanTimeToRestoreModel meanTimeToRestoreModel = new(); if (resourceGroup != null) { meanTimeToRestoreModel = MeanTimeToRestoreDA.GetAzureMeanTimeToRestore(false, tableStorageConfig, - DevOpsPlatform.GitHub, - resourceGroup, - numberOfDays, maxNumberOfItems); + DevOpsPlatform.GitHub, + resourceGroup, + numberOfDays, maxNumberOfItems); } else { @@ -120,9 +167,9 @@ public async Task UpdateDORASummaryItem( } ChangeFailureRateModel changeFailureRateModel = ChangeFailureRateDA.GetChangeFailureRate(false, tableStorageConfig, - DevOpsPlatform.GitHub, - owner, repo, branch, workflowName, - numberOfDays, maxNumberOfItems); + DevOpsPlatform.GitHub, + owner, repo, branch, workflowName, + numberOfDays, maxNumberOfItems); //Summarize the results into a new object DORASummaryItem DORASummary = new() @@ -140,13 +187,28 @@ public async Task UpdateDORASummaryItem( }; //Serialize the summary into an Azure storage table - await AzureTableStorageDA.UpdateDORASummaryItem(tableStorageConfig, owner, repo, DORASummary); + await AzureTableStorageDA.UpdateDORASummaryItem(tableStorageConfig, owner, project, repo, DORASummary); //await settingsController.UpdateGitHubProjectLog(ghSetting.Owner, ghSetting.Repo, result.BuildsUpdated, result.PRsUpdated, "", "", null, null); - ProjectLog projectLog = new( - PartitionKeys.CreateGitHubSettingsPartitionKey(owner, repo), - result.BuildsUpdated, result.PRsUpdated, "", "", null, null); - await azureTableStorageDA.UpdateProjectLogInStorage(tableStorageConfig, projectLog); + ProjectLog projectLog = null; + if (isGitHub == true) + { + projectLog = new( + PartitionKeys.CreateGitHubSettingsPartitionKey(owner, repo), + result.BuildsUpdated, result.PRsUpdated, + "", "", null, null); + } + else + { + projectLog = new( + PartitionKeys.CreateAzureDevOpsSettingsPartitionKey(owner, project, repo), + result.BuildsUpdated, result.PRsUpdated, + "", "", null, null); + } + if (projectLog != null) + { + await azureTableStorageDA.UpdateProjectLogInStorage(tableStorageConfig, projectLog); + } } catch (Exception ex) { @@ -159,17 +221,29 @@ public async Task UpdateDORASummaryItem( { log.LogInformation(error); } - //await settingsController.UpdateGitHubProjectLog(ghSetting.Owner, ghSetting.Repo, result.BuildsUpdated, result.PRsUpdated, - // ghSetting.Owner + "_" + ghSetting.Repo + "_" + ghSetting.Branch + "_" + ghSetting.WorkflowName + "_" + ghSetting.WorkflowId + "_" + numberOfDays + "_" + maxNumberOfItems, - // ghSetting.Owner + "_" + ghSetting.Repo + "_" + ghSetting.Branch + "_" + numberOfDays + "_" + maxNumberOfItems, - // ex.ToString(), error); - ProjectLog projectLog = new( - PartitionKeys.CreateGitHubSettingsPartitionKey(owner, repo), - result.BuildsUpdated, result.PRsUpdated, - owner + "_" + repo + "_" + branch + "_" + workflowName + "_" + workflowId + "_" + numberOfDays + "_" + maxNumberOfItems, - owner + "_" + repo + "_" + branch + "_" + numberOfDays + "_" + maxNumberOfItems, - ex.ToString(), error); - await azureTableStorageDA.UpdateProjectLogInStorage(tableStorageConfig, projectLog); + ProjectLog projectLog; + if (isGitHub == true) + { + projectLog = new( + PartitionKeys.CreateGitHubSettingsPartitionKey(owner, repo), + result.BuildsUpdated, result.PRsUpdated, + owner + "_" + repo + "_" + branch + "_" + workflowName + "_" + workflowId + "_" + numberOfDays + "_" + maxNumberOfItems, + owner + "_" + repo + "_" + branch + "_" + numberOfDays + "_" + maxNumberOfItems, + ex.ToString(), error); + } + else + { + projectLog = new( + PartitionKeys.CreateAzureDevOpsSettingsPartitionKey(owner, project, repo), + result.BuildsUpdated, result.PRsUpdated, + owner + "_" + project + "_" + repo + "_" + branch + "_" + workflowName + "_" + workflowId + "_" + numberOfDays + "_" + maxNumberOfItems, + owner + "_" + project + "_" + repo + "_" + branch + "_" + numberOfDays + "_" + maxNumberOfItems, + ex.ToString(), error); + } + if (projectLog != null) + { + await azureTableStorageDA.UpdateProjectLogInStorage(tableStorageConfig, projectLog); + } } return result; diff --git a/src/DevOpsMetrics.Service/Controllers/LeadTimeForChangesController.cs b/src/DevOpsMetrics.Service/Controllers/LeadTimeForChangesController.cs index 02027b30..7babbb05 100644 --- a/src/DevOpsMetrics.Service/Controllers/LeadTimeForChangesController.cs +++ b/src/DevOpsMetrics.Service/Controllers/LeadTimeForChangesController.cs @@ -33,7 +33,6 @@ public async Task GetAzureDevOpsLeadTimeForChanges(bool //Get the PAT token from the key vault string patTokenName = PartitionKeys.CreateAzureDevOpsSettingsPartitionKeyPatToken(organization, project, repository); - patTokenName = SecretsProcessing.CleanKey(patTokenName); string patToken = Configuration[patTokenName]; if (string.IsNullOrEmpty(patToken)) { diff --git a/src/DevOpsMetrics.Tests/Core/AzureMonitorTests.cs b/src/DevOpsMetrics.Tests/Core/AzureMonitorTests.cs index db195805..0bc241c9 100644 --- a/src/DevOpsMetrics.Tests/Core/AzureMonitorTests.cs +++ b/src/DevOpsMetrics.Tests/Core/AzureMonitorTests.cs @@ -7,7 +7,7 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] public class AzureMonitorTests : BaseConfiguration { diff --git a/src/DevOpsMetrics.Tests/Core/ChangeFailureRateDATests.cs b/src/DevOpsMetrics.Tests/Core/ChangeFailureRateDATests.cs index 4fe3a4c6..ab9f8e16 100644 --- a/src/DevOpsMetrics.Tests/Core/ChangeFailureRateDATests.cs +++ b/src/DevOpsMetrics.Tests/Core/ChangeFailureRateDATests.cs @@ -7,11 +7,12 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] public class ChangeFailureRateDATests : BaseConfiguration { + [TestCategory("UnitTest")] [TestMethod] public void AzChangeFailureRateDAIntegrationTest() { @@ -74,6 +75,7 @@ public void AzChangeFailureRateDAIntegrationTest() // Assert.AreNotEqual("Elite", model.ChangeFailureRateMetricDescription); //} + [TestCategory("UnitTest")] [TestMethod] public void GHChangeFailureRateDAIntegrationTest() { @@ -83,7 +85,7 @@ public void GHChangeFailureRateDAIntegrationTest() string owner = "DeveloperMetrics"; string repo = "DevOpsMetrics"; string branch = "main"; - string workflowName = "DevOpsMetrics CI/CD"; + string workflowName = "CI/CD"; DevOpsPlatform targetDevOpsPlatform = DevOpsPlatform.GitHub; int numberOfDays = 30; int maxNumberOfItems = 20; diff --git a/src/DevOpsMetrics.Tests/Core/ChangeFailureRateTests.cs b/src/DevOpsMetrics.Tests/Core/ChangeFailureRateTests.cs index e2aa5577..d436a32c 100644 --- a/src/DevOpsMetrics.Tests/Core/ChangeFailureRateTests.cs +++ b/src/DevOpsMetrics.Tests/Core/ChangeFailureRateTests.cs @@ -7,7 +7,7 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class ChangeFailureRateTests { diff --git a/src/DevOpsMetrics.Tests/Core/DeploymentFrequencyDATests.cs b/src/DevOpsMetrics.Tests/Core/DeploymentFrequencyDATests.cs index d3828ea4..fd4c97e7 100644 --- a/src/DevOpsMetrics.Tests/Core/DeploymentFrequencyDATests.cs +++ b/src/DevOpsMetrics.Tests/Core/DeploymentFrequencyDATests.cs @@ -7,10 +7,11 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] public class DeploymentFrequencyDATests : BaseConfiguration { + [TestCategory("UnitTest")] [TestMethod] public async Task AzDeploymentFrequencyDAIntegrationTest() { @@ -42,6 +43,7 @@ public async Task AzDeploymentFrequencyDAIntegrationTest() Assert.IsTrue(model.ItemOrder == 0); } + [TestCategory("UnitTest")] [TestMethod] public async Task GHDeploymentFrequencyDAIntegrationTest() { @@ -53,7 +55,7 @@ public async Task GHDeploymentFrequencyDAIntegrationTest() string owner = "DeveloperMetrics"; string repo = "DevOpsMetrics"; string branch = "main"; - string workflowName = "DevOpsMetrics CI/CD"; + string workflowName = "CI/CD"; string workflowId = "1162561"; int numberOfDays = 30; int maxNumberOfItems = 20; diff --git a/src/DevOpsMetrics.Tests/Core/DeploymentFrequencyTests.cs b/src/DevOpsMetrics.Tests/Core/DeploymentFrequencyTests.cs index e59a37d0..62cf7089 100644 --- a/src/DevOpsMetrics.Tests/Core/DeploymentFrequencyTests.cs +++ b/src/DevOpsMetrics.Tests/Core/DeploymentFrequencyTests.cs @@ -7,7 +7,7 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class DeploymentFrequencyTests { diff --git a/src/DevOpsMetrics.Tests/Core/FractionConverterTests.cs b/src/DevOpsMetrics.Tests/Core/FractionConverterTests.cs index bda6d09d..93d59968 100644 --- a/src/DevOpsMetrics.Tests/Core/FractionConverterTests.cs +++ b/src/DevOpsMetrics.Tests/Core/FractionConverterTests.cs @@ -4,7 +4,7 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class FractionConverterTests { diff --git a/src/DevOpsMetrics.Tests/Core/LeadTimeForChangesDATests.cs b/src/DevOpsMetrics.Tests/Core/LeadTimeForChangesDATests.cs index 5770a2c5..6694a702 100644 --- a/src/DevOpsMetrics.Tests/Core/LeadTimeForChangesDATests.cs +++ b/src/DevOpsMetrics.Tests/Core/LeadTimeForChangesDATests.cs @@ -8,10 +8,11 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] public class LeadTimeForChangesDATests : BaseConfiguration { + [TestCategory("UnitTest")] [TestMethod] public async Task AzLeadTimeForChangesDAIntegrationTest() { @@ -58,6 +59,7 @@ public async Task AzLeadTimeForChangesDAIntegrationTest() Assert.IsTrue(model.TotalItems > 0); } + [TestCategory("UnitTest")] [TestMethod] public async Task GHLeadTimeForChangesDAIntegrationTest() { @@ -69,7 +71,7 @@ public async Task GHLeadTimeForChangesDAIntegrationTest() string owner = "DeveloperMetrics"; string repo = "devopsmetrics"; string mainBranch = "main"; - string workflowName = "DevOpsMetrics.CI"; + string workflowName = "CI/CD"; string workflowId = "1162561"; int numberOfDays = 7; int maxNumberOfItems = 20; diff --git a/src/DevOpsMetrics.Tests/Core/LeadTimeForChangesTests.cs b/src/DevOpsMetrics.Tests/Core/LeadTimeForChangesTests.cs index 6e4c97fb..6cf623e2 100644 --- a/src/DevOpsMetrics.Tests/Core/LeadTimeForChangesTests.cs +++ b/src/DevOpsMetrics.Tests/Core/LeadTimeForChangesTests.cs @@ -7,7 +7,7 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class LeadTimeForChangesTests { diff --git a/src/DevOpsMetrics.Tests/Core/MeanTimeToRestoreDATests.cs b/src/DevOpsMetrics.Tests/Core/MeanTimeToRestoreDATests.cs index 5ec8e158..3938977b 100644 --- a/src/DevOpsMetrics.Tests/Core/MeanTimeToRestoreDATests.cs +++ b/src/DevOpsMetrics.Tests/Core/MeanTimeToRestoreDATests.cs @@ -6,10 +6,11 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] public class MeanTimeToRestoreDATests : BaseConfiguration { + [TestCategory("UnitTest")] [TestMethod] public void MeanTimeToRestoreDAIntegrationTest() { diff --git a/src/DevOpsMetrics.Tests/Core/MeanTimeToRestoreTests.cs b/src/DevOpsMetrics.Tests/Core/MeanTimeToRestoreTests.cs index 77221545..dad82f8f 100644 --- a/src/DevOpsMetrics.Tests/Core/MeanTimeToRestoreTests.cs +++ b/src/DevOpsMetrics.Tests/Core/MeanTimeToRestoreTests.cs @@ -7,7 +7,7 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class MeanTimeToRestoreTests { diff --git a/src/DevOpsMetrics.Tests/Core/PostiveNegativeListDATests.cs b/src/DevOpsMetrics.Tests/Core/PostiveNegativeListTests.cs similarity index 98% rename from src/DevOpsMetrics.Tests/Core/PostiveNegativeListDATests.cs rename to src/DevOpsMetrics.Tests/Core/PostiveNegativeListTests.cs index 6ad323b9..a1dd999d 100644 --- a/src/DevOpsMetrics.Tests/Core/PostiveNegativeListDATests.cs +++ b/src/DevOpsMetrics.Tests/Core/PostiveNegativeListTests.cs @@ -7,9 +7,9 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] - public class PostiveNegativeListDATests + public class PostiveNegativeListTests { [TestMethod] diff --git a/src/DevOpsMetrics.Tests/Core/SLATests.cs b/src/DevOpsMetrics.Tests/Core/SLATests.cs index a7ff3316..dc8bf694 100644 --- a/src/DevOpsMetrics.Tests/Core/SLATests.cs +++ b/src/DevOpsMetrics.Tests/Core/SLATests.cs @@ -6,7 +6,7 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class SLATests { diff --git a/src/DevOpsMetrics.Tests/Core/SettingsDATests.cs b/src/DevOpsMetrics.Tests/Core/SettingsDATests.cs index cfe68747..ad4442cd 100644 --- a/src/DevOpsMetrics.Tests/Core/SettingsDATests.cs +++ b/src/DevOpsMetrics.Tests/Core/SettingsDATests.cs @@ -10,7 +10,7 @@ namespace DevOpsMetrics.Tests.Core { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] public class SettingsDATests : BaseConfiguration { diff --git a/src/DevOpsMetrics.Tests/Service/BadgeTests.cs b/src/DevOpsMetrics.Tests/Service/BadgeTests.cs index a1658dfc..4e94b99b 100644 --- a/src/DevOpsMetrics.Tests/Service/BadgeTests.cs +++ b/src/DevOpsMetrics.Tests/Service/BadgeTests.cs @@ -4,12 +4,11 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class BadgeTests { - [TestCategory("L0Test")] [TestMethod] public void DeploymentFrequencyEliteBadgeTest() { @@ -29,7 +28,6 @@ public void DeploymentFrequencyEliteBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void DeploymentFrequencyHighBadgeTest() { @@ -47,7 +45,6 @@ public void DeploymentFrequencyHighBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void DeploymentFrequencyMediumBadgeTest() { @@ -65,7 +62,6 @@ public void DeploymentFrequencyMediumBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void DeploymentFrequencyLowBadgeTest() { @@ -83,7 +79,6 @@ public void DeploymentFrequencyLowBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void DeploymentFrequencyNoneBadgeTest() { @@ -100,7 +95,6 @@ public void DeploymentFrequencyNoneBadgeTest() Assert.AreEqual("https://img.shields.io/badge/Deployment%20frequency-None-lightgrey", model.BadgeURL); } - [TestCategory("L0Test")] [TestMethod] public void ChangeFailureRateControllerHighBadgeTest() { @@ -118,7 +112,6 @@ public void ChangeFailureRateControllerHighBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void ChangeFailureRateControllerMediumBadgeTest() { @@ -136,7 +129,6 @@ public void ChangeFailureRateControllerMediumBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void ChangeFailureRateControllerLowBadgeTest() { @@ -154,7 +146,6 @@ public void ChangeFailureRateControllerLowBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void ChangeFailureRateControllerNoneBadgeTest() { @@ -171,7 +162,6 @@ public void ChangeFailureRateControllerNoneBadgeTest() Assert.AreEqual("https://img.shields.io/badge/Change%20failure%20rate-None-lightgrey", model.BadgeURL); } - [TestCategory("L0Test")] [TestMethod] public void LeadTimeForChangesEliteBadgeTest() { @@ -191,7 +181,6 @@ public void LeadTimeForChangesEliteBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void LeadTimeForChangesHighBadgeTest() { @@ -209,7 +198,6 @@ public void LeadTimeForChangesHighBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void LeadTimeForChangesMediumBadgeTest() { @@ -227,7 +215,6 @@ public void LeadTimeForChangesMediumBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void LeadTimeForChangesLowBadgeTest() { @@ -245,7 +232,6 @@ public void LeadTimeForChangesLowBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void LeadTimeForChangesNoneBadgeTest() { @@ -263,7 +249,6 @@ public void LeadTimeForChangesNoneBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void MeanTimeToRestoreEliteBadgeTest() { @@ -283,7 +268,6 @@ public void MeanTimeToRestoreEliteBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void MeanTimeToRestoreHighBadgeTest() { @@ -301,7 +285,6 @@ public void MeanTimeToRestoreHighBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void MeanTimeToRestoreMediumBadgeTest() { @@ -319,7 +302,6 @@ public void MeanTimeToRestoreMediumBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void MeanTimeToRestoreLowBadgeTest() { @@ -337,7 +319,6 @@ public void MeanTimeToRestoreLowBadgeTest() } - [TestCategory("L0Test")] [TestMethod] public void MeanTimeToRestoreNoneBadgeTest() { diff --git a/src/DevOpsMetrics.Tests/Service/ChangeFailureRateTests.cs b/src/DevOpsMetrics.Tests/Service/ChangeFailureRateControllerTests.cs similarity index 70% rename from src/DevOpsMetrics.Tests/Service/ChangeFailureRateTests.cs rename to src/DevOpsMetrics.Tests/Service/ChangeFailureRateControllerTests.cs index 17eb0e88..4c795dd0 100644 --- a/src/DevOpsMetrics.Tests/Service/ChangeFailureRateTests.cs +++ b/src/DevOpsMetrics.Tests/Service/ChangeFailureRateControllerTests.cs @@ -5,9 +5,9 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("UnitTest")] [TestClass] - public class ChangeFailureRateTests : BaseConfiguration + public class ChangeFailureRateControllerTests : BaseConfiguration { [TestMethod] public void AzChangeFailureRateSampleControllerIntegrationTest() @@ -39,7 +39,7 @@ public void AzChangeFailureRateSampleControllerIntegrationTest() Assert.IsTrue(model.TotalItems > 0); } - //[TestCategory("L1Test")] + //[TestCategory("IntegrationTest")] //[TestMethod] //public void AzChangeFailureRateLiveControllerIntegrationTest() //{ @@ -69,16 +69,19 @@ public void AzChangeFailureRateSampleControllerIntegrationTest() // Assert.IsTrue(model.TotalItems > 0); //} - [TestCategory("L1Test")] [TestMethod] public void GHChangeFailureRateSampleControllerIntegrationTest() { //Arrange bool getSampleData = true; + //string owner = "samsmithnz"; + //string repo = "SamsFeatureFlags"; + //string branch = "main"; + //string workflowName = "SamsFeatureFlags.CI/CD"; string owner = "samsmithnz"; - string repo = "SamsFeatureFlags"; + string repo = "AzurePipelinesToGitHubActionsConverter"; string branch = "main"; - string workflowName = "SamsFeatureFlags.CI/CD"; + string workflowName = "CI/ CD"; DevOpsPlatform targetDevOpsPlatform = DevOpsPlatform.GitHub; int numberOfDays = 7; int maxNumberOfItems = 20; @@ -100,36 +103,36 @@ public void GHChangeFailureRateSampleControllerIntegrationTest() Assert.IsTrue(model.TotalItems > 0); } - //[TestCategory("L1Test")] - //[TestMethod] - //public void GHChangeFailureRateLiveControllerIntegrationTest() - //{ - // //Arrange - // bool getSampleData = false; - // string owner = "samsmithnz"; - // string repo = "SamsFeatureFlags"; - // string branch = "main"; - // string workflowName = "SamsFeatureFlags.CI/CD"; - // DevOpsPlatform targetDevOpsPlatform = DevOpsPlatform.GitHub; - // int numberOfDays = 7; - // int maxNumberOfItems = 20; - // ChangeFailureRateController controller = new(base.Configuration); + [TestCategory("IntegrationTest")] + [TestMethod] + public void GHChangeFailureRateLiveControllerIntegrationTest() + { + //Arrange + bool getSampleData = false; + string owner = "samsmithnz"; + string repo = "AzurePipelinesToGitHubActionsConverter"; + string branch = "main"; + string workflowName = "CI/ CD"; + DevOpsPlatform targetDevOpsPlatform = DevOpsPlatform.GitHub; + int numberOfDays = 30; + int maxNumberOfItems = 20; + ChangeFailureRateController controller = new(base.Configuration); - // //Act - // ChangeFailureRateModel model = controller.GetChangeFailureRate(getSampleData, - // targetDevOpsPlatform, owner, repo, branch, workflowName, numberOfDays, maxNumberOfItems); + //Act + ChangeFailureRateModel model = controller.GetChangeFailureRate(getSampleData, + targetDevOpsPlatform, owner, repo, branch, workflowName, numberOfDays, maxNumberOfItems); - // //Assert - // Assert.IsTrue(model != null); - // Assert.IsTrue(model.TargetDevOpsPlatform == targetDevOpsPlatform); - // Assert.IsTrue(model.DeploymentName == workflowName); - // Assert.IsTrue(model.ChangeFailureRateMetric >= 0f); - // Assert.AreEqual(false, string.IsNullOrEmpty(model.ChangeFailureRateMetricDescription)); - // Assert.AreEqual(numberOfDays, model.NumberOfDays); - // Assert.IsTrue(model.MaxNumberOfItems > 0); - // Assert.IsTrue(model.TotalItems > 0); + //Assert + Assert.IsTrue(model != null); + Assert.IsTrue(model.TargetDevOpsPlatform == targetDevOpsPlatform); + Assert.IsTrue(model.DeploymentName == workflowName); + Assert.IsTrue(model.ChangeFailureRateMetric >= 0f); + Assert.AreEqual(false, string.IsNullOrEmpty(model.ChangeFailureRateMetricDescription)); + Assert.AreEqual(numberOfDays, model.NumberOfDays); + Assert.IsTrue(model.MaxNumberOfItems > 0); + Assert.IsTrue(model.TotalItems > 0); - //} + } } diff --git a/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs b/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs index c69567ce..e23fd5cc 100644 --- a/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs +++ b/src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs @@ -6,7 +6,7 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] public class DORASummaryControllerTests : BaseConfiguration { @@ -42,33 +42,111 @@ public void DORASummaryControllerGetIntegrationTest2() } [TestMethod] - public async Task DORASummaryControllerUpdateIntegrationTest() + public async Task DORASummaryControllerGitHubUpdateIntegrationTest() { //Arrange - string organization = "samsmithnz"; - string repository = "AzurePipelinesToGitHubActionsConverter"; - string branch = "main"; - string workflowName = "CI/CD"; - string workflowId = "38158"; - string resourceGroup = "PipelinesToActions"; //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 branch = "main"; + string workflowName = "CI/ CD"; + string workflowId = "38158"; + string resourceGroup = null; + int numberOfDays = 30; + int maxNumberOfItems = 20; + DORASummaryController controller = new(base.Configuration); + + //Act + ProcessingResult model = await controller.UpdateDORASummaryItem(organization, "", repository, + branch, workflowName, workflowId, resourceGroup, numberOfDays, maxNumberOfItems, + null, true, true); + + //Assert + Assert.IsNotNull(model); + } + + [TestMethod] + public async Task DORASummaryControllerAzureDevOpsUpdateIntegrationTest() + { + //Arrange + string organization = "samsmithnz"; + string project = "AzDoDevOpsMetrics"; + string repository = "AzDoDevOpsMetrics"; + string branch = "refs/heads/main"; + string buildName = "azure-pipelines.yml"; + string buildId = "3673"; + string resourceGroup = null; int numberOfDays = 30; int maxNumberOfItems = 20; DORASummaryController controller = new(base.Configuration); //Act - ProcessingResult model = await controller.UpdateDORASummaryItem(organization, repository, - branch, workflowName, workflowId, resourceGroup, numberOfDays, maxNumberOfItems); + ProcessingResult model = await controller.UpdateDORASummaryItem(organization, project, repository, + branch, buildName, buildId, resourceGroup, numberOfDays, maxNumberOfItems, + null, true, false); //Assert Assert.IsNotNull(model); - //Assert.IsTrue(model.TotalResults > 0); } + //[TestMethod] + //public async Task DORASummaryControllerUpdateALLIntegrationTest() + //{ + // //Arrange + // int numberOfDays = 30; + // int maxNumberOfItems = 20; + // int totalResults = 0; + // DORASummaryController controller = new(base.Configuration); + // SettingsController settingsController = new(base.Configuration, new AzureTableStorageDA()); + + // //Act + // List azSettings = settingsController.GetAzureDevOpsSettings(); + // List ghSettings = settingsController.GetGitHubSettings(); + + // foreach (AzureDevOpsSettings item in azSettings) + // { + // // (int, string) buildsUpdated = (0, null); + // // (int, string) prsUpdated = (0, null); + // // try + // // { + // //log.LogInformation($"Processing Azure DevOps organization {item.Organization}, project {item.Project}"); + // // buildsUpdated = await api.UpdateAzureDevOpsBuilds(item.Organization, item.Project, item.Repository, item.Branch, item.BuildName, item.BuildId, numberOfDays, maxNumberOfItems); + // // prsUpdated = await api.UpdateAzureDevOpsPullRequests(item.Organization, item.Project, item.Repository, numberOfDays, maxNumberOfItems); + // // log.LogInformation($"Processed Azure DevOps organization {item.Organization}, project {item.Project}. {buildsUpdated.Item1} builds and {prsUpdated.Item1} prs/commits updated"); + // // totalResults += buildsUpdated.Item1 + prsUpdated.Item1; + // // await api.UpdateAzureDevOpsProjectLog(item.Organization, item.Project, item.Repository, buildsUpdated.Item1, prsUpdated.Item1, buildsUpdated.Item2, prsUpdated.Item2, null, null); + // // } + // // catch (Exception ex) + // // { + // // string error = $"Exception while processing Azure DevOps organization {item.Organization}, project {item.Project}. {buildsUpdated.Item1} builds and {prsUpdated.Item1} prs/commits updated"; + // // log.LogInformation(error); + // // await api.UpdateAzureDevOpsProjectLog(item.Organization, item.Project, item.Repository, buildsUpdated.Item1, prsUpdated.Item1, buildsUpdated.Item2, prsUpdated.Item2, ex.Message, error); + // // } + // } + + // foreach (GitHubSettings ghSetting in ghSettings) + // { + // Debug.WriteLine($"Owner {ghSetting.Owner}, Repo {ghSetting.Repo}"); + // ProcessingResult ghResult = await controller.UpdateDORASummaryItem( + // ghSetting.Owner, ghSetting.Repo, ghSetting.Branch, + // ghSetting.WorkflowName, ghSetting.WorkflowId, + // ghSetting.ProductionResourceGroup, + // numberOfDays, maxNumberOfItems); + // totalResults += ghResult.TotalResults; + // Assert.IsNotNull(ghResult); + // } + + // //ProcessingResult model = await controller.UpdateDORASummaryItem(organization, repository, + // // branch, workflowName, workflowId, resourceGroup, numberOfDays, maxNumberOfItems); + + // //Assert + // Assert.IsTrue(totalResults > 0); + //} + } } diff --git a/src/DevOpsMetrics.Tests/Service/DeploymentFrequencyControllerTests.cs b/src/DevOpsMetrics.Tests/Service/DeploymentFrequencyControllerTests.cs index 4ba95b91..a119fa67 100644 --- a/src/DevOpsMetrics.Tests/Service/DeploymentFrequencyControllerTests.cs +++ b/src/DevOpsMetrics.Tests/Service/DeploymentFrequencyControllerTests.cs @@ -7,10 +7,11 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] - public class DeploymentFrequencyL1s : BaseConfiguration + public class DeploymentFrequencyControllerTests : BaseConfiguration { + [TestCategory("UnitTest")] [TestMethod] public async Task AzDeploymentsSampleControllerIntegrationTest() { @@ -135,6 +136,7 @@ public async Task AzDeploymentsCacheControllerIntegrationTest() } + [TestCategory("UnitTest")] [TestMethod] public async Task GHDeploymentsSampleControllerIntegrationTest() { @@ -306,6 +308,7 @@ public async Task AzDeploymentsControllerAPILiveWithCacheIntegrationTest() + [TestCategory("UnitTest")] [TestMethod] public async Task GHDeploymentsControllerAPILiveWithCacheIntegrationTest() { diff --git a/src/DevOpsMetrics.Tests/Service/LeadTimeForChangesControllerTests.cs b/src/DevOpsMetrics.Tests/Service/LeadTimeForChangesControllerTests.cs index eb233d2f..c43d2c06 100644 --- a/src/DevOpsMetrics.Tests/Service/LeadTimeForChangesControllerTests.cs +++ b/src/DevOpsMetrics.Tests/Service/LeadTimeForChangesControllerTests.cs @@ -7,10 +7,11 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [TestCategory("IntegrationTest")] [TestClass] - public class LeadTimeForChangesL1s : BaseConfiguration + public class LeadTimeForChangesControllerTests : BaseConfiguration { - [TestCategory("L1Test")] + [TestCategory("UnitTest")] [TestMethod] public async Task AzLeadTimeControllerIntegrationTest() { @@ -53,7 +54,7 @@ public async Task AzLeadTimeControllerIntegrationTest() Assert.IsTrue(model.TotalItems > 0); } - [TestCategory("L1Test")] + [TestCategory("UnitTest")] [TestMethod] public async Task GHLeadTimeControllerIntegrationTest() { @@ -65,7 +66,7 @@ public async Task GHLeadTimeControllerIntegrationTest() string owner = "DeveloperMetrics"; string repo = "devopsmetrics"; string branch = "main"; - string workflowName = "DevOpsMetrics.CICD"; + string workflowName = "CI/CD"; string workflowId = "1162561"; int numberOfDays = 30; int maxNumberOfItems = 20; @@ -100,7 +101,7 @@ public async Task GHLeadTimeControllerIntegrationTest() } - [TestCategory("L1Test")] + [TestCategory("UnitTest")] [TestMethod] public async Task AzLeadTimeControllerAPIIntegrationTest() { @@ -144,7 +145,7 @@ public async Task AzLeadTimeControllerAPIIntegrationTest() } - [TestCategory("L1Test")] + [TestCategory("UnitTest")] [TestMethod] public async Task GHLeadTimeControllerAPIIntegrationTest() { @@ -153,7 +154,7 @@ public async Task GHLeadTimeControllerAPIIntegrationTest() string owner = "DeveloperMetrics"; string repo = "devopsmetrics"; string branch = "main"; - string workflowName = "DevOpsMetrics.CICD"; + string workflowName = "CI/CD"; string workflowId = "1162561"; int numberOfDays = 7; int maxNumberOfItems = 20; @@ -188,7 +189,6 @@ public async Task GHLeadTimeControllerAPIIntegrationTest() } - [TestCategory("L1Test")] [TestMethod] public async Task AzLeadTimeControllerAPILiveIntegrationTest() { @@ -241,7 +241,6 @@ public async Task AzLeadTimeControllerAPILiveIntegrationTest() } - [TestCategory("L1Test")] [TestMethod] public async Task GHLeadTimeControllerAPILiveIntegrationTest() { @@ -250,7 +249,7 @@ public async Task GHLeadTimeControllerAPILiveIntegrationTest() string owner = "DeveloperMetrics"; string repo = "devopsmetrics"; string branch = "main"; - string workflowName = "DevOpsMetrics.CICD"; + string workflowName = "CI/CD"; string workflowId = "1162561"; int numberOfDays = 20; int maxNumberOfItems = 60; @@ -294,7 +293,6 @@ public async Task GHLeadTimeControllerAPILiveIntegrationTest() } - //[TestCategory("L1Test")] //[TestMethod] //public async Task GHFeatureFlagsLeadTimeControllerAPILiveIntegrationTest() //{ diff --git a/src/DevOpsMetrics.Tests/Service/MeanTimeToRestoreControllerTests.cs b/src/DevOpsMetrics.Tests/Service/MeanTimeToRestoreControllerTests.cs index 4b7bebc3..eb23a65c 100644 --- a/src/DevOpsMetrics.Tests/Service/MeanTimeToRestoreControllerTests.cs +++ b/src/DevOpsMetrics.Tests/Service/MeanTimeToRestoreControllerTests.cs @@ -6,10 +6,11 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] + [TestCategory("IntegrationTest")] [TestClass] - public class MeanTimeToRestoreL1s : BaseConfiguration + public class MeanTimeToRestoreControllerTests : BaseConfiguration { - [TestCategory("L1Test")] + [TestCategory("UnitTest")] [TestMethod] public void AzureMTTRSampleControllerIntegrationTest() { @@ -44,7 +45,6 @@ public void AzureMTTRSampleControllerIntegrationTest() Assert.IsTrue(model.TotalItems > 0); } - [TestCategory("L1Test")] [TestMethod] public void AzureMTTRsAPIControllerIntegrationTest() { @@ -82,7 +82,6 @@ public void AzureMTTRsAPIControllerIntegrationTest() Assert.IsTrue(model.TotalItems >= 0); } - [TestCategory("L1Test")] [TestMethod] public void AzureMTTRsAPINullIntegrationTest() { @@ -120,7 +119,6 @@ public void AzureMTTRsAPINullIntegrationTest() Assert.IsTrue(model.TotalItems >= 0); } - [TestCategory("L1Test")] [TestMethod] public void AzureMTTRsAPIEmptyIntegrationTest() { diff --git a/src/DevOpsMetrics.Tests/Service/NightlyProcessTests.cs b/src/DevOpsMetrics.Tests/Service/NightlyProcessTests.cs index 2949d019..87d5144d 100644 --- a/src/DevOpsMetrics.Tests/Service/NightlyProcessTests.cs +++ b/src/DevOpsMetrics.Tests/Service/NightlyProcessTests.cs @@ -11,7 +11,7 @@ //namespace DevOpsMetrics.Tests.Service //{ // [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] -// [TestCategory("L1Test")] +// [TestCategory("IntegrationTest")] // [TestClass] // public class NightlyProcessTests : BaseConfiguration // { diff --git a/src/DevOpsMetrics.Tests/Service/SecretsProcessingTests.cs b/src/DevOpsMetrics.Tests/Service/SecretsProcessingTests.cs index 0bce6aea..2de03226 100644 --- a/src/DevOpsMetrics.Tests/Service/SecretsProcessingTests.cs +++ b/src/DevOpsMetrics.Tests/Service/SecretsProcessingTests.cs @@ -4,7 +4,7 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class SecretsProcessingTests { diff --git a/src/DevOpsMetrics.Tests/Service/TableStorageControllerDATests.cs b/src/DevOpsMetrics.Tests/Service/TableStorageControllerDATests.cs index 5d7d9ae6..b172913c 100644 --- a/src/DevOpsMetrics.Tests/Service/TableStorageControllerDATests.cs +++ b/src/DevOpsMetrics.Tests/Service/TableStorageControllerDATests.cs @@ -12,7 +12,7 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L0Test")] + [TestCategory("UnitTest")] [TestClass] public class TableStorageControllerDATests { diff --git a/src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs b/src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs index 564f3f68..5a63f352 100644 --- a/src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs +++ b/src/DevOpsMetrics.Tests/Service/TableStorageDATests.cs @@ -11,7 +11,7 @@ namespace DevOpsMetrics.Tests.Service { [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - [TestCategory("L1Test")] + [TestCategory("IntegrationTest")] [TestClass] public class TableStorageDATests : BaseConfiguration { @@ -144,7 +144,7 @@ public void GHGetBuildsDAIntegrationTest() TableStorageConfiguration tableStorageConfig = Common.GenerateTableStorageConfiguration(base.Configuration); string owner = "DeveloperMetrics"; string repo = "DevOpsMetrics"; - string workflowName = "DevOpsMetrics CI/CD"; + string workflowName = "CI/CD"; //Act AzureTableStorageDA da = new(); @@ -164,7 +164,7 @@ public async Task GHUpdateDevOpsMetricsBuildsDAIntegrationTest() string owner = "DeveloperMetrics"; string repo = "DevOpsMetrics"; string branch = "main"; - string workflowName = "DevOpsMetrics CI/CD"; + string workflowName = "CI/CD"; string workflowId = "1162561"; int numberOfDays = 30; int maxNumberOfItems = 20; diff --git a/src/DevOpsMetrics.Web/Controllers/HomeController.cs b/src/DevOpsMetrics.Web/Controllers/HomeController.cs index 85d85a7b..56836f12 100644 --- a/src/DevOpsMetrics.Web/Controllers/HomeController.cs +++ b/src/DevOpsMetrics.Web/Controllers/HomeController.cs @@ -38,7 +38,7 @@ public async Task Index() [HttpPost] public IActionResult ProjectUpdate(string RowKey, int NumberOfDaysSelected = 30) { - return RedirectToAction("Project", "Home", new { rowKey = RowKey, numberOfDays = NumberOfDaysSelected }); + return RedirectToAction("Project", "Home", new { projectId = RowKey, numberOfDays = NumberOfDaysSelected }); } [HttpGet]