Skip to content

Use kubectl wait to make the integration test more reliable #187

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

Merged
merged 3 commits into from
Jun 17, 2024
Merged
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
55 changes: 25 additions & 30 deletions .github/workflows/operator-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ permissions:
contents: read

jobs:
AmazonCloudWatchAgentOperatorIntegrationTest:
name: AmazonCloudWatchAgentOperatorIntegrationTest
InstrumentationTest:
name: InstrumentationTest
runs-on: ubuntu-latest
permissions:
id-token: write
Expand Down Expand Up @@ -53,12 +53,14 @@ jobs:
- name: Deploy operator to minikube
run: |
make deploy
kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the main reason why it was flaky. operator wasn't ready to serve on the webhook.


- name: Test case for AmazonCloudWatchAgent pod creation
- name: Test case for cloudwatch agent pod creation
run: |
kubectl apply -f integration-tests/manifests/cloudwatch-agent-daemonset.yaml -n amazon-cloudwatch
sleep 60
kubectl describe pods -n amazon-cloudwatch
sleep 5
kubectl wait --for=condition=Ready pod --all -n amazon-cloudwatch

pod_name="$(kubectl get pods -n amazon-cloudwatch -l app.kubernetes.io/component=amazon-cloudwatch-agent,app.kubernetes.io/instance=amazon-cloudwatch.cloudwatch-agent -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}')"
if [ -z "$pod_name" ]; then
echo "Pod $pod_name is not created. Exiting with ERROR."
Expand All @@ -72,62 +74,57 @@ jobs:
run: |
kubectl apply -f integration-tests/java/sample-deployment-java.yaml
sleep 5
kubectl get pods -A
kubectl describe pods -n default
kubectl wait --for=condition=Ready pod --all -n default

go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/java/default_instrumentation_java_env_variables.json

- name: Test for defined instrumentation resources for Java
run: |
kubectl apply -f integration-tests/manifests/sample-instrumentation.yaml
kubectl delete pods --all -n default
sleep 5
kubectl rollout restart deployment nginx
sleep 5
kubectl get pods -A
kubectl describe pods -n default
kubectl wait --for=condition=Ready pod --all -n default

cd integration-tests/manifests/cmd
go run validate_instrumentation_vars.go default ns_instrumentation_env_variables.json
kubectl delete instrumentation sample-instrumentation

- name: Test for default instrumentation resources for python
run: |
kubectl apply -f integration-tests/python/sample-deployment-python.yaml
kubectl delete pods --all -n default
sleep 5
kubectl rollout restart deployment nginx
sleep 5
kubectl get pods -A
kubectl describe pods -n default
kubectl wait --for=condition=Ready pod --all -n default

go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/python/default_instrumentation_python_env_variables.json

- name: Test for defined instrumentation resources for python
run: |
kubectl apply -f integration-tests/manifests/sample-instrumentation.yaml
kubectl delete pods --all -n default
sleep 5
kubectl rollout restart deployment nginx
sleep 5
kubectl describe pods -n default
kubectl wait --for=condition=Ready pod --all -n default

cd integration-tests/manifests/cmd
go run validate_instrumentation_vars.go default ns_instrumentation_env_variables.json
kubectl delete instrumentation sample-instrumentation

- name: Test for default instrumentation resources for python and java
run: |
kubectl apply -f integration-tests/python-java/sample-deployment-python-java.yaml
kubectl delete pods --all -n default
sleep 5
kubectl rollout restart deployment nginx
sleep 5
kubectl get pods -A
kubectl describe pods -n default
kubectl describe pods -n amazon-cloudwatch
kubectl wait --for=condition=Ready pod --all -n default

go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/python-java/default_instrumentation_python-java_env_variables.json

- name: Test for defined instrumentation resources for python and java
run: |
kubectl apply -f integration-tests/manifests/sample-instrumentation.yaml
kubectl delete pods --all -n default
sleep 5
kubectl rollout restart deployment nginx
sleep 5
kubectl get pods -A
kubectl describe pods -n default
kubectl wait --for=condition=Ready pod --all -n default

cd integration-tests/manifests/cmd
go run validate_instrumentation_vars.go default ns_instrumentation_env_variables.json
kubectl delete instrumentation sample-instrumentation
Expand Down Expand Up @@ -326,6 +323,4 @@ jobs:
sleep 5
go test -v -run TestPythonOnlyNamespace ./integration-tests/manifests/annotations -timeout 30m
sleep 5
go test -v -run TestAlreadyAutoAnnotatedResourceShouldNotRestart ./integration-tests/manifests/annotations -timeout 30m


go test -v -run TestAlreadyAutoAnnotatedResourceShouldNotRestart ./integration-tests/manifests/annotations -timeout 30m
Loading