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

Update e2e.bats to not use interactive #30

Merged
merged 7 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading