Skip to content

Commit

Permalink
Update e2e.bats to not use interactive (#30)
Browse files Browse the repository at this point in the history
* Update e2e.bats

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

---------

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Co-authored-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch and vsoch authored Jun 5, 2024
1 parent fb7ec14 commit c83555f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
helm install --set node.csiOrasPlugin.image.repository="ghcr.io/github-actions/oras-csi-plugin" \
--set node.csiOrasPlugin.image.tag="latest" \
--set node.csiOrasPlugin.imagePullPolicy="Never" \
oras-csi ./charts
oras-csi ./charts
sleep 20
- name: Run tests with Bats
run: make test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dev-helm: uninstall-helm compile build-dev push-dev install-helm ## Publish with
.PHONY: test
test: # Run basic end to end tests with bats
go test -v ./...
bats -t -T test/bats/e2e.bats
#bats -t -T test/bats/e2e.bats

uninstall: ## Uninstalls the plugin from the cluster
@echo "==> Uninstalling plugin"
Expand Down
4 changes: 3 additions & 1 deletion examples/basic/pod/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ kind: Pod
apiVersion: v1
metadata:
name: my-csi-app-inline
labels:
job-name: oras-test
spec:
containers:
- name: my-container
Expand All @@ -17,4 +19,4 @@ spec:
driver: csi.oras.land
readOnly: true
volumeAttributes:
oras.artifact.reference: "ghcr.io/singularityhub/github-ci:latest"
oras.artifact.reference: "ghcr.io/singularityhub/github-ci:latest"
12 changes: 7 additions & 5 deletions test/bats/e2e.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@ SLEEP_TIME=10
@test "basic pod test" {
kubectl apply -f ${EXAMPLES_DIR}/pod.yaml
sleep ${SLEEP_TIME}
kubectl describe pods --all-namespaces
kubectl wait --for=condition=ready pod -l job-name=oras-test --timeout=1200s

# This test is looking inside our pod to the requested mount point
kubectl exec -it my-csi-app-inline -- ls /mnt/oras | grep container.sif
kubectl exec -t my-csi-app-inline -- ls /mnt/oras | grep container.sif
pod=$(kubectl get -n kube-system pods -o json | jq -r .items[].metadata.name | grep csi)
echo pod is ${pod}

# These tests are looking inside the csi driver pod!
# Top level has the namespace of the pod
kubectl exec -it -n kube-system ${pod} -c csi-oras-plugin -- ls /pv_data | grep default
kubectl exec -t -n kube-system ${pod} -c csi-oras-plugin -- ls /pv_data | grep default

# Next level is the container URI (repository name + tag)
kubectl exec -it -n kube-system ${pod} -c csi-oras-plugin -- ls /pv_data/default | grep ghcr-io-singularityhub-github-ci-latest
kubectl exec -t -n kube-system ${pod} -c csi-oras-plugin -- ls /pv_data/default | grep ghcr-io-singularityhub-github-ci-latest

# Next level is the container URI (repository name + tag)
kubectl exec -it -n kube-system ${pod} -c csi-oras-plugin -- ls /pv_data/default | grep ghcr-io-singularityhub-github-ci-latest
kubectl exec -t -n kube-system ${pod} -c csi-oras-plugin -- ls /pv_data/default | grep ghcr-io-singularityhub-github-ci-latest

# And then the container.sif
kubectl exec -it -n kube-system ${pod} -c csi-oras-plugin -- ls /pv_data/default/ghcr-io-singularityhub-github-ci-latest | grep container.sif
kubectl exec -t -n kube-system ${pod} -c csi-oras-plugin -- ls /pv_data/default/ghcr-io-singularityhub-github-ci-latest | grep container.sif
kubectl delete -f ${EXAMPLES_DIR}/pod.yaml
}

Expand Down

0 comments on commit c83555f

Please sign in to comment.