Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@ testing/docker/certs/

# Claude Code
.claude/

# Visual Studio Code
.vscode/
36 changes: 36 additions & 0 deletions scheduled_task/deployment/tests/workflow_overrides.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bats
# =============================================================================
# Tests that verify scheduled_task deployment workflows override base k8s steps
# that do not apply to this scope type (e.g. ALB target group capacity).
#
# Contract:
# - Overlay must mark the step with `action: skip`.
# - Base workflow must still declare the step under the same name, otherwise
# a rename upstream would silently re-enable the step here.
# =============================================================================

setup() {
export PROJECT_ROOT="$(cd "$BATS_TEST_DIRNAME/../../.." && pwd)"
source "$PROJECT_ROOT/testing/assertions.sh"

export OVERLAY="$PROJECT_ROOT/scheduled_task/deployment/workflows/initial.yaml"
export BASE="$PROJECT_ROOT/k8s/deployment/workflows/initial.yaml"
}

# =============================================================================
# validate alb target group capacity
# =============================================================================
@test "base k8s deployment initial workflow declares 'validate alb target group capacity' step" {
run grep -A 2 "name: validate alb target group capacity" "$BASE"

assert_equal "$status" "0"
assert_contains "$output" "type: script"
assert_contains "$output" "validate_alb_target_group_capacity"
}

@test "scheduled_task deployment initial overlay skips 'validate alb target group capacity'" {
run grep -A 1 "name: validate alb target group capacity" "$OVERLAY"

assert_equal "$status" "0"
assert_contains "$output" "action: skip"
}
2 changes: 2 additions & 0 deletions scheduled_task/deployment/workflows/initial.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include:
- "$SERVICE_PATH/values.yaml"
steps:
- name: validate alb target group capacity
action: skip
- name: route traffic
action: skip
- name: create deployment
Expand Down
54 changes: 54 additions & 0 deletions scheduled_task/scope/tests/workflow_overrides.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bats
# =============================================================================
# Tests that verify scheduled_task scope workflows override base k8s steps
# that do not apply to this scope type (e.g. ALB capacity validation).
#
# Contract:
# - Overlay must mark the step with `action: skip`.
# - Base workflow must still declare the step under the same name, otherwise
# the skip is a no-op and the base step would not run anyway (or worse, a
# rename upstream would silently re-enable the step here).
# =============================================================================

setup() {
export PROJECT_ROOT="$(cd "$BATS_TEST_DIRNAME/../../.." && pwd)"
source "$PROJECT_ROOT/testing/assertions.sh"

export OVERLAY="$PROJECT_ROOT/scheduled_task/scope/workflows/create.yaml"
export BASE="$PROJECT_ROOT/k8s/scope/workflows/create.yaml"
}

# =============================================================================
# validate alb capacity
# =============================================================================
@test "base k8s scope create workflow declares 'validate alb capacity' step" {
run grep -A 2 "name: validate alb capacity" "$BASE"

assert_equal "$status" "0"
assert_contains "$output" "type: script"
assert_contains "$output" "validate_alb_capacity"
}

@test "scheduled_task scope create overlay skips 'validate alb capacity'" {
run grep -A 1 "name: validate alb capacity" "$OVERLAY"

assert_equal "$status" "0"
assert_contains "$output" "action: skip"
}

# =============================================================================
# networking (scheduled_task has no public traffic, so the whole block is skipped)
# =============================================================================
@test "base k8s scope create workflow declares 'networking' step" {
run grep -A 1 "name: networking" "$BASE"

assert_equal "$status" "0"
assert_contains "$output" "type: workflow"
}

@test "scheduled_task scope create overlay skips 'networking'" {
run grep -A 1 "name: networking" "$OVERLAY"

assert_equal "$status" "0"
assert_contains "$output" "action: skip"
}
2 changes: 2 additions & 0 deletions scheduled_task/scope/workflows/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ include:
- "$SERVICE_PATH/values.yaml"
steps:
- name: networking
action: skip
- name: validate alb capacity
action: skip
Loading