github.com/metasources/buildx@v0.0.0-20230418141019-7aa1459cedea/test/install/0_search_for_asset_test.sh (about) 1 . test_harness.sh 2 3 # search for an asset in a release checksums file 4 test_search_for_asset_release() { 5 fixture=./test-fixtures/buildx_0.36.0_checksums.txt 6 7 # search_for_asset [checksums-file-path] [name] [os] [arch] [format] 8 9 # positive case 10 actual=$(search_for_asset "${fixture}" "buildx" "linux" "amd64" "tar.gz") 11 assertEquals "buildx_0.36.0_linux_amd64.tar.gz" "${actual}" "unable to find release asset" 12 13 # negative cases 14 actual=$(search_for_asset "${fixture}" "buildx" "Linux" "amd64" "tar.gz") 15 assertEquals "" "${actual}" "found a release asset but did not expect to (os)" 16 17 actual=$(search_for_asset "${fixture}" "buildx" "darwin" "amd64" "rpm") 18 assertEquals "" "${actual}" "found a release asset but did not expect to (format)" 19 20 } 21 22 run_test_case test_search_for_asset_release 23 24 25 # search for an asset in a snapshot checksums file 26 test_search_for_asset_snapshot() { 27 fixture=./test-fixtures/buildx_0.35.1-SNAPSHOT-d461f63_checksums.txt 28 29 # search_for_asset [checksums-file-path] [name] [os] [arch] [format] 30 31 # positive case 32 actual=$(search_for_asset "${fixture}" "buildx" "linux" "amd64" "rpm") 33 assertEquals "buildx_0.35.1-SNAPSHOT-d461f63_linux_amd64.rpm" "${actual}" "unable to find snapshot asset" 34 35 # negative case 36 actual=$(search_for_asset "${fixture}" "buildx" "linux" "amd64" "zip") 37 assertEquals "" "${actual}" "found a snapshot asset but did not expect to (format)" 38 } 39 40 run_test_case test_search_for_asset_snapshot