Verified Commit bec05bbb authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

dep_scripts: Fix error when no profile or version selected

parent 0c2a86cb
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ DRY_RUN=false

DEFAULT_PROFILE="default"
DEFAULT_VERSION="latest"
PROFILE_NAME=${DEFAULT_PROFILE}
PROFILE_VERSION=${DEFAULT_VERSION}
PROFILES_DIR="${PWD}/profiles"
SOURCES_FILE="${PROFILES_DIR}/sources.list"
declare -a PROFILE_DEP_LIST
@@ -390,9 +392,6 @@ while [[ $# -gt 0 ]]; do
            exit 1
        fi

        PROFILE_NAME=${DEFAULT_PROFILE}
        PROFILE_VERSION=${DEFAULT_VERSION}

        # e.g. mercury@mogon1:latest
        if [[ "$2" =~ ^(.*)@(.*):(.*)$ ]]; then
            if [[ -n "${BASH_REMATCH[1]}"  ]]; then
+0 −1
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
######## Installing:  margo ###############################
######## Installing:  rocksdb ###############################
######## Installing:  rocksdb:experimental ###############################
WARNING: Install script for 'rocksdb:experimental' not found. Skipping.
######## Installing:  syscall_intercept ###############################
######## Installing:  date ###############################
######## Installing:  psm2 ###############################
+0 −1
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
######## Installing:  argobots ###############################
######## Installing:  margo ###############################
######## Installing:  rocksdb:experimental ###############################
WARNING: Install script for 'rocksdb:experimental' not found. Skipping.
######## Installing:  syscall_intercept ###############################
######## Installing:  date ###############################
######## Installing:  psm2 ###############################
+14 −0
Original line number Diff line number Diff line
@@ -29,6 +29,20 @@ teardown() {
    assert_output --partial "usage: compile_dep.sh"
}

@test "[compile_dep.sh] Check no --profile or --dependency options" {

    expected_output=${SCRIPT_TESTDIR}/latest/default.out

    assert_exist $expected_output

    run compile_dep.sh -n bar baz

    while IFS= read -r line
    do
        assert_output --partial "$line"
    done < "$expected_output"
}

@test "[compile_dep.sh] Check --profile and --dependency option at the same time" {
    run -1 compile_dep.sh -p foobar -d barbaz
    assert_output --partial "ERROR: --profile and --dependency options are mutually exclusive" 
+14 −0
Original line number Diff line number Diff line
@@ -29,6 +29,20 @@ teardown() {
    assert_output --partial "usage: dl_dep.sh"
}

@test "[dl_dep.sh] Check no --profile or --dependency options" {

    expected_output=${SCRIPT_TESTDIR}/latest/default.out

    assert_exist $expected_output

    run dl_dep.sh -n "${BATS_TEST_TMPDIR}"

    while IFS= read -r line
    do
        assert_output --partial "$line"
    done < "$expected_output"
}

@test "[dl_dep.sh] Check --profile and --dependency option at the same time" {
    run -1 dl_dep.sh -p foobar -d barbaz
    assert_output --partial "ERROR: --profile and --dependency options are mutually exclusive"