diff --git a/images/keda/tests/main.tf b/images/keda/tests/main.tf index 5f222d931d..5d55d3548e 100644 --- a/images/keda/tests/main.tf +++ b/images/keda/tests/main.tf @@ -92,7 +92,8 @@ resource "imagetest_feature" "basic" { kubectl get --raw "/apis/external.metrics.k8s.io/v1beta1" kubectl get scaledobject test-deployment -n default -o jsonpath={.status.externalMetricNames} kubectl get --raw "/apis/external.metrics.k8s.io/v1beta1/namespaces/default/s0-cron-UTC-0,1xxxx-0,5xxxx?labelSelector=scaledobject.keda.sh%2Fname%3Dtest-deployment" - kubectl get scaledobject test-deployment -o jsonpath='{.status.health.*.status}' | grep Happy + kubectl wait --for=condition=Ready scaledobject test-deployment + kubectl wait --for=condition=Active scaledobject test-deployment EOF }, ] diff --git a/images/memcached/config/main.tf b/images/memcached/config/main.tf index 8737119ea3..242dcd936f 100644 --- a/images/memcached/config/main.tf +++ b/images/memcached/config/main.tf @@ -1,9 +1,3 @@ -terraform { - required_providers { - apko = { source = "chainguard-dev/apko" } - } -} - module "accts" { source = "../../../tflib/accts" } variable "extra_packages" { diff --git a/images/memcached/tests/main.tf b/images/memcached/tests/main.tf index 5b40dcd956..09a918b7f1 100644 --- a/images/memcached/tests/main.tf +++ b/images/memcached/tests/main.tf @@ -47,7 +47,39 @@ resource "imagetest_feature" "basic" { { name = "Helm install" cmd = module.helm.install_cmd - } + }, + { + name = "Install netcat" + cmd = "apk add --no-cache netcat-openbsd" + }, + { + name = "Start port-forward to access Memcached service on localhost" + cmd = "kubectl port-forward -n default svc/memcached 11211:11211 & " + }, + { + name = "Wait for port-forwarding to establish" + cmd = "sleep 5" # Give time for the connection to establish + }, + { + name = "Test Memcached functionality using nc with localhost" + cmd = <<-EOC + echo "Testing connection to Memcached at localhost:11211" + echo -e 'stats\nquit' | nc localhost 11211 + EOC + assert = { + success = "STAT pid" + output_contains = [ + "STAT pid", + "STAT uptime", + "STAT version", + "STAT curr_connections", + "STAT cmd_get", + "STAT bytes_read", + "STAT threads", + "STAT limit_maxbytes", + ] + } + }, ] labels = {