test(e2e): Add test for worker-led worker registration (#4014)

* refact(e2e): Create module to run boundary commands

* test(e2e): Add worker-led registration test
This commit is contained in:
Michael Li authored and GitHub committed 2023-11-09 09:55:47 -05:00
1 parent 527c383ea3
commit b0127116f3
13 files changed
+432 -66

No files matched your search

+20 -1
View File
@@ -60,6 +60,11 @@ variable "token" {
type = string
default = ""
}
variable "worker_led_registration" {
description = "Enables worker-led registration flow"
type = bool
default = false
}
resource "docker_image" "boundary" {
name = var.image_name
@@ -117,7 +122,7 @@ resource "docker_container" "worker" {
timeout = "5s"
retries = 5
}
wait = true
wait = var.worker_led_registration ? false : true
must_run = true
dynamic "networks_advanced" {
for_each = var.network_name
@@ -127,7 +132,17 @@ resource "docker_container" "worker" {
}
}
resource "enos_local_exec" "get_worker_led_token" {
count = var.worker_led_registration ? 1 : 0
depends_on = [
docker_container.worker
]
inline = ["timeout 10s bash -c 'set -eo pipefail; until docker logs ${var.container_name} 2>&1 | grep \"Worker Auth Registration Request: .*\" | cut -f2- -d':' | xargs; do sleep 2; done'"]
}
resource "enos_local_exec" "check_address" {
count = var.worker_led_registration ? 0 : 1
depends_on = [
docker_container.worker
]
@@ -138,3 +153,7 @@ resource "enos_local_exec" "check_address" {
output "upstream_address" {
value = "${var.container_name}:${var.port}"
}
output "worker_led_token" {
value = var.worker_led_registration ? enos_local_exec.get_worker_led_token[0].stdout : ""
}
@@ -0,0 +1,63 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
disable_mlock = true
telemetry {
prometheus_retention_time = "24h"
disable_hostname = true
}
listener "tcp" {
address = "0.0.0.0:${port}"
purpose = "proxy"
tls_disable = true
}
listener "tcp" {
address = "0.0.0.0:${port_ops}"
purpose = "ops"
tls_disable = true
}
worker {
public_addr = "${worker_name}:${port}"
initial_upstreams = ["${initial_upstream}"]
tags {
type = ${type_tags},
}
auth_storage_path = "/tmp/boundary/worker"
}
events {
audit_enabled = true
sysevents_enabled = true
observations_enable = true
sink "stderr" {
name = "all-events"
description = "All events sent to stderr"
event_types = ["*"]
format = "cloudevents-json"
}
sink {
name = "Log File"
event_types = ["*"]
format = "cloudevents-json"
file {
path = "/boundary/logs"
file_name = "events.log"
}
audit_config {
audit_filter_overrides {
secret = "redact"
sensitive = "redact"
}
}
}
}