Skip to content

Commit

Permalink
Support environment variables as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolovison committed Sep 19, 2024
1 parent a9974ff commit bee9410
Showing 1 changed file with 42 additions and 12 deletions.
54 changes: 42 additions & 12 deletions .github/scripts/tests/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ DSPA_EXTERNAL_NAMESPACE="dspa-ext"
MINIO_NAMESPACE="test-minio"
MARIADB_NAMESPACE="test-mariadb"
PYPISERVER_NAMESPACE="test-pypiserver"
DSPA_NAME="test-dspa"
DSPA_EXTERNAL_NAME="dspa-ext"
DSPA_DEPLOY_WAIT_TIMEOUT="300"
INTEGRATION_TESTS_DIR="${GIT_WORKSPACE}/tests"
DSPA_PATH="${GIT_WORKSPACE}/tests/resources/dspa-lite.yaml"
Expand Down Expand Up @@ -189,7 +187,8 @@ remove_namespace_created_for_rhoai() {
kubectl delete projects $PYPISERVER_NAMESPACE --now || true
}

run_kind_tests() {
setup_kind_requirements() {
undeploy_kind_resources
apply_crd
build_image
create_opendatahub_namespace
Expand All @@ -205,12 +204,9 @@ run_kind_tests() {
create_namespace_dspa_external_connections
apply_mariadb_minio_secrets_configmaps_external_namespace
apply_pip_server_configmap
run_tests
run_tests_dspa_external_connections
undeploy_kind_resources
}

run_rhoai_tests() {
setup_rhoai_requirements() {
remove_namespace_created_for_rhoai
deploy_minio
deploy_mariadb
Expand All @@ -221,20 +217,54 @@ run_rhoai_tests() {
create_namespace_dspa_external_connections
apply_mariadb_minio_secrets_configmaps_external_namespace
apply_pip_server_configmap
run_tests
run_tests_dspa_external_connections
}

# Run
case "$1" in
--kind)
run_kind_tests
TARGET="kind"
shift
;;
--rhoai)
run_rhoai_tests
TARGET="rhoai"
shift
;;
--k8s-api-server-host)
shift
K8SAPISERVERHOST=$1
shift
;;
--dspa-namespace)
shift
DSPANAMESPACE=$1
shift
;;
--dspa-external-namespace)
shift
DSPA_EXTERNAL_NAMESPACE=$1
shift
;;
--dspa-path)
shift
DSPAPATH=$1
shift
;;
*)
echo "Usage: $0 [--kind]"
echo "Unknown command line switch: $1"
exit 1
;;
esac

if [ "$K8SAPISERVERHOST" = "" ]; then
echo "If K8SAPISERVERHOST is empty. It will use suite_test.go::Defaultk8sApiServerHost"
echo "If the TARGET is OpenShift or RHOAI. You can use: oc whoami --show-server"
fi

if [[ "$TARGET" == "kind" ]]; then
setup_kind_requirements
elif [[ "$TARGET" == "rhoai" ]]; then
setup_rhoai_requirements
fi

run_tests
run_tests_dspa_external_connections

0 comments on commit bee9410

Please sign in to comment.