test(e2e): Set a minio alias in the container (#4646)

This alias will be used by commands in a test when using the minio client. An alias needs to be defined in order for commands like retrieving an object from the bucket to work successfully.
This commit is contained in:
Michael Li authored and GitHub committed 2024-04-16 15:22:05 -04:00
1 parent 87b0866d8f
commit 69d686bc9a
3 files changed
+30

No files matched your search

+23
View File
@@ -73,6 +73,11 @@ variable "user_secret_access_key" {
type = string
default = "secretaccesskey"
}
variable "minio_alias" {
description = "Alias used in the minio cli"
type = string
default = "miniotest"
}
data "docker_registry_image" "minio_server" {
name = var.image_name_server
@@ -139,6 +144,20 @@ resource "enos_local_exec" "init_minio" {
inline = ["bash ./${path.module}/init.sh \"${var.image_name_client}\""]
}
resource "enos_local_exec" "set_alias" {
depends_on = [enos_local_exec.init_minio]
environment = {
MINIO_SERVER_CONTAINER_NAME = var.container_name,
MINIO_ALIAS = var.minio_alias
MINIO_ROOT_USER = var.root_user,
MINIO_ROOT_PASSWORD = var.root_password,
}
inline = [
"docker exec ${var.container_name} mc alias set ${var.minio_alias} http://localhost:9000 ${var.root_user} ${var.root_password}"
]
}
output "bucket_name" {
value = var.bucket_name
}
@@ -158,3 +177,7 @@ output "bucket_region" {
output "endpoint_url" {
value = "http://${var.container_name}:9000"
}
output "alias" {
value = var.minio_alias
}
+6
View File
@@ -134,6 +134,11 @@ variable "bucket_name" {
type = string
default = ""
}
variable "minio_alias" {
description = "Alias used in the minio cli"
type = string
default = ""
}
variable "bucket_endpoint_url" {
description = "Endpoint URL for the storage bucket"
type = string
@@ -258,6 +263,7 @@ resource "enos_local_exec" "run_e2e_test" {
E2E_BUCKET_ENDPOINT_URL = var.bucket_endpoint_url
E2E_BUCKET_ACCESS_KEY_ID = var.access_key_id
E2E_BUCKET_SECRET_ACCESS_KEY = var.secret_access_key
E2E_MINIO_ALIAS = var.minio_alias
E2E_REGION = var.region
E2E_POSTGRES_USER = var.postgres_user
E2E_POSTGRES_PASSWORD = var.postgres_password
@@ -27,6 +27,7 @@ docker run \
-e "E2E_BUCKET_ENDPOINT_URL=$E2E_BUCKET_ENDPOINT_URL" \
-e "E2E_BUCKET_ACCESS_KEY_ID=$E2E_BUCKET_ACCESS_KEY_ID" \
-e "E2E_BUCKET_SECRET_ACCESS_KEY=$E2E_BUCKET_SECRET_ACCESS_KEY" \
-e "E2E_MINIO_ALIAS=$E2E_MINIO_ALIAS" \
-e "VAULT_ADDR=$VAULT_ADDR_INTERNAL" \
-e "VAULT_TOKEN=$VAULT_TOKEN" \
-e "E2E_VAULT_ADDR=$E2E_VAULT_ADDR" \