"sdkman_checksum_enable" feature flag

This commit is contained in:
Hector Geraldino
2021-12-02 22:35:20 -05:00
committed by Marco Vermeulen
parent f4b21c1fb1
commit 77fe23a758
2 changed files with 20 additions and 2 deletions

View File

@@ -204,7 +204,13 @@ function __sdkman_checksum_zip() {
__sdkman_echo_yellow "Metadata file not found at '${headers_file}', skipping checksum..."
return
fi
if [[ "$sdkman_checksum_enable" != "true" ]]; then
echo ""
__sdkman_echo_yellow "Checksums are disabled, skipping verification..."
return
fi
#Check for the appropriate checksum tools
if command -v shasum > /dev/null 2>&1; then
shasum_avail=true

View File

@@ -3,6 +3,7 @@ Feature: Verify checksums
Background:
Given the internet is reachable
And an initialised environment
And I have configured "sdkman_checksum_enable" to "true"
Scenario: Install a specific Version with a valid SHA-256 checksum
Given the system is bootstrapped
@@ -85,7 +86,18 @@ Feature: Verify checksums
And the candidate "grails" version "1.3.9" is installed
And the response headers file is created for candidate "grails" and version "1.3.9"
And the exit code is 0
Scenario: Do not fail if checksums are disabled
Given the system is bootstrapped
And I have configured "sdkman_checksum_enable" to "false"
And the candidate "grails" version "1.3.9" is available for download with checksum "abc-checksum-00000" using algorithm "SHA-256"
When I enter "sdk install grails 1.3.9"
Then I see "Checksums are disabled, skipping verification"
And I see "Done installing!"
And the candidate "grails" version "1.3.9" is installed
And the response headers file is created for candidate "grails" and version "1.3.9"
And the exit code is 0
Scenario: Abort installation after download of a binary with invalid SHA checksum
Given the system is bootstrapped
And the candidate "grails" version "1.3.9" is available for download with checksum "c68e386a6deec9fc4c1e18df21f927000000000e" using algorithm "SHA-256"