chore(e2e): Wait until worker log shows connection is ready (#6676)

(cherry picked from commit 7a8425212e8de2b716e451828814c6177442084f)
pull/6688/head
Michael Li 1 week ago committed by GitHub
parent f19f776234
commit c2eca9ab3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -206,6 +206,10 @@ module "docker_check_health" {
source = "./modules/docker_check_health"
}
module "docker_check_worker_log" {
source = "./modules/docker_check_worker_log"
}
module "docker_ldap" {
source = "./modules/docker_ldap"
}

@ -0,0 +1,10 @@
#!/usr/bin/env sh
# Copyright IBM Corp. 2020, 2026
# SPDX-License-Identifier: BUSL-1.1
set -eu -o pipefail
boundary workers list \
-filter "\"/item/name\"==\"$WORKER_NAME\"" \
-token env://BOUNDARY_TOKEN \
-format json

@ -33,6 +33,11 @@ variable "script" {
description = "Filename of a script in the module directory to run"
type = string
}
variable "worker_name" {
description = "Name of worker to look up"
type = string
default = ""
}
variable "worker_token" {
description = "Worker generated auth token"
type = string
@ -69,6 +74,7 @@ resource "enos_local_exec" "run_script" {
SCRIPT = "${abspath(path.module)}/${var.script}"
BOUNDARY_TOKEN = local.auth_token
WORKER_TOKEN = var.worker_token
WORKER_NAME = var.worker_name
}
inline = ["bash ./${path.module}/script_runner.sh"]
}

@ -19,6 +19,7 @@ docker run \
-e "BPASS=$E2E_PASSWORD_ADMIN_PASSWORD" \
-e "BOUNDARY_TOKEN=$BOUNDARY_TOKEN" \
-e "WORKER_TOKEN=$WORKER_TOKEN" \
-e "WORKER_NAME=$WORKER_NAME" \
-e "SKIP_CHOWN=true" \
--cap-add IPC_LOCK \
--network $TEST_NETWORK_NAME \

@ -0,0 +1,23 @@
# Copyright IBM Corp. 2020, 2026
# SPDX-License-Identifier: BUSL-1.1
terraform {
required_providers {
enos = {
source = "registry.terraform.io/hashicorp-forge/enos"
}
}
}
variable "container_name" {
description = "Name of docker container to inspect"
}
variable "worker_id" {
description = "worker id"
type = string
}
resource "enos_local_exec" "check_log" {
inline = ["timeout 10s bash -c 'until docker logs ${var.container_name} 2>&1 | grep \"new control plane connection saved.*${var.worker_id}\"; do sleep 2; done'"]
}

@ -163,6 +163,11 @@ resource "enos_local_exec" "check_address" {
inline = ["timeout 10s bash -c 'until echo $(curl -s -i \"http://0.0.0.0:${local.port_ops}/health?worker_info=1\") | grep -i \\\"upstream_connection_state\\\":\\\"READY\\\"; do sleep 2; done'"]
}
output "worker_name" {
value = var.container_name
}
output "upstream_address" {
value = "${var.container_name}:${var.port}"
}

Loading…
Cancel
Save