chore(enos): Add debug variable (#3037)
This commit is contained in:
1 parent
ab0a2ad689
commit
54aad4d292
9 files changed
+35
-6
No files matched your search
@@ -176,6 +176,7 @@ scenario "e2e_aws" {
|
||||
|
||||
variables {
|
||||
test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/aws"
|
||||
debug_no_run = var.e2e_debug_no_run
|
||||
alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr
|
||||
auth_method_id = step.create_boundary_cluster.auth_method_id
|
||||
auth_login_name = step.create_boundary_cluster.auth_login_name
|
||||
|
||||
@@ -100,6 +100,7 @@ scenario "e2e_database" {
|
||||
|
||||
variables {
|
||||
test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/database"
|
||||
debug_no_run = var.e2e_debug_no_run
|
||||
local_boundary_dir = local.local_boundary_dir
|
||||
target_user = "ubuntu"
|
||||
aws_ssh_private_key_path = local.aws_ssh_private_key_path
|
||||
|
||||
@@ -132,6 +132,7 @@ scenario "e2e_static_with_vault" {
|
||||
|
||||
variables {
|
||||
test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/static_with_vault"
|
||||
debug_no_run = var.e2e_debug_no_run
|
||||
alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr
|
||||
auth_method_id = step.create_boundary_cluster.auth_method_id
|
||||
auth_login_name = step.create_boundary_cluster.auth_login_name
|
||||
|
||||
@@ -109,6 +109,7 @@ scenario "e2e_static" {
|
||||
|
||||
variables {
|
||||
test_package = "github.com/hashicorp/boundary/testing/internal/e2e/tests/static"
|
||||
debug_no_run = var.e2e_debug_no_run
|
||||
alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr
|
||||
auth_method_id = step.create_boundary_cluster.auth_method_id
|
||||
auth_login_name = step.create_boundary_cluster.auth_login_name
|
||||
|
||||
@@ -124,3 +124,9 @@ variable "local_build_target" {
|
||||
type = string
|
||||
default = "build-ui build"
|
||||
}
|
||||
|
||||
variable "e2e_debug_no_run" {
|
||||
description = "If set, this will prevent test suites from running"
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
@@ -40,3 +40,8 @@
|
||||
// The port the ALB will listen on to proxy controller API requests. This defaults
|
||||
// to 9200
|
||||
// alb_listener_api_port = 9200
|
||||
|
||||
// Generally, if there's failure in the test suite for any reason, enos/terraform will throw an error and you
|
||||
// would not be able to access the environment variables needed to test locally. Enabling this
|
||||
// will ensure that the enos scenario passes.
|
||||
// e2e_debug_no_run = true
|
||||
@@ -9,6 +9,11 @@ terraform {
|
||||
}
|
||||
}
|
||||
|
||||
variable "debug_no_run" {
|
||||
description = "If set, this module will not execute the tests so that you can still access environment variables"
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
variable "test_package" {
|
||||
description = "Name of Go test package to run"
|
||||
type = string
|
||||
@@ -139,7 +144,7 @@ resource "enos_local_exec" "run_e2e_test" {
|
||||
E2E_AWS_HOST_SET_IPS2 = local.aws_host_set_ips2
|
||||
}
|
||||
|
||||
inline = ["set -o pipefail; PATH=\"${var.local_boundary_dir}:$PATH\" go test -v ${var.test_package} -count=1 -json | tparse -follow -format plain 2>&1 | tee ${path.module}/../../test-e2e-${local.package_name}.out"]
|
||||
inline = var.debug_no_run ? [""] : ["set -o pipefail; PATH=\"${var.local_boundary_dir}:$PATH\" go test -v ${var.test_package} -count=1 -json | tparse -follow -format plain 2>&1 | tee ${path.module}/../../test-e2e-${local.package_name}.out"]
|
||||
}
|
||||
|
||||
output "test_results" {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) HashiCorp, Inc.
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
DIR=$(pwd)
|
||||
|
||||
SCRIPTS_DIR=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
|
||||
STATEDIR=$(ls -td $SCRIPTS_DIR/../.enos/*/ | head -1) # get latest directory
|
||||
|
||||
cd $STATEDIR
|
||||
terraform show -json terraform.tfstate | jq -r '.values.root_module.child_modules[].resources[] | select(.address=="module.run_e2e_test.enos_local_exec.run_e2e_test") | .values.environment | to_entries[] | "export \(.key)=\(.value|@sh)"'
|
||||
|
||||
cd $DIR
|
||||
@@ -110,11 +110,7 @@ Launch an enos scenario and print out the environment variables
|
||||
```
|
||||
cd enos
|
||||
enos scenario launch e2e_{scenario} builder:local
|
||||
enos scenario output
|
||||
cd .enos
|
||||
ls -ltr
|
||||
cd <most_recent_directory> # bottom of list
|
||||
terraform show -json terraform.tfstate | jq -r '.values.root_module.child_modules[].resources[] | select(.address=="module.run_e2e_test.enos_local_exec.run_e2e_test") | .values.environment | to_entries[] | "export \(.key)=\(.value)"'
|
||||
bash scripts/test_e2e_env.sh
|
||||
```
|
||||
|
||||
Take the printed environment variable information and export them into another terminal session
|
||||
|
||||
Reference in new issue
Block a user