Skip to content

Commit

Permalink
chore(envoy-ratelimit): move script tests to imagetest (#2478)
Browse files Browse the repository at this point in the history
* chore(envoy-ratelimit): move script tests to imagetest

Migrate the basic container test to use the new Docker harness in imagetest.

Signed-off-by: Mauren Berti <[email protected]>

* chore(envoy-ratelimit): remove unused bits

Signed-off-by: Mauren Berti <[email protected]>

---------

Signed-off-by: Mauren Berti <[email protected]>
  • Loading branch information
stormqueen1990 authored Apr 11, 2024
1 parent 4c4d70c commit 3c80d8a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 13 deletions.
41 changes: 35 additions & 6 deletions images/envoy-ratelimit/tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,45 @@ variable "digest" {

data "oci_string" "ref" { input = var.digest }

# TODO: Convert this to imagetest_harness_container when ready
data "oci_exec_test" "runs" {
digest = var.digest
script = "${path.module}/runs.sh"
data "imagetest_inventory" "this" {}

resource "imagetest_harness_docker" "this" {
name = "envoy-ratelimit-container"
inventory = data.imagetest_inventory.this

mounts = [
{
source = path.module
destination = "/tests"
}
]

envs = {
IMAGE_NAME : var.digest
}
}

data "imagetest_inventory" "this" {}
resource "imagetest_feature" "container_runs" {
name = "container runs"
description = "verifies that the envoy-ratelimit container runs"
harness = imagetest_harness_docker.this

steps = [
{
name = "Run test"
cmd = <<EOT
docker run --rm $IMAGE_NAME 2>&1 | grep "creating redis connection error"
EOT
}
]

labels = {
type = "container"
}
}

resource "imagetest_harness_k3s" "this" {
name = "envoy-ratelimit"
name = "envoy-ratelimit-k3s"
inventory = data.imagetest_inventory.this

sandbox = {
Expand Down
7 changes: 0 additions & 7 deletions images/envoy-ratelimit/tests/runs.sh

This file was deleted.

0 comments on commit 3c80d8a

Please sign in to comment.