Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPansino committed May 10, 2024
1 parent 33d15cd commit 1092b3d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,26 @@ jobs:
minikube image load e2e/python-test-app:e2e
# Add the custom resource file (points to the agent init container) and test application container to the cluster.
- name: Deploy test app to minikube
run: |
kubectl create namespace python-test
kubectl apply -f tests/python/customresource.yaml -n python-test
kubectl apply -f tests/python/python_test_app_deployment.yaml -n python-test
sleep 1
kubectl wait --for=condition=Ready --namespace python-test --all pods
# - name: Deploy test app to minikube
# run: |
# kubectl create namespace python-test
# kubectl apply -f tests/python/customresource.yaml -n python-test
# kubectl apply -f tests/python/python_test_app_deployment.yaml -n python-test
# sleep 1
# kubectl wait --for=condition=Ready --namespace python-test --all pods

# Wait 30 seconds for the cluster to start and then hit the test application endpoint.
- name: Test
run: |
curl --fail-with-body $(minikube service python-test-app-service --url -n python-test)
# # Wait 30 seconds for the cluster to start and then hit the test application endpoint.
# - name: Test
# run: |
# curl --fail-with-body $(minikube service python-test-app-service --url -n python-test)

- name: Run e2e-test
uses: newrelic/newrelic-integration-e2e-action@a97ced80a4841c8c6261d1f9dca6706b1d89acb1 # 1.11.0
with:
retry_seconds: 60
retry_attempts: 5
agent_enabled: false
spec_path: e2e/test-specs.yml
spec_path: tests/test-specs.yml
account_id: ${{ secrets.K8S_AGENTS_E2E_ACCOUNT_ID }}
api_key: ${{ secrets.K8S_AGENTS_E2E_API_KEY }}
license_key: ${{ secrets.K8S_AGENTS_E2E_LICENSE_KEY }}
3 changes: 3 additions & 0 deletions tests/python/python_test_app_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ spec:
imagePullPolicy: Never
ports:
- containerPort: 8000
env:
- name: NEW_RELIC_APP_NAME
value: "k8s-e2e-test-app-${SCENARIO_TAG:-0}"
---
apiVersion: v1
kind: Service
Expand Down
23 changes: 23 additions & 0 deletions tests/python/test-specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
description: |
End-to-end tests for python initcontainer
scenarios:
- description: |
This scenario will verify that transactions are reported by the
before:
- kubectl create namespace nr-${SCENARIO_TAG}
- kubectl apply -f tests/python/customresource.yaml -n nr-${SCENARIO_TAG}
- kubectl apply -f tests/python/python_test_app_deployment.yaml -n nr-${SCENARIO_TAG}
- sleep 10
- kubectl wait --for=condition=Ready --namespace nr-${SCENARIO_TAG} --all pods
- curl --fail-with-body $(minikube service python-test-app-service --url -n nr-${SCENARIO_TAG})
after:
- kubectl delete -f tests/python/customresource.yaml -n nr-${SCENARIO_TAG}
- kubectl delete -f tests/python/python_test_app_deployment.yaml -n nr-${SCENARIO_TAG}
tests:
nrqls:
- query: FROM Metric SELECT latest(something) AS 'start_time' WHERE metricName = 'k8s.persistentvolume.createdAt' AND appName = 'k8s-e2e-test-app-${SCENARIO_TAG:-0}'
expected_results:
- key: "start_time"
lowerBoundedValue: 0.0
entities: []

0 comments on commit 1092b3d

Please sign in to comment.