mirror of
https://github.com/openshift/community.okd.git
synced 2026-05-06 13:12:37 +00:00
Enable unit tests in the CI (#127)
Signed-off-by: Alina Buzachis <abuzachis@redhat.com>
This commit is contained in:
11
Makefile
11
Makefile
@@ -4,6 +4,7 @@
|
||||
VERSION = 2.1.0
|
||||
|
||||
SANITY_TEST_ARGS ?= --docker --color
|
||||
UNITS_TEST_ARGS ?= --docker --color
|
||||
PYTHON_VERSION ?= `python3 -c 'import platform; print("{0}.{1}".format(platform.python_version_tuple()[0], platform.python_version_tuple()[1]))'`
|
||||
|
||||
clean:
|
||||
@@ -20,6 +21,9 @@ install: build
|
||||
sanity: install
|
||||
cd ansible_collections/community/okd && ansible-test sanity -v --python $(PYTHON_VERSION) $(SANITY_TEST_ARGS)
|
||||
|
||||
units: install
|
||||
cd ansible_collections/community/okd && ansible-test units -v --python $(PYTHON_VERSION) $(UNITS_TEST_ARGS)
|
||||
|
||||
molecule: install
|
||||
molecule test
|
||||
|
||||
@@ -27,16 +31,23 @@ test-integration: upstream-test-integration downstream-test-integration
|
||||
|
||||
test-sanity: upstream-test-sanity downstream-test-sanity
|
||||
|
||||
test-units: upstream-test-units downstream-test-units
|
||||
|
||||
test-integration-incluster:
|
||||
./ci/incluster_integration.sh
|
||||
|
||||
upstream-test-sanity: sanity
|
||||
|
||||
upstream-test-units: units
|
||||
|
||||
upstream-test-integration: molecule
|
||||
|
||||
downstream-test-sanity:
|
||||
./ci/downstream.sh -s
|
||||
|
||||
downstream-test-units:
|
||||
./ci/downstream.sh -u
|
||||
|
||||
downstream-test-integration:
|
||||
./ci/downstream.sh -i
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ f_show_help()
|
||||
{
|
||||
printf "Usage: downstream.sh [OPTION]\n"
|
||||
printf "\t-s\t\tCreate a temporary downstream release and perform sanity tests.\n"
|
||||
printf "\t-u\t\tCreate a temporary downstream release and perform units tests.\n"
|
||||
printf "\t-i\t\tCreate a temporary downstream release and perform integration tests.\n"
|
||||
printf "\t-m\t\tCreate a temporary downstream release and perform molecule tests.\n"
|
||||
printf "\t-b\t\tCreate a downstream release and stage for release.\n"
|
||||
@@ -226,6 +227,24 @@ f_test_integration_option()
|
||||
f_cleanup
|
||||
}
|
||||
|
||||
# Run the test units
|
||||
f_test_units_option()
|
||||
{
|
||||
f_log_info "${FUNCNAME[0]}"
|
||||
f_common_steps
|
||||
pushd "${_build_dir}" || return
|
||||
if command -v docker &> /dev/null
|
||||
then
|
||||
make units
|
||||
else
|
||||
UNITS_TEST_ARGS="--venv --color" make units
|
||||
fi
|
||||
f_log_info "UNITS TEST PWD: ${PWD}"
|
||||
make units
|
||||
popd || return
|
||||
f_cleanup
|
||||
}
|
||||
|
||||
# Run the build scanerio
|
||||
f_build_option()
|
||||
{
|
||||
@@ -246,7 +265,7 @@ if [[ "${#}" -eq "0" ]]; then
|
||||
fi
|
||||
|
||||
# Handle options
|
||||
while getopts ":sirb" option
|
||||
while getopts ":siurb" option
|
||||
do
|
||||
case $option in
|
||||
s)
|
||||
@@ -255,6 +274,9 @@ do
|
||||
i)
|
||||
f_test_integration_option
|
||||
;;
|
||||
u)
|
||||
f_test_units_option
|
||||
;;
|
||||
r)
|
||||
f_release_option
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user