From 8470c065a7729ff882be28d2e14a7db147c122ec Mon Sep 17 00:00:00 2001 From: James Petersen Date: Fri, 29 Sep 2023 11:17:48 -0600 Subject: [PATCH] Fluentd module path (#1489) * add a way to configure the test path for the fluentd image Signed-off-by: James Petersen * move the splunk config into its own module Signed-off-by: James Petersen * terraform fmt told me to do it Signed-off-by: James Petersen * switch to working_dir Signed-off-by: James Petersen * terraform fmt told me to do it Signed-off-by: James Petersen --------- Signed-off-by: James Petersen --- images/fluentd/tests/01-test.sh | 3 ++- images/fluentd/tests/main.tf | 5 +++-- images/fluentd/tests/splunk/01-test.sh | 2 +- images/fluentd/tests/{ => splunk}/configs/basic_splunk.conf | 0 images/fluentd/tests/splunk/main.tf | 5 +++-- 5 files changed, 9 insertions(+), 6 deletions(-) rename images/fluentd/tests/{ => splunk}/configs/basic_splunk.conf (100%) diff --git a/images/fluentd/tests/01-test.sh b/images/fluentd/tests/01-test.sh index 24a090031b..8302b0b119 100755 --- a/images/fluentd/tests/01-test.sh +++ b/images/fluentd/tests/01-test.sh @@ -15,10 +15,11 @@ fi # operate on the container further. # start_fluentd_detached() { + SCRIPT_PATH="$(dirname -- "${BASH_SOURCE[0]}")" docker run \ --detach --rm \ --publish 127.0.0.1:${FREE_PORT}:24224 \ - --volume "$(pwd)/images/fluentd/tests/configs/basic_docker.conf:/etc/fluent/fluent.conf" \ + --volume "$(pwd)/configs/basic_docker.conf:/etc/fluent/fluent.conf" \ "${IMAGE_NAME}" sleep 2 } diff --git a/images/fluentd/tests/main.tf b/images/fluentd/tests/main.tf index 164af0512d..cb0a93d72c 100644 --- a/images/fluentd/tests/main.tf +++ b/images/fluentd/tests/main.tf @@ -9,6 +9,7 @@ variable "digest" { } data "oci_exec_test" "test" { - digest = var.digest - script = "${path.module}/01-test.sh" + digest = var.digest + script = "./01-test.sh" + working_dir = path.module } diff --git a/images/fluentd/tests/splunk/01-test.sh b/images/fluentd/tests/splunk/01-test.sh index 1a616fd2c4..1a84d83e89 100755 --- a/images/fluentd/tests/splunk/01-test.sh +++ b/images/fluentd/tests/splunk/01-test.sh @@ -18,7 +18,7 @@ start_fluentd_detached() { docker run \ --detach --rm \ --publish 127.0.0.1:${FREE_PORT}:24224 \ - --volume "$(pwd)/images/fluentd/tests/configs/basic_splunk.conf:/etc/fluent/fluent.conf" \ + --volume "$(pwd)/configs/basic_splunk.conf:/etc/fluent/fluent.conf" \ "${IMAGE_NAME}" sleep 15 } diff --git a/images/fluentd/tests/configs/basic_splunk.conf b/images/fluentd/tests/splunk/configs/basic_splunk.conf similarity index 100% rename from images/fluentd/tests/configs/basic_splunk.conf rename to images/fluentd/tests/splunk/configs/basic_splunk.conf diff --git a/images/fluentd/tests/splunk/main.tf b/images/fluentd/tests/splunk/main.tf index 164af0512d..cb0a93d72c 100644 --- a/images/fluentd/tests/splunk/main.tf +++ b/images/fluentd/tests/splunk/main.tf @@ -9,6 +9,7 @@ variable "digest" { } data "oci_exec_test" "test" { - digest = var.digest - script = "${path.module}/01-test.sh" + digest = var.digest + script = "./01-test.sh" + working_dir = path.module }