Skip to content

Commit f07bc4d

Browse files
committed
fix: resolve yq version compatibility and BATS warnings
- Handle both quoted and unquoted yq output for cross-version compatibility - Support both python-based yq (outputs quotes) and go-based yq (no quotes) - Fix BATS warning about expected exit codes by using run -0 -127 - Add minimum BATS version requirement for modern syntax - Resolves tests 19-21 failing due to different yq output formats in CI All tests now pass with proper version compatibility handling.
1 parent e357a81 commit f07bc4d

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

tests/unit/cli/enhanced_cli_test.bats

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bats
22

3+
bats_require_minimum_version 1.5.0
4+
35
setup() {
46
# Load test helper functions
57
load ../scripts/test_helper
@@ -122,7 +124,8 @@ teardown() {
122124
@test "selfhosted_deploy_compose_should_use_generated_files" {
123125
# Test that './selfhosted deploy compose' attempts to call compose function
124126
cd "${PROJECT_ROOT}"
125-
run bash "${PROJECT_ROOT}/selfhosted.sh" deploy compose up --dry-run
127+
# Expect either success (0) or command not found (127) - both are valid
128+
run -0 -127 bash "${PROJECT_ROOT}/selfhosted.sh" deploy compose up --dry-run
126129
# Should either generate files and run compose, or show that docker-compose is missing
127130
[[ "$output" == *"Starting services with Docker Compose"* ]] || [[ "$output" == *"docker-compose: command not found"* ]]
128131
}

tests/unit/config/services_config_test.bats

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ teardown() {
3434
# Test that actual budget service is defined
3535
run yq '.services.actual.name' "${BATS_TEST_DIRNAME}/../../../config/services.yaml"
3636
[ "$status" -eq 0 ]
37-
[[ "$output" == '"Actual Budget"' ]]
37+
# Handle both quoted (python yq) and unquoted (go yq) output
38+
[[ "$output" == '"Actual Budget"' || "$output" == 'Actual Budget' ]]
3839
}
3940

4041
@test "services_yaml_should_define_service_metadata" {
@@ -45,14 +46,16 @@ teardown() {
4546

4647
run yq '.services.actual.category' "${BATS_TEST_DIRNAME}/../../../config/services.yaml"
4748
[ "$status" -eq 0 ]
48-
[[ "$output" == '"finance"' ]]
49+
# Handle both quoted (python yq) and unquoted (go yq) output
50+
[[ "$output" == '"finance"' || "$output" == 'finance' ]]
4951
}
5052

5153
@test "services_yaml_should_define_domain_patterns" {
5254
# Test that services have domain configuration
5355
run yq '.services.actual.domain' "${BATS_TEST_DIRNAME}/../../../config/services.yaml"
5456
[ "$status" -eq 0 ]
55-
[[ "$output" == '"budget"' ]]
57+
# Handle both quoted (python yq) and unquoted (go yq) output
58+
[[ "$output" == '"budget"' || "$output" == 'budget' ]]
5659
}
5760

5861
@test "services_yaml_should_define_compose_config" {

0 commit comments

Comments
 (0)