From e1fd8ad970613b1d9d97d6af6c9890c436226ba5 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 13 Jul 2022 01:28:47 -0400 Subject: [PATCH] ci: tolerate the lack of tags in the repository (#1296) --- test/update_command.bats | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/test/update_command.bats b/test/update_command.bats index 205858ad..dabe69da 100644 --- a/test/update_command.bats +++ b/test/update_command.bats @@ -35,22 +35,26 @@ teardown() { @test "asdf update should checkout the latest non-RC tag" { local tag=$(git tag | grep -vi "rc" | tail -1) - run asdf update - [ "$status" -eq 0 ] - cd $ASDF_DIR - git tag | grep $tag - [ "$?" -eq 0 ] + if [ -n "$tag" ]; then + run asdf update + [ "$status" -eq 0 ] + cd $ASDF_DIR + git tag | grep $tag + [ "$?" -eq 0 ] + fi } @test "asdf update should checkout the latest tag when configured with use_release_candidates = yes" { local tag=$(git tag | tail -1) - export ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults - echo "use_release_candidates = yes" >$ASDF_CONFIG_DEFAULT_FILE - run asdf update - [ "$status" -eq 0 ] - cd $ASDF_DIR - git tag | grep $tag - [ "$?" -eq 0 ] + if [ -n "$tag" ]; then + export ASDF_CONFIG_DEFAULT_FILE=$BATS_TMPDIR/asdfrc_defaults + echo "use_release_candidates = yes" >$ASDF_CONFIG_DEFAULT_FILE + run asdf update + [ "$status" -eq 0 ] + cd $ASDF_DIR + git tag | grep $tag + [ "$?" -eq 0 ] + fi } @test "asdf update is a noop for when updates are disabled" {