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

Add DSS integration tests for CPU and NVIDIA GPU (New) #1633

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/checkbox-dss-validation/bin/install-deps
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ main() {
# intel_gpu_top command used for host-level GPU check
# jq used for cases where jsonpath is insufficient for parsing json results
echo -e "\nStep 3/4: Installing intel-gpu-tools"
DEBIAN_FRONTEND=noninteractive sudo apt install -y intel-gpu-tools jq
DEBIAN_FRONTEND=noninteractive sudo apt install -y python3-venv intel-gpu-tools jq

echo -e "\nStep 4/4: Installing data-science-stack snap from channel $dss_snap_channel"
sudo snap install data-science-stack --channel "$dss_snap_channel"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ check_dss_can_remove_notebook() {
fi
}

check_dss_can_be_purged() {
dss purge
echo "Test success: dss purged."
}

help_function() {
echo "This script is used for generic tests related to DSS"
echo "Usage: check_dss.sh <test_case> [args]..."
Expand All @@ -78,6 +83,7 @@ main() {
nvidia_gpu_acceleration_is_enabled) check_dss_status_contains "NVIDIA GPU acceleration: Enabled.*" ;;
can_create_notebook) check_dss_can_create_notebook "${@:2}" ;;
can_remove_notebook) check_dss_can_remove_notebook "${@:2}" ;;
can_be_purged) check_dss_can_be_purged ;;
*) help_function ;;
esac
popd
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash

set -euxo pipefail

DSS_REPO_CLONE_PATH="$HOME/data-science-stack"
DSS_REPO_REV="main"

_ensure_microk8s_config_is_in_place() {
sudo microk8s.kubectl config view --raw | sudo tee "${SNAP_REAL_HOME}/.kube/config" >/dev/null
}

_ensure_dss_repo_is_checked_out() {
if [ ! -d "$DSS_REPO_CLONE_PATH" ]; then
git clone https://github.com/canonical/data-science-stack.git "$DSS_REPO_CLONE_PATH"
fi
git -C "$DSS_REPO_CLONE_PATH" checkout "$DSS_REPO_REV"
echo "Current git branch for DSS repo: $(git branch --show-current)"
echo "Latest commit:"
git -C "$DSS_REPO_CLONE_PATH" log --name-status HEAD^..HEAD
}
_ensure_dss_python_env_is_setup() {
pushd "$DSS_REPO_CLONE_PATH"
if [ ! -d ".venv" ]; then
python3 -m venv .venv
fi
.venv/bin/pip install tox
popd
}

check_dss_integration_tests_pass() {
pushd "$DSS_REPO_CLONE_PATH"
echo "starting DSS integration tests: $1"
.venv/bin/tox -e "$1" -- -vv -s
echo "Tests passed: DSS integration tests '$1'"
popd
}

help_function() {
echo "This script is used for running integration tests from DSS"
echo "Usage: check_dss_integration_tests <test_case>"
echo
echo "Test cases currently implemented:"
echo -e "\t<pass_on_cpu>"
echo -e "\t<pass_on_nvidia_gpu>"
}

main() {
_ensure_microk8s_config_is_in_place
_ensure_dss_repo_is_checked_out
_ensure_dss_python_env_is_setup

case ${1} in
pass_on_cpu) check_dss_integration_tests_pass "integration" ;;
pass_on_nvidia_gpu) check_dss_integration_tests_pass "integration-gpu" ;;
*) help_function ;;
esac
}

main "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,50 @@ depends: dss/create_tensorflow_cuda_notebook
_summary: Check that the Tensorflow CUDA notebook can be removed
estimated_duration: 1m
command: check_dss.sh can_remove_notebook tensorflow-cuda

# DSS integration test jobs ###################################################

id: dss/purge
category_id: dss-regress
flags: simple
imports: from com.canonical.certification import executable
requires: executable.name == 'dss'
depends: dss/initialize
_summary: Check that DSS can be purged
estimated_duration: 1m
command: check_dss.sh can_be_purged

# NOTE: DSS Integration tests expect DSS to not be initialized
# hence they also depend on the dss/purge job

id: dss_integration_tests/cpu
category_id: dss-regress
flags: simple
imports:
from com.canonical.certification import executable
from com.canonical.certification import package
requires:
executable.name == 'dss'
executable.name == 'python3'
package.name == 'python3-venv'
depends: dss/purge
_summary: Check that all DSS integration tests for CPU pass
estimated_duration: 1m
command: check_dss_integration_tests.sh can_be_purged pass_on_cpu
motjuste marked this conversation as resolved.
Show resolved Hide resolved

id: dss_integration_tests/nvidia_gpu
category_id: dss-regress
flags: simple
imports:
from com.canonical.certification import executable
from com.canonical.certification import package
requires:
executable.name == 'dss'
executable.name == 'python3'
package.name == 'python3-venv'
depends:
dss/purge
nvidia_gpu_addon/validations_succeed
_summary: Check that all DSS integration tests for NVIDIA GPUs
estimated_duration: 1m
command: check_dss_integration_tests.sh can_be_purged pass_on_nvidia_gpu
motjuste marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ include:
dss/create_tensorflow_cuda_notebook
cuda/tensorflow_can_use_cuda
dss/remove_tensorflow_cuda_notebook
dss/purge
dss_integration_tests/cpu
dss_integration_tests/nvidia_gpu
motjuste marked this conversation as resolved.
Show resolved Hide resolved
bootstrap_include:
com.canonical.certification::executable
com.canonical.certification::snap
com.canonical.certification::graphics_card
com.canonical.certification::package
Loading