too much for one commit

This commit is contained in:
Nils Blomgren
2026-05-13 14:01:32 +02:00
parent a96dd33039
commit 328d494530
394 changed files with 98104 additions and 78 deletions

View File

@@ -10,17 +10,20 @@ public class ServiceInstanceTests
{
// Arrange & Act — Request provisioning of a MinIO instance.
Guid environmentId = Guid.NewGuid();
Guid clusterId = Guid.NewGuid();
ServiceInstance instance = ServiceInstance.Provision(
clusterId,
environmentId,
ServiceType.MinIO,
"tenant-storage",
"minio-system");
"minio-system",
clusterId);
// Assert — Starts pending until the reconciler deploys it.
instance.Id.Should().NotBe(Guid.Empty);
instance.EnvironmentId.Should().Be(environmentId);
instance.ClusterId.Should().Be(clusterId);
instance.ServiceType.Should().Be(ServiceType.MinIO);
instance.Name.Should().Be("tenant-storage");
@@ -34,7 +37,7 @@ public class ServiceInstanceTests
{
// Arrange & Act
Action act = () => ServiceInstance.Provision(Guid.NewGuid(), ServiceType.MinIO, "", "ns");
Action act = () => ServiceInstance.Provision(Guid.NewGuid(), ServiceType.MinIO, "", "ns", Guid.NewGuid());
// Assert
@@ -47,7 +50,7 @@ public class ServiceInstanceTests
{
// Arrange
ServiceInstance instance = ServiceInstance.Provision(Guid.NewGuid(), ServiceType.CloudNativePG, "db", "cnpg-system");
ServiceInstance instance = ServiceInstance.Provision(Guid.NewGuid(), ServiceType.CloudNativePG, "db", "cnpg-system", Guid.NewGuid());
// Act
@@ -64,7 +67,7 @@ public class ServiceInstanceTests
{
// Arrange
ServiceInstance instance = ServiceInstance.Provision(Guid.NewGuid(), ServiceType.Keycloak, "auth", "keycloak-system");
ServiceInstance instance = ServiceInstance.Provision(Guid.NewGuid(), ServiceType.Keycloak, "auth", "keycloak-system", Guid.NewGuid());
instance.MarkRunning();
// Act — Tenant admin decides to tear down this service.
@@ -76,4 +79,48 @@ public class ServiceInstanceTests
instance.DesiredState.Should().Be(ServiceState.Decommissioned);
instance.CurrentState.Should().Be(ServiceState.Running);
}
[Fact]
public void ServiceType_IncludesGitea()
{
// Gitea is a shared service that can be provisioned on a cluster,
// so ServiceType must include it as a valid option.
ServiceType type = ServiceType.Gitea;
type.Should().BeDefined();
}
[Fact]
public void ServiceType_IncludesHarbor()
{
// Harbor is a shared container registry that can be provisioned
// on a cluster, so ServiceType must include it.
ServiceType type = ServiceType.Harbor;
type.Should().BeDefined();
}
[Fact]
public void Provision_Gitea_CreatesInstanceInPendingState()
{
// Gitea should be provisionable just like any other service type.
ServiceInstance instance = ServiceInstance.Provision(
Guid.NewGuid(), ServiceType.Gitea, "team-gitea", "gitea", Guid.NewGuid());
instance.ServiceType.Should().Be(ServiceType.Gitea);
instance.CurrentState.Should().Be(ServiceState.Pending);
}
[Fact]
public void Provision_Harbor_CreatesInstanceInPendingState()
{
// Harbor should be provisionable just like any other service type.
ServiceInstance instance = ServiceInstance.Provision(
Guid.NewGuid(), ServiceType.Harbor, "team-harbor", "harbor", Guid.NewGuid());
instance.ServiceType.Should().Be(ServiceType.Harbor);
instance.CurrentState.Should().Be(ServiceState.Pending);
}
}