Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions source/Calamari.Tests/ArgoCD/ArgoCDFilesUpdatedReporterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void ReportDeployments_WhenGitParamsRequirePullRequest_WritesNoServiceMes
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[
Expand Down Expand Up @@ -56,7 +56,7 @@ public void ReportDeployments_WithNoUpdatedApplications_WritesNoServiceMessages(
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[],
Expand All @@ -81,7 +81,7 @@ public void ReportDeployments_WithSingleUpdatedApplication_WritesOneServiceMessa
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[
Expand All @@ -106,7 +106,7 @@ public void ReportDeployments_WithSingleUpdatedApplication_WritesOneServiceMessa
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = $"[{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[],\"PatchedFiles\":[]}}]"
}
});
Expand All @@ -123,7 +123,7 @@ public void ReportDeployments_WithMultipleUpdatedApplications_WritesMultipleServ
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[
Expand All @@ -136,7 +136,7 @@ public void ReportDeployments_WithMultipleUpdatedApplications_WritesMultipleServ
[],
[]),
new("gateway2",
new ApplicationName("app2"),
QualifiedApplicationName.Create("app2", "argocd"),
1,
1,
[
Expand All @@ -160,7 +160,7 @@ public void ReportDeployments_WithMultipleUpdatedApplications_WritesMultipleServ
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = $"[{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[],\"PatchedFiles\":[]}}]"
}
},
Expand All @@ -170,7 +170,7 @@ public void ReportDeployments_WithMultipleUpdatedApplications_WritesMultipleServ
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway2",
["applicationName"] = "app2",
["applicationName"] = "argocd/app2",
["sources"] = $"[{{\"CommitSha\":\"def456\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[],\"PatchedFiles\":[]}}]"
}
}
Expand All @@ -188,7 +188,7 @@ public void ReportDeployments_WithReplacedFiles_IncludesReplacedFilesInSources()
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[
Expand All @@ -213,7 +213,7 @@ [new FileHash("values.yaml", "22c0df2cceca5273e4dc569dda52805d27df3360")],
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = $"[{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[{{\"FilePath\":\"values.yaml\",\"Hash\":\"22c0df2cceca5273e4dc569dda52805d27df3360\"}}],\"PatchedFiles\":[]}}]"
}
});
Expand All @@ -230,7 +230,7 @@ public void ReportDeployments_WithPatchedFiles_IncludesPatchedFilesInSources()
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
1,
1,
[
Expand All @@ -255,7 +255,7 @@ [new FileJsonPatch("kustomization.yaml", """[{"op":"replace","path":"/images/0/n
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = $"[{{\"CommitSha\":\"def456\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[],\"PatchedFiles\":[{{\"FilePath\":\"kustomization.yaml\",\"JsonPatch\":\"[{{\\u0022op\\u0022:\\u0022replace\\u0022,\\u0022path\\u0022:\\u0022/images/0/name\\u0022,\\u0022value\\u0022:\\u0022nginx:latest\\u0022}}]\"}}]}}]"
}
});
Expand All @@ -272,7 +272,7 @@ public void ReportDeployments_WithBothReplacedAndPatchedFiles_IncludesBothInSour
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[
Expand All @@ -297,7 +297,7 @@ [new FileJsonPatch("kustomization.yaml", """[{"op":"replace","path":"/images/0/n
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = $"[{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[{{\"FilePath\":\"values.yaml\",\"Hash\":\"22c0df2cceca5273e4dc569dda52805d27df3360\"}}],\"PatchedFiles\":[{{\"FilePath\":\"kustomization.yaml\",\"JsonPatch\":\"[{{\\u0022op\\u0022:\\u0022replace\\u0022,\\u0022path\\u0022:\\u0022/images/0/name\\u0022,\\u0022value\\u0022:\\u0022nginx:latest\\u0022}}]\"}}]}}]"
}
});
Expand All @@ -314,7 +314,7 @@ public void ReportDeployments_WithMultipleReplacedAndPatchedFiles_IncludesAllFil
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[
Expand Down Expand Up @@ -345,7 +345,7 @@ public void ReportDeployments_WithMultipleReplacedAndPatchedFiles_IncludesAllFil
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = $"[{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[{{\"FilePath\":\"values.yaml\",\"Hash\":\"22c0df2cceca5273e4dc569dda52805d27df3360\"}},{{\"FilePath\":\"values-prod.yaml\",\"Hash\":\"a3b4c5d6e7f8a3b4c5d6e7f8a3b4c5d6e7f8a3b4\"}}],\"PatchedFiles\":[{{\"FilePath\":\"kustomization.yaml\",\"JsonPatch\":\"[{{\\u0022op\\u0022:\\u0022replace\\u0022,\\u0022path\\u0022:\\u0022/images/0/name\\u0022,\\u0022value\\u0022:\\u0022nginx:latest\\u0022}}]\"}},{{\"FilePath\":\"patch.yaml\",\"JsonPatch\":\"[{{\\u0022op\\u0022:\\u0022replace\\u0022,\\u0022path\\u0022:\\u0022/spec/replicas\\u0022,\\u0022value\\u0022:3}}]\"}}]}}]"
}
});
Expand All @@ -362,7 +362,7 @@ public void ReportDeployments_WithMultipleSourcesWithFiles_IncludesAllSourcesInS
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[
Expand Down Expand Up @@ -392,7 +392,7 @@ [new FileJsonPatch("kustomization.yaml", """[{"op":"replace","path":"/images/0/n
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = $"[{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[{{\"FilePath\":\"values.yaml\",\"Hash\":\"22c0df2cceca5273e4dc569dda52805d27df3360\"}}],\"PatchedFiles\":[]}},{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":1,\"ReplacedFiles\":[],\"PatchedFiles\":[{{\"FilePath\":\"kustomization.yaml\",\"JsonPatch\":\"[{{\\u0022op\\u0022:\\u0022replace\\u0022,\\u0022path\\u0022:\\u0022/images/0/name\\u0022,\\u0022value\\u0022:\\u0022redis:latest\\u0022}}]\"}}]}}]"
}
});
Expand All @@ -409,7 +409,7 @@ public void ReportDeployments_WithOsSpecificReplacedFilePaths_ReportsPosixPaths(
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
1,
1,
[
Expand All @@ -434,7 +434,7 @@ [new FileHash(Path.Combine("some", "nested", "values.yaml"), "22c0df2cceca5273e4
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = $"[{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[{{\"FilePath\":\"some/nested/values.yaml\",\"Hash\":\"22c0df2cceca5273e4dc569dda52805d27df3360\"}}],\"PatchedFiles\":[]}}]"
}
});
Expand All @@ -449,7 +449,7 @@ public void ReportDeployments_WithNoOpSource_EmitsServiceMessageWithNullCommitSh
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
1,
1,
[
Expand All @@ -474,7 +474,7 @@ [new FileJsonPatch("values.yaml", """[{"op":"replace","path":"/image","value":"n
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway1",
["applicationName"] = "app1",
["applicationName"] = "argocd/app1",
["sources"] = """[{"CommitSha":null,"CommitTimestamp":null,"SourceIndex":0,"ReplacedFiles":[],"PatchedFiles":[{"FilePath":"values.yaml","JsonPatch":"[{\u0022op\u0022:\u0022replace\u0022,\u0022path\u0022:\u0022/image\u0022,\u0022value\u0022:\u0022nginx:1.27\u0022}]"}]}]"""
}
});
Expand All @@ -491,14 +491,14 @@ public void ReportDeployments_WithMixedUpdatedAndNonUpdatedApplications_WritesOn
var applicationResults = new List<ProcessApplicationResult>
{
new("gateway1",
new ApplicationName("app1"),
QualifiedApplicationName.Create("app1", "argocd"),
2,
2,
[],
[],
[]),
new("gateway2",
new ApplicationName("app2"),
QualifiedApplicationName.Create("app2", "argocd"),
1,
1,
[
Expand All @@ -511,7 +511,7 @@ public void ReportDeployments_WithMixedUpdatedAndNonUpdatedApplications_WritesOn
[],
[]),
new("gateway3",
new ApplicationName("app3"),
QualifiedApplicationName.Create("app3", "argocd"),
1,
1,
[],
Expand All @@ -530,7 +530,7 @@ public void ReportDeployments_WithMixedUpdatedAndNonUpdatedApplications_WritesOn
Properties = new Dictionary<string, string>
{
["gatewayId"] = "gateway2",
["applicationName"] = "app2",
["applicationName"] = "argocd/app2",
["sources"] = $"[{{\"CommitSha\":\"abc123\",\"CommitTimestamp\":\"{tsJson}\",\"SourceIndex\":0,\"ReplacedFiles\":[],\"PatchedFiles\":[]}}]"
}
});
Expand Down
Loading