Skip to content

Commit

Permalink
Add workflow to test jupyter notebooks (#2)
Browse files Browse the repository at this point in the history
* fix local test

* Update version for jupyter docker image

* Update workflow to use notebook test

* Squash workflow steps into one

* Use env for excluding notebooks to test

* Add live logging to notebooks test

* Update docker image for jupyter

* Change docker image for jupyter
  • Loading branch information
kozubaeff authored May 5, 2024
1 parent d2e7151 commit d88debe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
YC_DEMO_REGISTRY_ID: ${{ vars.YC_DEMO_REGISTRY_ID }}
HELM_CHART_VERSION: ${{ vars.HELM_CHART_VERSION }}
CONTOUR: testing
EXCLUDE_NOTEBOOKS: ${{ vars.EXCLUDE_NOTEBOOKS }}
jobs:
start-vm:
name: Start VM
Expand Down Expand Up @@ -57,7 +58,7 @@ jobs:
sudo apt-get -y install libpq-dev jq
python -m pip install --upgrade pip
pip install -r requirements.txt -r dev.requirements.txt
- name: Prepare enviroment
- name: Run tests
shell: bash
run: |
export HOME=/root
Expand All @@ -83,17 +84,21 @@ jobs:
echo "IAM_TOKEN=$(yc iam create-token)" > /tmp/os-demo-env.txt
echo "NAMESPACE_NAME=${namespace}" >> /tmp/os-demo-env.txt
echo "NAMESPACE_NAME=${namespace}" >> $GITHUB_ENV
kubectl config view --raw -o json | jq -r '.clusters[0].cluster."certificate-authority-data"' | tr -d '"' | base64 --decode > /tmp/os-demo-certificate_authority
sleep 120
kubectl get services -n ${namespace}
kubectl get pods -n ${namespace}
- name: Run tests
run: |
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
pytest -rA --log-cli-level=INFO --log-level=INFO tests/*
kubectl -n ${namespace} set env sts/jupyterlab EXCLUDE_NOTEBOOKS="${EXCLUDE_NOTEBOOKS}"
sleep 15
JUPYTER_POD_NAME=$(kubectl -n ${namespace} get pods --selector=name=jupyterlab -o=name)
kubectl -n ${namespace} exec -it $JUPYTER_POD_NAME -- pytest -rA --log-cli-level=INFO --log-level=INFO /home/jovyan/test.py
clean-up:
name: Clean up
needs:
Expand Down
2 changes: 1 addition & 1 deletion k8s_deployer/image_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __str__(self):
),
"jupyter": ImageEntry(
img="ytsaurus/jupyter-tutorial",
tag="0.0.31-datalens-intro",
tag="0.0.32-custom",
),
"demo_data": ImageEntry(
img="ytsaurus/demo_data",
Expand Down
14 changes: 9 additions & 5 deletions local-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ export HELM_EXPERIMENTAL_OCI=1
export YC_DEMO_REGISTRY_ID=crptkkbc0947ickrtnp7
export HELM_CHART_VERSION=0.0.278-dev-f80709464c1f4031df1346b7f81a2179dec7a547-ui-fix


echo $(yc iam create-token) | helm registry login cr.yandex -u iam --password-stdin
yc container registry configure-docker
helm install -n testing ytsaurus oci://cr.yandex/$YC_DEMO_REGISTRY_ID/ytsaurus/helm/ytop-chart --version $HELM_CHART_VERSION
if [ -z "${YC_TOKEN}" ]; then
YC_TOKEN=$(yc iam create-token)
fi
echo $YC_TOKEN | helm registry login cr.yandex -u iam --password-stdin
echo $YC_TOKEN | docker login --username iam --password-stdin cr.yandex

kubectl create -n testing secret generic regcred --from-file=.dockerconfigjson=$HOME/.docker/config.json --type=kubernetes.io/dockerconfigjson
kubectl patch -n testing serviceaccount default -p '{"imagePullSecrets": [{"name": "regcred"}]}'

helm install -n testing ytsaurus oci://registry-1.docker.io/ytsaurus/ytop-chart --version 0.8.0
#helm install -n testing ytsaurus oci://cr.yandex/$YC_DEMO_REGISTRY_ID/ytsaurus/helm/ytop-chart --version $HELM_CHART_VERSION --set serviceAccountName=default

echo '
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down Expand Up @@ -53,4 +57,4 @@ sleep 100
kubectl get pods -n testing
kubectl get services --all-namespaces

pytest -rA tests/*
pytest -rA --log-cli-level=INFO --log-level=INFO tests/*

0 comments on commit d88debe

Please sign in to comment.