diff --git a/src/KSail.Models/CLI/Commands/Init/KSailCLIInitOptions.cs b/src/KSail.Models/CLI/Commands/Init/KSailCLIInitOptions.cs
index 28215580..8d5e5d17 100644
--- a/src/KSail.Models/CLI/Commands/Init/KSailCLIInitOptions.cs
+++ b/src/KSail.Models/CLI/Commands/Init/KSailCLIInitOptions.cs
@@ -34,14 +34,4 @@ public class KSailCLIInitOptions
/// The template to use for the generated output.
///
public KSailCLIInitTemplate Template { get; set; } = KSailCLIInitTemplate.Simple;
-
- ///
- /// The different Kustomizations to generate. First depends on the second, and so on.
- ///
- public IEnumerable KustomizeFlows { get; set; } = ["apps", "infrastructure", "infrastructure/controllers"];
-
- ///
- /// The different places that it should be able to hook into the Kustomization flows. For example per cluster or distribution.
- ///
- public IEnumerable KustomizeHooks { get; set; } = [];
}
diff --git a/src/KSail.Models/Project/KSailProjectOptions.cs b/src/KSail.Models/Project/KSailProjectOptions.cs
index ea42fdf0..82cb1000 100644
--- a/src/KSail.Models/Project/KSailProjectOptions.cs
+++ b/src/KSail.Models/Project/KSailProjectOptions.cs
@@ -20,6 +20,16 @@ public class KSailProjectOptions
///
public string ConfigPath { get; set; } = "kind-config.yaml";
+ ///
+ /// The different Kustomizations to generate. First depends on the second, and so on.
+ ///
+ public IEnumerable KustomizeFlows { get; set; } = ["apps", "infrastructure", "infrastructure/controllers"];
+
+ ///
+ /// The different places that it should be able to hook into the Kustomization flows. For example per cluster or distribution.
+ ///
+ public IEnumerable KustomizeHooks { get; set; } = [];
+
///
/// The Kubernetes distribution to use.
///
diff --git a/src/KSail/Commands/Init/Generators/SubGenerators/ComponentsGenerator.cs b/src/KSail/Commands/Init/Generators/SubGenerators/ComponentsGenerator.cs
index 6516cd55..3167e7d4 100644
--- a/src/KSail/Commands/Init/Generators/SubGenerators/ComponentsGenerator.cs
+++ b/src/KSail/Commands/Init/Generators/SubGenerators/ComponentsGenerator.cs
@@ -67,7 +67,7 @@ async Task GenerateFluxKustomizationPostBuildVariablesLabelComponent(KSailCluste
}
]
};
- foreach (string hook in config.Spec.CLI.InitOptions.KustomizeHooks.Skip(1))
+ foreach (string hook in config.Spec.Project.KustomizeHooks.Skip(1))
{
fluxKustomizationPostBuildVariablesLabelComponent.Patches.First().Patch += $"{Environment.NewLine} - kind: ConfigMap";
fluxKustomizationPostBuildVariablesLabelComponent.Patches.First().Patch += $"{Environment.NewLine} name: variables-{hook}";
diff --git a/src/KSail/Commands/Init/Generators/SubGenerators/FluxSystemGenerator.cs b/src/KSail/Commands/Init/Generators/SubGenerators/FluxSystemGenerator.cs
index 4c4c379f..f7b2cadb 100644
--- a/src/KSail/Commands/Init/Generators/SubGenerators/FluxSystemGenerator.cs
+++ b/src/KSail/Commands/Init/Generators/SubGenerators/FluxSystemGenerator.cs
@@ -21,14 +21,14 @@ internal async Task GenerateAsync(KSailCluster config, CancellationToken cancell
if (!Directory.Exists(outputDirectory))
_ = Directory.CreateDirectory(outputDirectory);
await GenerateFluxSystemKustomization(config, outputDirectory, cancellationToken).ConfigureAwait(false);
- foreach (string flow in config.Spec.CLI.InitOptions.KustomizeFlows)
+ foreach (string flow in config.Spec.Project.KustomizeFlows)
{
List dependsOn = [];
- dependsOn = config.Spec.CLI.InitOptions.PostBuildVariables && !config.Spec.CLI.InitOptions.KustomizeFlows.IsNullOrEmpty()
- ? config.Spec.CLI.InitOptions.KustomizeFlows.Last() == flow
+ dependsOn = config.Spec.CLI.InitOptions.PostBuildVariables && !config.Spec.Project.KustomizeFlows.IsNullOrEmpty()
+ ? config.Spec.Project.KustomizeFlows.Last() == flow
? ([new FluxDependsOn { Name = "variables" }])
- : config.Spec.CLI.InitOptions.KustomizeFlows.Reverse().TakeWhile(f => f != flow).Select(f => new FluxDependsOn { Name = f.Replace('/', '-') }).TakeLast(1).ToList()
- : config.Spec.CLI.InitOptions.KustomizeFlows.Reverse().TakeWhile(f => f != flow).Select(f => new FluxDependsOn { Name = f.Replace('/', '-') }).TakeLast(1).ToList();
+ : config.Spec.Project.KustomizeFlows.Reverse().TakeWhile(f => f != flow).Select(f => new FluxDependsOn { Name = f.Replace('/', '-') }).TakeLast(1).ToList()
+ : config.Spec.Project.KustomizeFlows.Reverse().TakeWhile(f => f != flow).Select(f => new FluxDependsOn { Name = f.Replace('/', '-') }).TakeLast(1).ToList();
await GenerateFluxSystemFluxKustomization(config, outputDirectory, flow, dependsOn, cancellationToken).ConfigureAwait(false);
}
@@ -49,7 +49,7 @@ async Task GenerateFluxSystemKustomization(KSailCluster config, string outputDir
Console.WriteLine($"✚ generating '{outputDirectory}'");
var kustomization = new KustomizeKustomization
{
- Resources = config.Spec.CLI.InitOptions.KustomizeFlows.Select(flow => $"{flow.Replace('/', '-')}.yaml").ToList(),
+ Resources = config.Spec.Project.KustomizeFlows.Select(flow => $"{flow.Replace('/', '-')}.yaml").ToList(),
Components = config.Spec.CLI.InitOptions.Components ?
[
"../../../components/flux-kustomization-post-build-variables-label",
@@ -106,7 +106,7 @@ async Task GenerateFluxSystemFluxKustomization(KSailCluster config, string outpu
Kind = FluxSource.OCIRepository,
Name = "flux-system"
},
- Path = config.Spec.CLI.InitOptions.KustomizeHooks.IsNullOrEmpty() ? flow : $"{config.Spec.CLI.InitOptions.KustomizeHooks.First()}/{flow}",
+ Path = config.Spec.Project.KustomizeHooks.IsNullOrEmpty() ? flow : $"{config.Spec.Project.KustomizeHooks.First()}/{flow}",
Prune = true,
Wait = true,
Decryption = config.Spec.Project.Sops && !config.Spec.CLI.InitOptions.Components ?
@@ -144,7 +144,7 @@ IEnumerable GetSubstituteFroms(KSa
Name = $"variables-sensitive-cluster"
}
};
- foreach (string hook in config.Spec.CLI.InitOptions.KustomizeHooks)
+ foreach (string hook in config.Spec.Project.KustomizeHooks)
{
substituteList.Add(new FluxKustomizationSpecPostBuildSubstituteFrom
{
diff --git a/src/KSail/Commands/Init/Generators/SubGenerators/HelmReleaseGenerator.cs b/src/KSail/Commands/Init/Generators/SubGenerators/HelmReleaseGenerator.cs
index 8b7749f0..ca12f494 100644
--- a/src/KSail/Commands/Init/Generators/SubGenerators/HelmReleaseGenerator.cs
+++ b/src/KSail/Commands/Init/Generators/SubGenerators/HelmReleaseGenerator.cs
@@ -24,8 +24,8 @@ class HelmReleaseGenerator
internal async Task GenerateAsync(KSailCluster config, CancellationToken cancellationToken = default)
{
- string appsPath = Path.Combine(config.Spec.Project.ManifestsDirectory, config.Spec.CLI.InitOptions.KustomizeHooks.Last(), "apps");
- string infrastructurePath = Path.Combine(config.Spec.Project.ManifestsDirectory, config.Spec.CLI.InitOptions.KustomizeHooks.Last(), "infrastructure");
+ string appsPath = Path.Combine(config.Spec.Project.ManifestsDirectory, config.Spec.Project.KustomizeHooks.Last(), "apps");
+ string infrastructurePath = Path.Combine(config.Spec.Project.ManifestsDirectory, config.Spec.Project.KustomizeHooks.Last(), "infrastructure");
string infrastructureControllersPath = Path.Combine(infrastructurePath, "controllers");
if (!Directory.Exists(appsPath))
_ = Directory.CreateDirectory(appsPath);
diff --git a/src/KSail/Commands/Init/Generators/SubGenerators/KustomizeFlowGenerator.cs b/src/KSail/Commands/Init/Generators/SubGenerators/KustomizeFlowGenerator.cs
index 4cca9f1a..d149fd0e 100644
--- a/src/KSail/Commands/Init/Generators/SubGenerators/KustomizeFlowGenerator.cs
+++ b/src/KSail/Commands/Init/Generators/SubGenerators/KustomizeFlowGenerator.cs
@@ -11,20 +11,20 @@ class KustomizeFlowGenerator
readonly KustomizeKustomizationGenerator _kustomizationGenerator = new();
internal async Task GenerateAsync(KSailCluster config, CancellationToken cancellationToken = default)
{
- if (config.Spec.CLI.InitOptions.KustomizeHooks.IsNullOrEmpty())
+ if (config.Spec.Project.KustomizeHooks.IsNullOrEmpty())
{
- config.Spec.CLI.InitOptions.KustomizeHooks = [""];
+ config.Spec.Project.KustomizeHooks = [""];
}
- foreach (string currentHook in config.Spec.CLI.InitOptions.KustomizeHooks)
+ foreach (string currentHook in config.Spec.Project.KustomizeHooks)
{
- foreach (string currentFlow in config.Spec.CLI.InitOptions.KustomizeFlows)
+ foreach (string currentFlow in config.Spec.Project.KustomizeFlows)
{
await GenerateKustomizeFlowHook(config, currentHook, currentFlow, cancellationToken).ConfigureAwait(false);
}
}
if (config.Spec.CLI.InitOptions.PostBuildVariables)
{
- foreach (string hook in config.Spec.CLI.InitOptions.KustomizeHooks)
+ foreach (string hook in config.Spec.Project.KustomizeHooks)
{
await GenerateKustomizeFlowHook(config, hook, "variables", cancellationToken).ConfigureAwait(false);
}
@@ -47,12 +47,12 @@ async Task GenerateKustomizeFlowHook(KSailCluster config, string currentHook, st
KustomizeKustomization? kustomization;
if (currentFlow == "variables")
{
- string pathToNextFlow = currentHook == config.Spec.CLI.InitOptions.KustomizeHooks.Last() ?
+ string pathToNextFlow = currentHook == config.Spec.Project.KustomizeHooks.Last() ?
"" :
Path.Combine(
relativeRoot,
- $"{config.Spec.CLI.InitOptions.KustomizeHooks.ElementAt(
- Array.IndexOf(config.Spec.CLI.InitOptions.KustomizeHooks.ToArray(), currentHook) + 1
+ $"{config.Spec.Project.KustomizeHooks.ElementAt(
+ Array.IndexOf(config.Spec.Project.KustomizeHooks.ToArray(), currentHook) + 1
)}/{currentFlow}"
);
kustomization = new KustomizeKustomization
@@ -72,7 +72,7 @@ async Task GenerateKustomizeFlowHook(KSailCluster config, string currentHook, st
}
else
{
- kustomization = currentHook == config.Spec.CLI.InitOptions.KustomizeHooks.Last()
+ kustomization = currentHook == config.Spec.Project.KustomizeHooks.Last()
? new KustomizeKustomization
{
Resources = config.Spec.CLI.InitOptions.HelmReleases && currentFlow == "infrastructure/controllers" ? ["cert-manager", "traefik"] :
@@ -86,7 +86,7 @@ async Task GenerateKustomizeFlowHook(KSailCluster config, string currentHook, st
}
: new KustomizeKustomization
{
- Resources = [Path.Combine(relativeRoot, $"{config.Spec.CLI.InitOptions.KustomizeHooks.ElementAt(Array.IndexOf(config.Spec.CLI.InitOptions.KustomizeHooks.ToArray(), currentHook) + 1)}/{currentFlow}")],
+ Resources = [Path.Combine(relativeRoot, $"{config.Spec.Project.KustomizeHooks.ElementAt(Array.IndexOf(config.Spec.Project.KustomizeHooks.ToArray(), currentHook) + 1)}/{currentFlow}")],
Components = config.Spec.CLI.InitOptions.Components ?
[
Path.Combine(relativeRoot, "components/helm-release-crds-label"),
diff --git a/src/KSail/Commands/Init/Generators/SubGenerators/VariablesGenerator.cs b/src/KSail/Commands/Init/Generators/SubGenerators/VariablesGenerator.cs
index ccc1a067..aa17793a 100644
--- a/src/KSail/Commands/Init/Generators/SubGenerators/VariablesGenerator.cs
+++ b/src/KSail/Commands/Init/Generators/SubGenerators/VariablesGenerator.cs
@@ -10,7 +10,7 @@ class VariablesGenerator
readonly SecretGenerator _secretGenerator = new();
internal async Task GenerateAsync(KSailCluster config, CancellationToken cancellationToken = default)
{
- foreach (string hook in config.Spec.CLI.InitOptions.KustomizeHooks)
+ foreach (string hook in config.Spec.Project.KustomizeHooks)
{
string hookPath = Path.Combine(config.Spec.CLI.InitOptions.OutputDirectory, "k8s", hook, "variables");
string name = hook.Replace("/", "-", StringComparison.Ordinal);
diff --git a/src/KSail/Commands/Up/Handlers/KSailUpCommandHandler.cs b/src/KSail/Commands/Up/Handlers/KSailUpCommandHandler.cs
index a8c29389..0c9d0d1f 100644
--- a/src/KSail/Commands/Up/Handlers/KSailUpCommandHandler.cs
+++ b/src/KSail/Commands/Up/Handlers/KSailUpCommandHandler.cs
@@ -76,7 +76,7 @@ internal async Task HandleAsync(CancellationToken cancellationToken = defau
if (_config.Spec.CLI.UpOptions.Reconcile)
{
Console.WriteLine("🔄 Reconciling kustomizations");
- await _gitOpsProvisioner.ReconcileAsync(_config.Spec.Connection.Timeout, cancellationToken).ConfigureAwait(false);
+ await _gitOpsProvisioner.ReconcileAsync(_config.Spec.Project.KustomizeFlows.Reverse().ToArray(), _config.Spec.Connection.Timeout, cancellationToken).ConfigureAwait(false);
Console.WriteLine();
}
return 0;
diff --git a/src/KSail/Commands/Update/Handlers/KSailUpdateCommandHandler.cs b/src/KSail/Commands/Update/Handlers/KSailUpdateCommandHandler.cs
index 3ec76944..98ffc759 100644
--- a/src/KSail/Commands/Update/Handlers/KSailUpdateCommandHandler.cs
+++ b/src/KSail/Commands/Update/Handlers/KSailUpdateCommandHandler.cs
@@ -37,7 +37,7 @@ internal async Task HandleAsync(CancellationToken cancellationToken = defa
if (_config.Spec.CLI.UpdateOptions.Reconcile)
{
Console.WriteLine("🔄 Reconciling changes");
- await _gitOpsProvisioner.ReconcileAsync(_config.Spec.Connection.Timeout, cancellationToken).ConfigureAwait(false);
+ await _gitOpsProvisioner.ReconcileAsync(_config.Spec.Project.KustomizeFlows.Reverse().ToArray(), _config.Spec.Connection.Timeout, cancellationToken).ConfigureAwait(false);
}
Console.WriteLine();
return true;
diff --git a/src/KSail/KSail.csproj b/src/KSail/KSail.csproj
index 15622f11..8d0e1126 100644
--- a/src/KSail/KSail.csproj
+++ b/src/KSail/KSail.csproj
@@ -27,11 +27,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/tests/KSail.Generator.Tests/KSailClusterGeneratorTests/ksail-config.full.yaml.verified.yaml b/tests/KSail.Generator.Tests/KSailClusterGeneratorTests/ksail-config.full.yaml.verified.yaml
index 8dce4a9b..da37fd04 100644
--- a/tests/KSail.Generator.Tests/KSailClusterGeneratorTests/ksail-config.full.yaml.verified.yaml
+++ b/tests/KSail.Generator.Tests/KSailClusterGeneratorTests/ksail-config.full.yaml.verified.yaml
@@ -12,6 +12,11 @@ spec:
manifestsDirectory: ./k8s
kustomizationDirectory: ./clusters/my-cluster/flux-system
configPath: ./k3d-config.yaml
+ kustomizeFlows:
+ - apps
+ - infrastructure
+ - infrastructure/controllers
+ kustomizeHooks: []
distribution: k3d
gitOpsTool: flux
containerEngine: docker
@@ -77,11 +82,6 @@ spec:
postBuildVariables: true
outputDirectory: ./
template: simple
- kustomizeFlows:
- - apps
- - infrastructure
- - infrastructure/controllers
- kustomizeHooks: []
lintOptions: {}
listOptions:
all: false
diff --git a/tests/KSail.Generator.Tests/KSailClusterGeneratorTests/ksail-config.minimal.yaml.verified.yaml b/tests/KSail.Generator.Tests/KSailClusterGeneratorTests/ksail-config.minimal.yaml.verified.yaml
index 7d68268c..dd3e0bc8 100644
--- a/tests/KSail.Generator.Tests/KSailClusterGeneratorTests/ksail-config.minimal.yaml.verified.yaml
+++ b/tests/KSail.Generator.Tests/KSailClusterGeneratorTests/ksail-config.minimal.yaml.verified.yaml
@@ -12,6 +12,11 @@ spec:
manifestsDirectory: ./k8s
kustomizationDirectory: ./k8s/clusters/ksail-default/flux-system
configPath: kind-config.yaml
+ kustomizeFlows:
+ - apps
+ - infrastructure
+ - infrastructure/controllers
+ kustomizeHooks: []
distribution: kind
gitOpsTool: flux
containerEngine: docker
@@ -77,11 +82,6 @@ spec:
postBuildVariables: false
outputDirectory: ./
template: simple
- kustomizeFlows:
- - apps
- - infrastructure
- - infrastructure/controllers
- kustomizeHooks: []
lintOptions: {}
listOptions:
all: false
diff --git a/tests/KSail.Models.Tests/KSailClusterInitialization.InitializeKSailCluster_WithNoProperties_ShouldReturnDefaultValues.verified.txt b/tests/KSail.Models.Tests/KSailClusterInitialization.InitializeKSailCluster_WithNoProperties_ShouldReturnDefaultValues.verified.txt
index 35ccc605..4ebaebd0 100644
--- a/tests/KSail.Models.Tests/KSailClusterInitialization.InitializeKSailCluster_WithNoProperties_ShouldReturnDefaultValues.verified.txt
+++ b/tests/KSail.Models.Tests/KSailClusterInitialization.InitializeKSailCluster_WithNoProperties_ShouldReturnDefaultValues.verified.txt
@@ -14,6 +14,11 @@
ManifestsDirectory: ./k8s,
KustomizationDirectory: ./k8s/clusters/ksail-default/flux-system,
ConfigPath: kind-config.yaml,
+ KustomizeFlows: [
+ apps,
+ infrastructure,
+ infrastructure/controllers
+ ],
Distribution: kind,
Sops: false
},
@@ -90,12 +95,7 @@
Components: false,
HelmReleases: false,
PostBuildVariables: false,
- OutputDirectory: ./,
- KustomizeFlows: [
- apps,
- infrastructure,
- infrastructure/controllers
- ]
+ OutputDirectory: ./
},
LintOptions: {},
ListOptions: {
diff --git a/tests/KSail.Models.Tests/KSailClusterInitialization.InitializeKSailCluster_WithSpecifiedProperties_ShouldReturnCustomValues.verified.txt b/tests/KSail.Models.Tests/KSailClusterInitialization.InitializeKSailCluster_WithSpecifiedProperties_ShouldReturnCustomValues.verified.txt
index 44580393..bf5f264d 100644
--- a/tests/KSail.Models.Tests/KSailClusterInitialization.InitializeKSailCluster_WithSpecifiedProperties_ShouldReturnCustomValues.verified.txt
+++ b/tests/KSail.Models.Tests/KSailClusterInitialization.InitializeKSailCluster_WithSpecifiedProperties_ShouldReturnCustomValues.verified.txt
@@ -14,6 +14,11 @@
ManifestsDirectory: ./k8s,
KustomizationDirectory: ./clusters/my-cluster/flux-system,
ConfigPath: ./k3d-config.yaml,
+ KustomizeFlows: [
+ apps,
+ infrastructure,
+ infrastructure/controllers
+ ],
Sops: true
},
Registries: [
@@ -89,12 +94,7 @@
Components: true,
HelmReleases: true,
PostBuildVariables: true,
- OutputDirectory: ./,
- KustomizeFlows: [
- apps,
- infrastructure,
- infrastructure/controllers
- ]
+ OutputDirectory: ./
},
LintOptions: {},
ListOptions: {
diff --git a/tests/KSail.Tests/Commands/Debug/KSailDebugCommandTests.cs b/tests/KSail.Tests/Commands/Debug/KSailDebugCommandTests.cs
index d5b42930..88060d3e 100644
--- a/tests/KSail.Tests/Commands/Debug/KSailDebugCommandTests.cs
+++ b/tests/KSail.Tests/Commands/Debug/KSailDebugCommandTests.cs
@@ -7,7 +7,6 @@ namespace KSail.Tests.Commands.Debug;
///
/// Tests for the class.
///
-[Collection("KSail.Tests")]
public class KSailDebugCommandTests : IAsyncLifetime
{
///
diff --git a/tests/KSail.Tests/Commands/Down/KSailDownCommandTests.cs b/tests/KSail.Tests/Commands/Down/KSailDownCommandTests.cs
index ee8dcfe6..3aabaa29 100644
--- a/tests/KSail.Tests/Commands/Down/KSailDownCommandTests.cs
+++ b/tests/KSail.Tests/Commands/Down/KSailDownCommandTests.cs
@@ -7,7 +7,6 @@ namespace KSail.Tests.Commands.Down;
///
/// Tests for the class.
///
-[Collection("KSail.Tests")]
public class KSailDownCommandTests : IAsyncLifetime
{
///
diff --git a/tests/KSail.Tests/Commands/Gen/KSailGenCommandTests.cs b/tests/KSail.Tests/Commands/Gen/KSailGenCommandTests.cs
index 27910c07..00ae6b15 100644
--- a/tests/KSail.Tests/Commands/Gen/KSailGenCommandTests.cs
+++ b/tests/KSail.Tests/Commands/Gen/KSailGenCommandTests.cs
@@ -7,7 +7,6 @@ namespace KSail.Tests.Commands.Gen;
///
/// Tests for the class.
///
-[Collection("KSail.Tests")]
public class KSailGenCommandTests : IAsyncLifetime
{
///
diff --git a/tests/KSail.Tests/Commands/Gen/ksail-config.yaml.verified.yaml b/tests/KSail.Tests/Commands/Gen/ksail-config.yaml.verified.yaml
index 7d68268c..dd3e0bc8 100644
--- a/tests/KSail.Tests/Commands/Gen/ksail-config.yaml.verified.yaml
+++ b/tests/KSail.Tests/Commands/Gen/ksail-config.yaml.verified.yaml
@@ -12,6 +12,11 @@ spec:
manifestsDirectory: ./k8s
kustomizationDirectory: ./k8s/clusters/ksail-default/flux-system
configPath: kind-config.yaml
+ kustomizeFlows:
+ - apps
+ - infrastructure
+ - infrastructure/controllers
+ kustomizeHooks: []
distribution: kind
gitOpsTool: flux
containerEngine: docker
@@ -77,11 +82,6 @@ spec:
postBuildVariables: false
outputDirectory: ./
template: simple
- kustomizeFlows:
- - apps
- - infrastructure
- - infrastructure/controllers
- kustomizeHooks: []
lintOptions: {}
listOptions:
all: false
diff --git a/tests/KSail.Tests/Commands/Init/KSailInitCommandTests.cs b/tests/KSail.Tests/Commands/Init/KSailInitCommandTests.cs
index 91a962e3..7ff3d948 100644
--- a/tests/KSail.Tests/Commands/Init/KSailInitCommandTests.cs
+++ b/tests/KSail.Tests/Commands/Init/KSailInitCommandTests.cs
@@ -7,7 +7,6 @@ namespace KSail.Tests.Commands.Init;
///
/// Tests for the class.
///
-[Collection("KSail.Tests")]
public class KSailInitCommandTests : IAsyncLifetime
{
///
diff --git a/tests/KSail.Tests/Commands/Init/advanced/ksail-config.yaml.verified.yaml b/tests/KSail.Tests/Commands/Init/advanced/ksail-config.yaml.verified.yaml
index 9d783123..645ba814 100644
--- a/tests/KSail.Tests/Commands/Init/advanced/ksail-config.yaml.verified.yaml
+++ b/tests/KSail.Tests/Commands/Init/advanced/ksail-config.yaml.verified.yaml
@@ -12,6 +12,11 @@ spec:
manifestsDirectory: ./k8s
kustomizationDirectory: ./k8s/clusters/ksail-default/flux-system
configPath: ./kind-config.yaml
+ kustomizeFlows:
+ - apps
+ - infrastructure
+ - infrastructure/controllers
+ kustomizeHooks: []
distribution: kind
gitOpsTool: flux
containerEngine: docker
@@ -77,11 +82,6 @@ spec:
postBuildVariables: true
outputDirectory: {TempPath}ksail-init-advanced
template: simple
- kustomizeFlows:
- - apps
- - infrastructure
- - infrastructure/controllers
- kustomizeHooks: []
lintOptions: {}
listOptions:
all: false
diff --git a/tests/KSail.Tests/Commands/Init/simple/ksail-config.yaml.verified.yaml b/tests/KSail.Tests/Commands/Init/simple/ksail-config.yaml.verified.yaml
index 7e2b1605..9cacb56a 100644
--- a/tests/KSail.Tests/Commands/Init/simple/ksail-config.yaml.verified.yaml
+++ b/tests/KSail.Tests/Commands/Init/simple/ksail-config.yaml.verified.yaml
@@ -12,6 +12,11 @@ spec:
manifestsDirectory: ./k8s
kustomizationDirectory: ./k8s/clusters/ksail-default/flux-system
configPath: ./kind-config.yaml
+ kustomizeFlows:
+ - apps
+ - infrastructure
+ - infrastructure/controllers
+ kustomizeHooks: []
distribution: kind
gitOpsTool: flux
containerEngine: docker
@@ -77,11 +82,6 @@ spec:
postBuildVariables: false
outputDirectory: {TempPath}ksail-init-simple
template: simple
- kustomizeFlows:
- - apps
- - infrastructure
- - infrastructure/controllers
- kustomizeHooks: []
lintOptions: {}
listOptions:
all: false
diff --git a/tests/KSail.Tests/Commands/Lint/KSailLintCommandTests.cs b/tests/KSail.Tests/Commands/Lint/KSailLintCommandTests.cs
index fd039e72..ec07df79 100644
--- a/tests/KSail.Tests/Commands/Lint/KSailLintCommandTests.cs
+++ b/tests/KSail.Tests/Commands/Lint/KSailLintCommandTests.cs
@@ -8,7 +8,6 @@ namespace KSail.Tests.Commands.Lint;
///
/// Tests for the class.
///
-[Collection("KSail.Tests")]
public class KSailLintCommandTests : IAsyncLifetime
{
///
diff --git a/tests/KSail.Tests/Commands/List/KSailListCommandTests.KSailList_SucceedsAndPrintsNoClusters.verified.txt b/tests/KSail.Tests/Commands/List/KSailListCommandTests.KSailList_SucceedsAndPrintsNoClusters.verified.txt
deleted file mode 100644
index 5f282702..00000000
--- a/tests/KSail.Tests/Commands/List/KSailListCommandTests.KSailList_SucceedsAndPrintsNoClusters.verified.txt
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/tests/KSail.Tests/Commands/List/KSailListCommandTests.cs b/tests/KSail.Tests/Commands/List/KSailListCommandTests.cs
index 0e5ad9ae..858ff277 100644
--- a/tests/KSail.Tests/Commands/List/KSailListCommandTests.cs
+++ b/tests/KSail.Tests/Commands/List/KSailListCommandTests.cs
@@ -7,7 +7,6 @@ namespace KSail.Tests.Commands.List;
///
/// Tests for the class.
///
-[Collection("KSail.Tests")]
public class KSailListCommandTests : IAsyncLifetime
{
///
diff --git a/tests/KSail.Tests/Commands/Root/KSailCommandTests.cs b/tests/KSail.Tests/Commands/Root/KSailCommandTests.cs
index 758ec2b1..57bbdb44 100644
--- a/tests/KSail.Tests/Commands/Root/KSailCommandTests.cs
+++ b/tests/KSail.Tests/Commands/Root/KSailCommandTests.cs
@@ -7,7 +7,6 @@ namespace KSail.Tests.Commands.Root;
///
/// Tests for the class.
///
-[Collection("KSail.Tests")]
public class KSailRootCommandTests : IAsyncLifetime
{
///
diff --git a/tests/KSail.Tests/Commands/SOPS/KSailSOPSCommandTests.cs b/tests/KSail.Tests/Commands/SOPS/KSailSOPSCommandTests.cs
index fb462a47..daa0b964 100644
--- a/tests/KSail.Tests/Commands/SOPS/KSailSOPSCommandTests.cs
+++ b/tests/KSail.Tests/Commands/SOPS/KSailSOPSCommandTests.cs
@@ -7,7 +7,6 @@ namespace KSail.Tests.Commands.SOPS;
///
/// Tests for the class.
///
-[Collection("KSail.Tests")]
public class KSailSOPSCommandTests : IAsyncLifetime
{
///
diff --git a/tests/KSail.Tests/Commands/Start/KSailStartCommandTests.KSailStartHelp_SucceedsAndPrintsIntroductionAndHelp.verified.txt b/tests/KSail.Tests/Commands/StartStop/KSailStartCommandTests.KSailStartHelp_SucceedsAndPrintsIntroductionAndHelp.verified.txt
similarity index 100%
rename from tests/KSail.Tests/Commands/Start/KSailStartCommandTests.KSailStartHelp_SucceedsAndPrintsIntroductionAndHelp.verified.txt
rename to tests/KSail.Tests/Commands/StartStop/KSailStartCommandTests.KSailStartHelp_SucceedsAndPrintsIntroductionAndHelp.verified.txt
diff --git a/tests/KSail.Tests/Commands/Stop/KSailStopCommandTests.KSailStopHelp_SucceedsAndPrintsIntroductionAndHelp.verified.txt b/tests/KSail.Tests/Commands/StartStop/KSailStartCommandTests.KSailStopHelp_SucceedsAndPrintsIntroductionAndHelp.verified.txt
similarity index 100%
rename from tests/KSail.Tests/Commands/Stop/KSailStopCommandTests.KSailStopHelp_SucceedsAndPrintsIntroductionAndHelp.verified.txt
rename to tests/KSail.Tests/Commands/StartStop/KSailStartCommandTests.KSailStopHelp_SucceedsAndPrintsIntroductionAndHelp.verified.txt
diff --git a/tests/KSail.Tests/Commands/Start/KSailStartCommandTests.cs b/tests/KSail.Tests/Commands/StartStop/KSailStartCommandTests.cs
similarity index 79%
rename from tests/KSail.Tests/Commands/Start/KSailStartCommandTests.cs
rename to tests/KSail.Tests/Commands/StartStop/KSailStartCommandTests.cs
index 7caa466a..dc2c9780 100644
--- a/tests/KSail.Tests/Commands/Start/KSailStartCommandTests.cs
+++ b/tests/KSail.Tests/Commands/StartStop/KSailStartCommandTests.cs
@@ -6,7 +6,7 @@
using KSail.Commands.Stop;
using KSail.Commands.Up;
-namespace KSail.Tests.Commands.Start;
+namespace KSail.Tests.Commands.StartStop;
///
/// Tests for the class.
@@ -37,11 +37,29 @@ public async Task KSailStartHelp_SucceedsAndPrintsIntroductionAndHelp()
_ = await Verify(console.Error.ToString() + console.Out);
}
+ ///
+ /// Tests that the 'ksail stop --help'
+ ///
+ [Fact]
+ public async Task KSailStopHelp_SucceedsAndPrintsIntroductionAndHelp()
+ {
+ //Arrange
+ var console = new TestConsole();
+ var ksailCommand = new KSailStopCommand();
+
+ //Act
+ int exitCode = await ksailCommand.InvokeAsync("--help", console);
+
+ //Assert
+ Assert.Equal(0, exitCode);
+ _ = await Verify(console.Error.ToString() + console.Out);
+ }
+
///
/// Tests that a default cluster is created, and the 'ksail up' command is executed successfully.
///
[Fact]
- public async Task KSailStart_WithDefaultOptions_SucceedsAndCreatesDefaultCluster()
+ public async Task KSailStartStop_WithDefaultOptions_SucceedsAndCreatesDefaultCluster()
{
//Cleanup
if (Directory.Exists("k8s"))
diff --git a/tests/KSail.Tests/Commands/Stop/KSailStopCommandTests.cs b/tests/KSail.Tests/Commands/Stop/KSailStopCommandTests.cs
deleted file mode 100644
index 01a7a2f2..00000000
--- a/tests/KSail.Tests/Commands/Stop/KSailStopCommandTests.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.CommandLine;
-using System.CommandLine.IO;
-using KSail.Commands.Stop;
-
-namespace KSail.Tests.Commands.Stop;
-
-///
-/// Tests for the class.
-///
-[Collection("KSail.Tests")]
-public class KSailStopCommandTests : IAsyncLifetime
-{
- ///
- public Task DisposeAsync() => Task.CompletedTask;
- ///
- public Task InitializeAsync() => Task.CompletedTask;
-
- ///
- /// Tests that the 'ksail stop --help'
- ///
- [Fact]
- public async Task KSailStopHelp_SucceedsAndPrintsIntroductionAndHelp()
- {
- //Arrange
- var console = new TestConsole();
- var ksailCommand = new KSailStopCommand();
-
- //Act
- int exitCode = await ksailCommand.InvokeAsync("--help", console);
-
- //Assert
- Assert.Equal(0, exitCode);
- _ = await Verify(console.Error.ToString() + console.Out);
- }
-}