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(dp): Make target with tests development POD #12876

Merged
merged 1 commit into from
Jun 1, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
!orc8r/tools/ansible/roles/fluent_bit/files
!orc8r/tools/docker/

!dp/cloud/docker/python/test_runner/entrypoint.sh
Neudrino marked this conversation as resolved.
Show resolved Hide resolved
!dp/cloud/go/
!dp/cloud/python/
!dp/protos/
Expand Down
6 changes: 6 additions & 0 deletions dp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ orc8r_integration_tests: init_orc8r _ci_init cleanup_test_db
kubectl delete pods test-runner-orc8r --ignore-not-found=true
skaffold dev -p orc8r-deployment,integration-tests-no-orc8,integration-tests-orc8r-only --trigger=manual

.PHONY: dev_integration_tests
dev_integration_tests: init_orc8r _ci_init cleanup_test_db
kubectl delete jobs -l jobName=domain-proxy-db-setup --ignore-not-found=true
kubectl delete pods test-runner-dev --ignore-not-found=true
skaffold dev -p orc8r-deployment,integration-tests-no-orc8,integration-tests-dev --trigger=manual

.PHONY: orc8r
orc8r: init_orc8r dev_orc8r

Expand Down
3 changes: 2 additions & 1 deletion dp/cloud/docker/python/test_runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ COPY dp/cloud/python/magma/db_service /dp/cloud/python/magma/db_service/
COPY dp/cloud/python/magma/mappings /dp/cloud/python/magma/mappings/
COPY dp/cloud/python/magma/test_runner /dp/cloud/python/magma/test_runner/
COPY dp/cloud/python/magma/fixtures /dp/cloud/python/magma/fixtures/
COPY --chmod=755 dp/cloud/docker/python/test_runner/entrypoint.sh /entrypoint.sh
COPY --from=protos-generator /magma/build/gen /magma/build/gen

WORKDIR /dp/cloud/python/magma/test_runner
ENV PYTHONPATH=/magma/build/gen:/dp/cloud/python
ENTRYPOINT ["python"]
ENTRYPOINT ["/entrypoint.sh"]
8 changes: 8 additions & 0 deletions dp/cloud/docker/python/test_runner/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

if [ "$TESTS_DEV" = true ] ; then
sleep infinity
else
python "$@"
fi
5 changes: 3 additions & 2 deletions dp/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ profiles:
value:
manifests:
- "./tools/deployment/tests/test_runner_deployment_orc8r.yml"
- name: integration-tests-all
- name: integration-tests-dev
patches:
- op: add
path: /deploy/kubectl
value:
manifests: "./tools/deployment/tests/test_runner_*.yml"
manifests:
- "./tools/deployment/tests/test_runner_deployment_dev.yml"

- name: remote
deploy:
Expand Down
13 changes: 10 additions & 3 deletions dp/tools/deployment/tests/test_runner_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ spec:
initContainers:
- name: wait-for-elasticsearch
image: curlimages/curl
command: ['sh', '-c', "until curl -sf http://elasticsearch:9200/_cluster/health; do echo \"waiting for elasticsearch...\"; sleep 0.2; done"]
command:
- sh
- -c
- |
until curl -sf http://elasticsearch:9200/_cluster/health; do
echo "Waiting for elasticsearch...";
sleep 0.2;
done
containers:
- image: test_runner_image
name: test-runner
name: test-runner-dev
imagePullPolicy: IfNotPresent
command: ["python"]
command: ["/entrypoint.sh"]
args: ["-m", "pytest", "-vvv", "-s", "-m", "local", "--junit-xml=/backend/test_runner/test-results/test_report.xml", "tests"]
volumeMounts:
- name: test-results
Expand Down
45 changes: 45 additions & 0 deletions dp/tools/deployment/tests/test_runner_deployment_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
apiVersion: v1
kind: Pod
metadata:
name: test-runner-dev
labels:
name: test-runner
type: integration-tests
spec:
restartPolicy: Never
initContainers:
- name: wait-for-elasticsearch
image: curlimages/curl
command:
- sh
- -c
- |
until curl -sf http://elasticsearch:9200/_cluster/health; do
echo "Waiting for elasticsearch...";
sleep 0.2;
done
containers:
- image: test_runner_image
name: test-runner
imagePullPolicy: IfNotPresent
command: ["/entrypoint.sh"]
volumeMounts:
- name: test-results
mountPath: /backend/test_runner/test-results
- name: certificates
mountPath: /backend/test_runner/certs
readOnly: true
env:
- name: TESTS_DEV
value: "true"
volumes:
- name: test-results
hostPath:
path: /tmp/integration-tests-results
type: DirectoryOrCreate
- name: certificates
projected:
sources:
- secret:
name: orc8r-secrets-certs
11 changes: 9 additions & 2 deletions dp/tools/deployment/tests/test_runner_deployment_orc8r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ spec:
initContainers:
- name: wait-for-elasticsearch
image: curlimages/curl
command: ['sh', '-c', "until curl -sf http://elasticsearch:9200/_cluster/health; do echo \"waiting for elasticsearch...\"; sleep 0.2; done"]
command:
- sh
- -c
- |
until curl -sf http://elasticsearch:9200/_cluster/health; do
echo "Waiting for elasticsearch...";
sleep 0.2;
done
containers:
- image: test_runner_image
name: test-runner-orc8
imagePullPolicy: IfNotPresent
command: ["python"]
command: ["/entrypoint.sh"]
args: ["-m", "pytest", "-vvv", "-s", "-m", "orc8r", "--junit-xml=/backend/test_runner/test-results/test_report.xml", "tests"]
sklgromek marked this conversation as resolved.
Show resolved Hide resolved
volumeMounts:
- name: test-results
Expand Down