Updates tests.
This commit is contained in:
@@ -15,45 +15,47 @@ teardown() {
|
||||
teardown_test_project "config-test"
|
||||
}
|
||||
|
||||
@test "get_current_config with existing config" {
|
||||
CLUSTER_NAME=$(get_current_config "cluster.name")
|
||||
@test "wild-config with existing config" {
|
||||
CLUSTER_NAME=$(wild-config "cluster.name")
|
||||
assert_equal "$CLUSTER_NAME" "test-cluster"
|
||||
}
|
||||
|
||||
@test "get_current_config with nested path" {
|
||||
VIP=$(get_current_config "cluster.nodes.control.vip")
|
||||
@test "wild-config with nested path" {
|
||||
VIP=$(wild-config "cluster.nodes.control.vip")
|
||||
assert_equal "$VIP" "192.168.100.200"
|
||||
}
|
||||
|
||||
@test "get_current_config with non-existent key" {
|
||||
NONEXISTENT=$(get_current_config "nonexistent.key")
|
||||
@test "wild-config with non-existent key" {
|
||||
NONEXISTENT=$(wild-config "nonexistent.key")
|
||||
assert_equal "$NONEXISTENT" ""
|
||||
}
|
||||
|
||||
@test "active nodes configuration access - interface" {
|
||||
CONTROL_NODE_INTERFACE=$(get_current_config "cluster.nodes.active.\"192.168.100.201\".interface")
|
||||
CONTROL_NODE_INTERFACE=$(wild-config "cluster.nodes.active.\"192.168.100.201\".interface")
|
||||
assert_equal "$CONTROL_NODE_INTERFACE" "eth0"
|
||||
}
|
||||
|
||||
@test "active nodes configuration access - maintenance IP" {
|
||||
MAINTENANCE_IP=$(get_current_config "cluster.nodes.active.\"192.168.100.201\".maintenanceIp")
|
||||
MAINTENANCE_IP=$(wild-config "cluster.nodes.active.\"192.168.100.201\".maintenanceIp")
|
||||
assert_equal "$MAINTENANCE_IP" "192.168.100.131"
|
||||
}
|
||||
|
||||
@test "get_current_secret function" {
|
||||
@test "wild-secret function" {
|
||||
# Create temporary secrets file for testing
|
||||
cp "$TEST_DIR/fixtures/sample-secrets.yaml" "$TEST_PROJECT_DIR/secrets.yaml"
|
||||
|
||||
SECRET_VAL=$(get_current_secret "operator.cloudflareApiToken")
|
||||
SECRET_VAL=$(wild-secret "operator.cloudflareApiToken")
|
||||
assert_equal "$SECRET_VAL" "test_api_token_123456789"
|
||||
}
|
||||
|
||||
@test "config access from subdirectory" {
|
||||
mkdir -p "$TEST_PROJECT_DIR/config-subdir"
|
||||
cd "$TEST_PROJECT_DIR/config-subdir"
|
||||
unset WC_HOME WC_ROOT
|
||||
unset WC_HOME
|
||||
export WC_ROOT="$PROJECT_ROOT"
|
||||
export PATH="$PROJECT_ROOT/bin:$PATH"
|
||||
init_wild_env
|
||||
|
||||
SUBDIR_CLUSTER=$(get_current_config "cluster.name")
|
||||
SUBDIR_CLUSTER=$(wild-config "cluster.name")
|
||||
assert_equal "$SUBDIR_CLUSTER" "test-cluster"
|
||||
}
|
Reference in New Issue
Block a user