Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): added makefiles for testing workflow tests locally #11509

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
138 changes: 138 additions & 0 deletions Makefile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename them to have test- in the beginning of their names so it will be easier for contributors to find them.
For example, backend-test-flip-coin -> test-backend-flip-coin.

Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
include ./Makefile.setup.mk

.PHONY: go-unittest
go-unittest:
go test -v -cover ./backend/...

.PHONY: backend-test
backend-test:
. .venv/bin/activate
TEST_SCRIPT="test-flip-coin.sh" ./.github/resources/scripts/e2e-test.sh
TEST_SCRIPT="test-static-loop.sh" ./.github/resources/scripts/e2e-test.sh
TEST_SCRIPT="test-dynamic-loop.sh" ./.github/resources/scripts/e2e-test.sh
TEST_SCRIPT="test-env.sh" ./.github/resources/scripts/e2e-test.sh
TEST_SCRIPT="test-volume.sh" ./.github/resources/scripts/e2e-test.sh

.PHONY: backend-visualization-test
backend-visualization-test:
./test/presubmit-backend-visualization.sh

.PHONY: e2e-initialization-tests-v1
e2e-initialization-tests-v1:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
cd ./backend/test/initialization
go test -v ./... -namespace kubeflow -args -runIntegrationTests=true

.PHONY: e2e-initialization-tests-v2
e2e-initialization-tests-v2:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
cd ./backend/test/v2/initialization
go test -v ./... -namespace kubeflow -args -runIntegrationTests=true

.PHONY: e2e-api-integration-tests-v1
e2e-api-integration-tests-v1:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
./backend/test/integration
go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true

.PHONY: e2e-api-integration-tests-v2
e2e-api-integration-tests-v2:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
cd ./backend/test/v2/integration
go test -v ./... -namespace ${NAMESPACE} -args -runIntegrationTests=true

.PHONY: e2e-frontend-integration-test
e2e-frontend-integration-test:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline-ui" 3000 3000
cd ./test/frontend-integration-test
docker build . -t kfp-frontend-integration-test:local
docker run --net=host kfp-frontend-integration-test:local --remote-run true

.PHONY: e2e-basic-sample-tests
e2e-basic-sample-tests:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
pip3 install -r ./test/sample-test/requirements.txt
python3 ./test/sample-test/sample_test_launcher.py sample_test run_test --namespace kubeflow --test-name sequential --results-gcs-dir output
python3 ./test/sample-test/sample_test_launcher.py sample_test run_test --namespace kubeflow --test-name exit_handler --expected-result failed --results-gcs-dir output

.PHONY: frontend-test
frontend-test:
npm cache clean --force
cd ./frontend && npm ci
cd ./frontend && npm run test:ci

.PHONY: grpc-modules-test
grpc-modules-test:
pytest ./test/gcpc-tests/run_all_gcpc_modules.py

PHONY: kfp-kubernetes-execution-tests
kfp-kubernetes-execution-tests:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
export KFP_ENDPOINT="http://localhost:8888"
export TIMEOUT_SECONDS=2700
pytest ./test/kfp-kubernetes-execution-tests/sdk_execution_tests.py --asyncio-task-timeout $TIMEOUT_SECONDS

.PHONY: kfp-kubernetes-library-test
kfp-kubernetes-library-test:
./test/presubmit-test-kfp-kubernetes-library.sh

.PHONY: kfp-samples
kfp-samples:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
./backend/src/v2/test/sample-test.sh

.PHONY: kfp-sdk-runtime-tests
kfp-sdk-runtime-tests:
export PULL_NUMBER="${{ github.event.inputs.pull_number || github.event.pull_request.number }}"
./test/presubmit-test-kfp-runtime-code.sh

.PHONY: kfp-sdk-tests
kfp-sdk-tests:
./test/presubmit-tests-sdk.sh

.PHONY: kubeflow-pipelines-manifests
kubeflow-pipelines-manifests:
./manifests/kustomize/hack/presubmit.sh


.PHONY: periodic-test
periodic-test:
nohup kubectl port-forward --namespace kubeflow svc/ml-pipeline 8888:8888 &
log_dir=$(mktemp -d)
./test/kfp-functional-test/kfp-functional-test.sh > $log_dir/periodic_tests.txt

.PHONY: presubmit-backend
presubmit-backend:
./test/presubmit-backend-test.sh

.PHONY: sdk-component-yaml
sdk-component-yaml:
./test/presubmit-component-yaml.sh

