#!./common/bats/bin/bats
# -*-sh-*-

load ./common/test_helper_functions || exit 1
source ./common/functions || exit 1

if [ -s ./common/TEST_ENV ];then
    source ./common/TEST_ENV
fi

check_rms

@test "[pdsh] check for RPM" {
    run check_if_rpm_installed "pdsh${DELIM}"
    assert_success
}

@test "[pdsh] run a shell command on c[1-4]" {
    run pdsh -w c[1-4] 'grep . /proc/sys/kernel/ostype'
    assert_success
}

@test "[pdsh] check for pdsh-mod-slurm RPM" {
    run check_if_rpm_installed "pdsh-mod-slurm${DELIM}"
    if [ x$RESOURCE_MANAGER = "xslurm" ];then
        assert_success
    else
        assert_failure
    fi
}

@test "[pdsh] run a shell command on -P normal" {
    run pdsh -P normal 'grep . /proc/sys/kernel/ostype'
    if [ x$RESOURCE_MANAGER = "xslurm" ];then
        assert_success
    else
        assert_failure
    fi
}
