59 lines
1.4 KiB
HCL
59 lines
1.4 KiB
HCL
variables {
|
|
application_name = "test-application"
|
|
namespace = "test-namespace"
|
|
image = {
|
|
name = "container.localdomain/test-image"
|
|
}
|
|
replicas = 2
|
|
}
|
|
|
|
run "test_deployment_classic" {
|
|
command = plan
|
|
|
|
assert {
|
|
condition = var.application_name == "test-application"
|
|
error_message = "incorrect application name"
|
|
}
|
|
|
|
assert {
|
|
condition = kubernetes_deployment_v1.deployment.spec[0].replicas == "2"
|
|
error_message = "invalid number of replicas"
|
|
}
|
|
}
|
|
|
|
run "test_deployment_custom_additional_ingress_host" {
|
|
command = plan
|
|
|
|
variables {
|
|
is_test = true
|
|
ports = [
|
|
{
|
|
container_port = 8083
|
|
expose = true
|
|
}
|
|
]
|
|
additional_ingress_host = ["additional-hostname.localdomain"]
|
|
}
|
|
|
|
assert {
|
|
condition = alltrue(flatten([
|
|
for ingress in values(kubernetes_ingress_v1.ingress) : [
|
|
for ingressSpec in ingress.spec :
|
|
contains(ingressSpec.rule.*.host, "additional-hostname.localdomain")
|
|
]
|
|
]))
|
|
error_message = "additional dns not add in ingress host rule"
|
|
}
|
|
|
|
assert {
|
|
condition = anytrue(flatten([
|
|
for ingress in values(kubernetes_ingress_v1.ingress) : [
|
|
for ingressSpec in ingress.spec : [
|
|
for ingressSpecTls in ingressSpec.tls :
|
|
contains(ingressSpecTls.hosts, "additional-hostname.localdomain")
|
|
]
|
|
]
|
|
]))
|
|
error_message = "additional dns not add in ingress tls hosts"
|
|
}
|
|
} |