# # Pipeline uni tests using BATS framework. # bats_require_minimum_version 1.5.0 setup() { source "${PWD}/tests/tests.conf" make build >/dev/null DESTDIR="${temp}" make install >/dev/null install --no-target-directory \ "${PWD}/tests/tests.conf" \ "${temp}${sysconf_dir}/${name}/${name}.conf" source "${errs_file}" } teardown() { rm --recursive --force "${temp}" make clean >/dev/null } @test "run with bad arguments" { run -1 "${pipeline_bin}" run -1 "${pipeline_bin}" bad_pipeline run -1 "${pipeline_bin}" newcommit run -1 "${pipeline_bin}" -H hash newcommit run -1 "${pipeline_bin}" -n name newcommit run -1 "${pipeline_bin}" newtag run -1 "${pipeline_bin}" -H hash newtag run -1 "${pipeline_bin}" -n name newtag run -1 "${pipeline_bin}" -T tag newtag run -1 "${pipeline_bin}" -H hash -n name newtag run -1 "${pipeline_bin}" -H hash -T tag newtag run -1 "${pipeline_bin}" -n name -T tag newtag run -1 "${pipeline_bin}" -c /path/to/nowhere -H hash -n name newcommit run -1 "${pipeline_bin}" -e /path/to/nowhere -H hash -n name newcommit } @test "run without runner sock" { run "${pipeline_bin}" --conf="${conf_file}" --errs="${errs_file}" \ --test --hash hash --name name newcommit echo "status: got ${status}, expected ${err_runner_sock_not_exist}" [ "${status}" -eq "${err_runner_sock_not_exist}" ] } @test "run newcommit ok" { ncat --listen --unixsock "${runner_sock}" & "${pipeline_bin}" --conf="${conf_file}" --errs="${errs_file}" \ --test --hash hash --name name newcommit echo "done" | ncat --unixsock "${runner_sock}" } @test "run newtag ok" { ncat --listen --unixsock "${runner_sock}" & "${pipeline_bin}" --conf="${conf_file}" --errs="${errs_file}" \ --test --hash hash --name name --tag tag newtag echo "done" | ncat --unixsock "${runner_sock}" }