chore(enos): Remove bats test from running in enos (#2929)

* chore(enos): Remove bats tests from enos

* chore(enos): Update cache name to match vault version
This commit is contained in:
Michael Li authored and GitHub committed 2023-02-07 16:30:38 -05:00
1 parent 6403b0f389
commit d1429a40df
5 files changed
+1 -288

No files matched your search

+1 -22
View File
@@ -25,7 +25,6 @@ jobs:
fail-fast: false # don't fail as that can skip required cleanup steps for jobs
matrix:
include:
- filter: 'integration test:cli_ui builder:crt'
- filter: 'e2e_aws builder:crt'
- filter: 'e2e_database'
- filter: 'e2e_static builder:crt'
@@ -83,31 +82,11 @@ jobs:
uses: actions/cache@v3
with:
path: /tmp/test-deps
key: enos-test-deps-jq-1.6-password-store-1.7.4-vault-1.11.4
key: enos-test-deps-password-store-1.7.4-vault-1.12.2
- name: Debug dep-cache
run: |
mkdir -p /tmp/test-deps
ls -la /tmp/test-deps
- name: Set up Node for Bats install
if: matrix.filter == 'integration test:cli_ui builder:crt'
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Bats via NPM
if: matrix.filter == 'integration test:cli_ui builder:crt'
# Use npm so this workflow is portable on multiple runner distros
run: npm install --location=global bats
- name: Download jq for Bats CLI UI tests
if: steps.dep-cache.outputs.cache-hit != 'true'
# NOTE: if you update the jq version make sure to update the dep cache key
run: |
mkdir -p /tmp/test-deps
wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -O /tmp/test-deps/jq-bin
- name: Install jq for Bats CLI UI tests
if: matrix.filter == 'integration test:cli_ui builder:crt'
run: |
chmod +x /tmp/test-deps/jq-bin
sudo cp /tmp/test-deps/jq-bin /usr/local/bin/jq
- name: Download and unzip pass for Boundary keyring
if: steps.dep-cache.outputs.cache-hit != 'true'
# NOTE: if you update the password store version make sure to update the dep cache key
-8
View File
@@ -9,10 +9,6 @@ module "bats_deps" {
source = "./modules/bats_deps"
}
module "binary_finder" {
source = "./modules/binary_finder"
}
module "boundary" {
source = "app.terraform.io/hashicorp-qti/aws-boundary/enos"
version = ">= 0.2.6"
@@ -90,10 +86,6 @@ module "vault" {
ssh_aws_keypair = var.aws_ssh_keypair_name
}
module "test_cli_ui" {
source = "./modules/test_cli_ui"
}
module "test_e2e" {
source = "./modules/test_e2e"
}
-113
View File
@@ -1,113 +0,0 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
scenario "integration" {
terraform_cli = terraform_cli.default
terraform = terraform.default
providers = [
provider.aws.default,
provider.enos.default
]
matrix {
builder = ["local", "crt"]
test = ["cli_ui"]
}
locals {
aws_ssh_private_key_path = abspath(var.aws_ssh_private_key_path)
boundary_install_dir = abspath(var.boundary_install_dir)
local_boundary_dir = abspath(var.local_boundary_dir)
build_path = {
"local" = "/tmp",
"crt" = var.crt_bundle_path == null ? null : abspath(var.crt_bundle_path)
}
tags = merge({
"Project Name" : var.project_name
"Project" : "Enos",
"Environment" : "ci"
}, var.tags)
}
step "ensure_bats_and_deps_are_installed" {
skip_step = matrix.test != "cli_ui"
module = module.bats_deps
}
step "find_azs" {
module = module.az_finder
variables {
instance_type = [
var.worker_instance_type,
var.controller_instance_type
]
}
}
step "create_db_password" {
module = module.random_stringifier
}
step "build_boundary" {
module = matrix.builder == "crt" ? module.build_crt : module.build_local
variables {
path = local.build_path[matrix.builder]
}
}
step "create_base_infra" {
module = module.infra
variables {
availability_zones = step.find_azs.availability_zones
common_tags = local.tags
}
}
step "create_boundary_cluster" {
module = module.boundary
depends_on = [
step.create_base_infra,
step.build_boundary
]
variables {
boundary_install_dir = local.boundary_install_dir
common_tags = local.tags
controller_instance_type = var.controller_instance_type
controller_count = var.controller_count
db_pass = step.create_db_password.string
kms_key_arn = step.create_base_infra.kms_key_arn
local_artifact_path = step.build_boundary.artifact_path
ubuntu_ami_id = step.create_base_infra.ami_ids["ubuntu"]["amd64"]
vpc_id = step.create_base_infra.vpc_id
worker_count = var.worker_count
worker_instance_type = var.worker_instance_type
}
}
step "run_test_cli_ui" {
skip_step = matrix.test != "cli_ui"
module = module.test_cli_ui
depends_on = [step.create_boundary_cluster]
variables {
alb_boundary_api_addr = step.create_boundary_cluster.alb_boundary_api_addr
auth_login_name = step.create_boundary_cluster.auth_login_name
auth_method_id = step.create_boundary_cluster.auth_method_id
auth_password = step.create_boundary_cluster.auth_password
auth_user_id = step.create_boundary_cluster.auth_user_id
boundary_install_dir = local.boundary_install_dir
controller_ips = step.create_boundary_cluster.controller_ips
host_catalog_id = step.create_boundary_cluster.host_catalog_id
host_id = step.create_boundary_cluster.host_id
host_set_id = step.create_boundary_cluster.host_set_id
local_boundary_dir = local.local_boundary_dir
project_scope_id = step.create_boundary_cluster.project_scope_id
org_scope_id = step.create_boundary_cluster.org_scope_id
target_id = step.create_boundary_cluster.target_id
}
}
}
-20
View File
@@ -1,20 +0,0 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
terraform {
required_providers {
enos = {
source = "app.terraform.io/hashicorp-qti/enos"
}
}
}
module "ensure_bats" {
source = "../binary_finder"
name = "bats"
}
module "ensure_jq" {
source = "../binary_finder"
name = "jq"
}
-125
View File
@@ -1,125 +0,0 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
terraform {
required_providers {
enos = {
source = "app.terraform.io/hashicorp-qti/enos"
}
}
}
variable "alb_boundary_api_addr" {}
variable "auth_login_name" {}
variable "auth_method_id" {}
variable "auth_password" {}
variable "auth_user_id" {}
variable "boundary_install_dir" {}
variable "controller_ips" {}
variable "host_catalog_id" {}
variable "host_id" {}
variable "host_set_id" {}
variable "local_boundary_dir" {}
variable "org_scope_id" {}
variable "project_scope_id" {}
variable "target_id" {}
resource "enos_local_exec" "local_boundary_version" {
inline = ["${var.local_boundary_dir}/boundary version -format=json"]
}
resource "enos_remote_exec" "remote_boundary_version" {
inline = ["${var.boundary_install_dir}/boundary version -format=json"]
transport = {
ssh = {
host = var.controller_ips.0
}
}
}
resource "enos_local_exec" "get_token" {
environment = {
BOUNDARY_ADDR = var.alb_boundary_api_addr,
BOUNDARY_PATH = var.local_boundary_dir,
METHOD_ID = var.auth_method_id,
LOGIN_NAME = var.auth_login_name,
PASSWORD = var.auth_password,
}
scripts = ["${path.module}/../../templates/get-token.sh"]
}
locals {
auth_token = jsondecode(enos_local_exec.get_token.stdout).item.attributes.token
test_user = "username123"
test_password = var.auth_password
base_environment = {
BOUNDARY_ADDR = var.alb_boundary_api_addr,
BOUNDARY_TOKEN = local.auth_token
}
}
resource "enos_local_exec" "create_account" {
environment = {
BOUNDARY_ADDR = var.alb_boundary_api_addr,
BOUNDARY_TOKEN = local.auth_token,
BP = local.test_password
}
inline = ["${var.local_boundary_dir}/boundary accounts create password -auth-method-id ${var.auth_method_id} -login-name ${local.test_user} -name ${local.test_user} -password env://BP -description 'test user' -format json"]
}
locals {
account_id = jsondecode(enos_local_exec.create_account.stdout).item.id
}
resource "enos_local_exec" "create_user" {
environment = local.base_environment
inline = ["${var.local_boundary_dir}/boundary users create -scope-id 'global' -name ${local.test_user} -description 'test user' -format json"]
}
locals {
user_id = jsondecode(enos_local_exec.create_user.stdout).item.id
}
resource "enos_local_exec" "set_accounts" {
environment = local.base_environment
inline = ["${var.local_boundary_dir}/boundary users set-accounts -id ${local.user_id} -account ${local.account_id}"]
}
resource "enos_local_exec" "get_role_id" {
environment = local.base_environment
inline = ["${var.local_boundary_dir}/boundary roles list -scope-id=${var.project_scope_id} -format json"]
}
locals {
# Get the role used for u_auth within the project
role_id = jsondecode(enos_local_exec.get_role_id.stdout).items[1].id
}
resource "enos_local_exec" "add_grants" {
depends_on = [enos_local_exec.get_role_id]
environment = local.base_environment
inline = ["${var.local_boundary_dir}/boundary roles add-grants -id=${local.role_id} -grant='id=*;type=target;actions=authorize-session' -format json"]
}
resource "enos_local_exec" "run_bats" {
depends_on = [enos_local_exec.create_user]
environment = {
BOUNDARY_ADDR = var.alb_boundary_api_addr,
IS_VERSION = "true",
DEFAULT_LOGIN = "admin",
DEFAULT_UNPRIVILEGED_LOGIN = local.test_user,
DEFAULT_P_ID = var.project_scope_id
DEFAULT_O_ID = var.org_scope_id
DEFAULT_HOST_SET = var.host_set_id
DEFAULT_HOST_CATALOG = var.host_catalog_id
DEFAULT_HOST = var.host_id
DEFAULT_PASSWORD = var.auth_password
DEFAULT_TARGET = var.target_id
DEFAULT_AMPW = var.auth_method_id
DEFAULT_USER = var.auth_user_id
DEFAULT_UNPRIVILEGED_USER = local.user_id
}
// TERM isn't set automatically in CI so we need to make sure it's always there.
inline = ["TERM=\"$${TERM:=dumb}\" PATH=\"${var.local_boundary_dir}:$PATH\" bats -p ../../../internal/tests/cli/boundary"]
}