Fix unit tests for /apis, /internal, /pkg #114
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
# SPDX-License-Identifier: Apache-2.0 | |
name: operator Integration Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [ opened, reopened, synchronize, ready_for_review ] | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
AmazonCloudWatchAgentOperatorIntegrationTest: | |
name: AmazonCloudWatchAgentOperatorIntegrationTest | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Start minikube | |
uses: medyagh/setup-minikube@master | |
- name: Deploy cert-manager to minikube | |
run: | |
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.0/cert-manager.yaml | |
# - name: Verify minikube and cert-manager | |
# run: | | |
# sleep 10 | |
# kubectl get pods -A | |
- name: Build image | |
run: | | |
eval $(minikube docker-env) | |
make container | |
docker images | |
- name: Deploy operator to minikube | |
run: | | |
make deploy | |
- name: Test case for AmazonCloudWatchAgent pod creation | |
run: | | |
helm template --namespace amazon-cloudwatch -s templates/cloudwatch-agent-daemonset.yaml ./helm | kubectl apply --namespace amazon-cloudwatch -f - | |
sleep 60 | |
kubectl describe pods -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." | |
echo "Pod is not created test case: FAIL" | |
else | |
echo "Pod $pod_name is created." | |
echo "Pod is created test case: PASS" | |
fi | |
- name: Test for default instrumentation resources | |
run: | | |
cd integration-tests/manifests | |
kubectl apply -f ./sample-deployment.yaml | |
sleep 60 | |
kubectl get pods -A | |
kubectl describe pods -n default | |
cd ./cmd | |
go run validate_instrumentation_vars.go default default_instrumentation_env_variables.json | |
- name: Test for defined instrumentation resources | |
run: | | |
cd integration-tests/manifests | |
kubectl apply -f ./sample-instrumentation.yaml | |
sleep 60 | |
kubectl rollout restart deployment nginx | |
sleep 60 | |
kubectl get pods -A | |
kubectl describe pods -n default | |
cd ./cmd | |
go run validate_instrumentation_vars.go default ns_instrumentation_env_variables.json |