Skip to content

Commit 1695d0c

Browse files
runcomclaude
andcommitted
Centralize FDO 2.0 support check in utils.sh
Extract duplicate FDO 2.0 support check into check_fdo_20_support() function in utils.sh. All three delegate tests now call this common function instead of duplicating the check logic. Reduces code duplication from ~7 lines × 3 tests to single function. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 0473502 commit 1695d0c

4 files changed

Lines changed: 15 additions & 21 deletions

File tree

test/ci/test-delegate-invalid-chain.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ run_test() {
2020
log_info "Environment variables"
2121
show_env
2222

23-
log_info "Checking if client supports FDO 2.0"
24-
if ! "${bin_dir}/go-fdo-client" onboard --help 2>&1 | grep -q "fdo-version"; then
25-
log_warn "Client does not support --fdo-version flag, skipping FDO 2.0 delegate test"
26-
trap - EXIT
27-
test_pass
28-
exit 0
29-
fi
23+
check_fdo_20_support
3024

3125
log_info "Creating directories"
3226
create_directories

test/ci/test-delegate-onboarding.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,7 @@ run_test() {
5252
log_info "Environment variables"
5353
show_env
5454

55-
log_info "Checking if client supports FDO 2.0"
56-
if ! "${bin_dir}/go-fdo-client" onboard --help 2>&1 | grep -q "fdo-version"; then
57-
log_warn "Client does not support --fdo-version flag, skipping FDO 2.0 delegate test"
58-
trap - EXIT
59-
test_pass
60-
exit 0
61-
fi
55+
check_fdo_20_support
6256

6357
log_info "Creating directories"
6458
create_directories

test/ci/test-delegate-permissions.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ run_test() {
1616
log_info "Environment variables"
1717
show_env
1818

19-
log_info "Checking if client supports FDO 2.0"
20-
if ! "${bin_dir}/go-fdo-client" onboard --help 2>&1 | grep -q "fdo-version"; then
21-
log_warn "Client does not support --fdo-version flag, skipping FDO 2.0 delegate test"
22-
trap - EXIT
23-
test_pass
24-
exit 0
25-
fi
19+
check_fdo_20_support
2620

2721
log_info "Creating directories"
2822
create_directories

test/ci/utils.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,3 +590,15 @@ cleanup() {
590590
uninstall_client
591591
remove_files
592592
}
593+
594+
# Check if client supports FDO 2.0 and skip test if not
595+
# This function will exit the script if FDO 2.0 is not supported
596+
check_fdo_20_support() {
597+
log_info "Checking if client supports FDO 2.0"
598+
if ! "${bin_dir}/go-fdo-client" onboard --help 2>&1 | grep -q "fdo-version"; then
599+
log_warn "Client does not support --fdo-version flag, skipping FDO 2.0 delegate test"
600+
trap - EXIT
601+
test_pass
602+
exit 0
603+
fi
604+
}

0 commit comments

Comments
 (0)