.PHONY: sdk-docformatter
sdk-docformatter:
./test/presubmit-docformatter-sdk.sh

.PHONY: sdk-execution
sdk-execution:
./.github/resources/scripts/forward-port.sh "kubeflow" "ml-pipeline" 8888 8888
export KFP_ENDPOINT="http://localhost:8888"
export TIMEOUT_SECONDS=2700
pytest ./test/sdk-execution-tests/sdk_execution_tests.py --asyncio-task-timeout $TIMEOUT_SECONDS

.PHONY: sdk-isort
sdk-isort:
./test/presubmit-isort-sdk.sh

.PHONY: sdk-upgrade
sdk-upgrade:
./test/presubmit-test-sdk-upgrade.sh

.PHONY: sdk-yapf
sdk-yapf:
./test/presubmit-yapf-sdk.sh




116 changes: 116 additions & 0 deletions Makefile.setup.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
.PHONY: create-kind-cluster
create-kind-cluster:
kind create cluster --name kfp --image kindest/node:v1.29.2 --wait 5m
kubectl version --client --short

.PHONY: build-images
build-images:
./.github/resources/scripts/build-images.sh

.PHONY: deploy-kfp-tekton
deploy-kfp-tekton:
./.github/resources/scripts/deploy-kfp-tekton.sh

.PHONY: setup-kfp-tekton
setup-kfp-tekton: create-kind-cluster build-images deploy-kfp-tekton

.PHONY: deploy-kfp
deploy-kfp:
./.github/resources/scripts/deploy-kfp.sh

.PHONY: setup-kfp
setup-kfp: create-kind-cluster build-images deploy-kfp

.PHONY: setup-python
setup-python:
python3 -m venv .venv
. .venv/bin/activate

.PHONY: setup-backend-test
setup-backend-test: setup-python
pip install -e sdk/python

.PHONY: setup-backend-visualization-test
setup-backend-visualization-test: setup-python

.PHONY: setup-frontend-test
setup-frontend-test:
nvm install 14
nvm use 14

.PHONY: setup-grpc-modules-test
setup-grpc-modules-test: setup-python
sudo apt-get update
sudo apt-get install protobuf-compiler -y
pip3 install setuptools
pip3 freeze
pip3 install wheel==0.42.0
pip install sdk/python
cd ./api
make clean python
python3 -m pip install api/v2alpha1/python
pip install components/google-cloud
pip install $(grep 'pytest==' sdk/python/requirements-dev.txt)
pytest ./test/gcpc-tests/run_all_gcpc_modules.py

.PHONY: setup-kfp-kubernetes-execution-tests
setup-kfp-kubernetes-execution-tests: setup-kfp
sudo apt-get update
sudo apt-get install protobuf-compiler -y
pip3 install setuptools
pip3 freeze
pip3 install wheel==0.42.0
pip3 install protobuf==4.25.3
cd ./api
make clean python
cd ./..
python3 -m pip install api/v2alpha1/python
cd ./kubernetes_platform
make clean python
pip install -e ./kubernetes_platform/python[dev]
pip install -r ./test/kfp-kubernetes-execution-tests/requirements.txt

.PHONY: setup-kfp-samples
setup-kfp-samples: setup-python setup-kfp

.PHONY: setup-periodic-test
setup-periodic-test: setup-kfp

.PHONY: setup-sdk-component-yaml
setup-sdk-component-yaml: setup-python
sudo apt-get update
sudo apt-get install protobuf-compiler -y
pip3 install setuptools
pip3 freeze
pip3 install wheel==0.42.0
pip3 install protobuf==4.25.3
cd ./api
make clean python
python3 -m pip install api/v2alpha1/python
pip install -r ./test/sdk-execution-tests/requirements.txt

.PHONY: setup-sdk-docformatter
setup-sdk-docformatter: setup-python

.PHONY: setup-sdk-execution
setup-sdk-execution: setup-python setup-kfp
sudo apt-get update
sudo apt-get install protobuf-compiler -y
pip3 install setuptools
pip3 freeze
pip3 install wheel==0.42.0
pip3 install protobuf==4.25.3
cd ./api
make clean python
python3 -m pip install api/v2alpha1/python
pip install -r ./test/sdk-execution-tests/requirements.txt

.PHONY: setup-sdk-isort
setup-sdk-isort: setup-python

.PHONY: setup-sdk-upgrade
setup-sdk-upgrade: setup-python

.PHONY: setup-sdk-yapf
setup-sdk-yapf: setup-pyton
pip install yapf
Loading