You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
run_test "Dry run with valid PR number executes successfully""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --dry-run --verbose" 0 "[DRY RUN]"""
59
+
local test_install_path="$TEST_BASE_DIR/test-install-basic"
60
+
run_test "Dry run with valid PR number executes successfully""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --dry-run --verbose" 0 "[DRY RUN]"""
63
61
}
64
62
65
63
# Test: Dry run with run ID
66
64
test_dry_run_with_run_id() {
67
-
run_test "Dry run with specific run ID executes successfully""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --run-id $TEST_RUN_ID --install-path $TEST_INSTALL_DIR --dry-run --verbose" 0 "workflow run ID: $TEST_RUN_ID"""
65
+
local test_install_path="$TEST_BASE_DIR/test-install-run-id"
66
+
run_test "Dry run with specific run ID executes successfully""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --run-id $TEST_RUN_ID --install-path $test_install_path --dry-run --verbose" 0 "workflow run ID: $TEST_RUN_ID"""
68
67
}
69
68
70
69
# Test: Dry run with all options
71
70
test_dry_run_all_options() {
72
-
run_test "Dry run with all options executes successfully""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --os linux --arch x64 --verbose --keep-archive --dry-run" 0 "[DRY RUN]"""
71
+
local test_install_path="$TEST_BASE_DIR/test-install-all-options"
72
+
run_test "Dry run with all options executes successfully""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --os linux --arch x64 --verbose --keep-archive --dry-run" 0 "[DRY RUN]"""
73
73
}
74
74
75
75
# Test: Verbose flag increases output
76
76
test_verbose_flag() {
77
-
local test_cmd_quiet="$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --dry-run"
78
-
local test_cmd_verbose="$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --dry-run --verbose"
77
+
local test_install_path="$TEST_BASE_DIR/test-install-verbose"
78
+
local test_cmd_quiet="$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --dry-run"
79
+
local test_cmd_verbose="$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --dry-run --verbose"
79
80
80
81
test_verbose_flag_effect "Verbose flag increases output""$test_cmd_quiet""$test_cmd_verbose" 0
81
82
}
82
83
83
84
# Test: Short and long option equivalence
84
85
test_option_equivalence_wrapper() {
85
-
local test_cmd_short="$SCRIPT_UNDER_TEST$TEST_PR_NUMBER -i $TEST_INSTALL_DIR -r $TEST_RUN_ID -v -k --dry-run"
86
-
local test_cmd_long="$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --run-id $TEST_RUN_ID --verbose --keep-archive --dry-run"
86
+
local test_install_path="$TEST_BASE_DIR/test-install-options"
87
+
local test_cmd_short="$SCRIPT_UNDER_TEST$TEST_PR_NUMBER -i $test_install_path -r $TEST_RUN_ID -v -k --dry-run"
88
+
local test_cmd_long="$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --run-id $TEST_RUN_ID --verbose --keep-archive --dry-run"
87
89
88
90
test_option_equivalence "Short and long options are equivalent""$test_cmd_short""$test_cmd_long" 0 "workflow run ID: $TEST_RUN_ID"
89
91
}
90
92
91
93
# Test: Check GitHub CLI dependency
92
94
test_gh_dependency_check() {
93
95
# This test assumes gh is available in the environment
96
+
local test_install_path="$TEST_BASE_DIR/test-install-gh-check"
94
97
ifcommand -v gh >/dev/null 2>&1;then
95
98
# gh is available, script should proceed to dry run
96
-
run_test "GitHub CLI dependency check passes when gh is available""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --dry-run" 0 """"
99
+
run_test "GitHub CLI dependency check passes when gh is available""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --dry-run" 0 """"
97
100
else
98
101
# gh is not available, script should fail with appropriate message
99
-
run_test "GitHub CLI dependency check fails appropriately when gh not available""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --dry-run" 1 "GitHub CLI (gh) is required"""
102
+
run_test "GitHub CLI dependency check fails appropriately when gh not available""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --dry-run" 1 "GitHub CLI (gh) is required"""
run_test "OS and architecture override works correctly""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --os linux --arch arm64 --dry-run --verbose" 0 "cli-native-archives-linux-arm64"""
114
+
local test_install_path="$TEST_BASE_DIR/test-install-os-arch"
115
+
run_test "OS and architecture override works correctly""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --os linux --arch arm64 --dry-run --verbose" 0 "cli-native-archives-linux-arm64"""
112
116
}
113
117
114
118
# Test: Windows OS override
115
119
test_windows_os_override() {
116
-
run_test "Windows OS override works correctly""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --os win --arch x64 --dry-run --verbose" 0 "cli-native-archives-win-x64"""
120
+
local test_install_path="$TEST_BASE_DIR/test-install-windows"
121
+
run_test "Windows OS override works correctly""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --os win --arch x64 --dry-run --verbose" 0 "cli-native-archives-win-x64"""
117
122
}
118
123
119
124
# Test: PR-specific functionality is mentioned in output
120
125
test_pr_specific_output() {
121
-
run_test "PR number is properly displayed in output""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $TEST_INSTALL_DIR --dry-run --verbose" 0 "PR #$TEST_PR_NUMBER"""
126
+
local test_install_path="$TEST_BASE_DIR/test-install-pr-output"
127
+
run_test "PR number is properly displayed in output""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --install-path $test_install_path --dry-run --verbose" 0 "PR #$TEST_PR_NUMBER"""
122
128
}
123
129
124
130
# Test: Run ID specific functionality
125
131
test_run_id_specific_output() {
126
-
run_test "Workflow run URL is properly displayed""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --run-id $TEST_RUN_ID --install-path $TEST_INSTALL_DIR --dry-run --verbose" 0 "workflow run https://github.com/dotnet/aspire/actions/runs/$TEST_RUN_ID"""
132
+
local test_install_path="$TEST_BASE_DIR/test-install-run-id-output"
133
+
run_test "Workflow run URL is properly displayed""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --run-id $TEST_RUN_ID --install-path $test_install_path --dry-run --verbose" 0 "workflow run https://github.com/dotnet/aspire/actions/runs/$TEST_RUN_ID"""
# Test: Large PR number validation (should fail for non-existent PR)
145
155
test_large_pr_number() {
146
156
local large_pr="999999999"
147
-
run_test "Non-existent large PR numbers are properly rejected""$SCRIPT_UNDER_TEST$large_pr --install-path $TEST_INSTALL_DIR --dry-run" 1 "Failed to get HEAD SHA"""
157
+
local test_install_path="$TEST_BASE_DIR/test-install-large-pr"
158
+
run_test "Non-existent large PR numbers are properly rejected""$SCRIPT_UNDER_TEST$large_pr --install-path $test_install_path --dry-run" 1 "Failed to get HEAD SHA"""
148
159
}
149
160
150
161
# Test: Zero PR number rejection
@@ -160,7 +171,8 @@ test_negative_run_id() {
160
171
# Test: Very large run ID (should accept valid format but may fail on API call)
161
172
test_large_run_id() {
162
173
local large_run_id="99999999999999"
163
-
run_test "Large run ID format is accepted""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --run-id $large_run_id --install-path $TEST_INSTALL_DIR --dry-run" 0 "workflow run ID: $large_run_id"""
174
+
local test_install_path="$TEST_BASE_DIR/test-install-large-run-id"
175
+
run_test "Large run ID format is accepted""$SCRIPT_UNDER_TEST$TEST_PR_NUMBER --run-id $large_run_id --install-path $test_install_path --dry-run" 0 "workflow run ID: $large_run_id"""
0 commit comments