-
Notifications
You must be signed in to change notification settings - Fork 31
AppSignals AutoMonitor integration testing #306
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
base: main
Are you sure you want to change the base?
Changes from all commits
7c8774d
95b11c2
2a6d9df
b50163c
3ce94cf
97ee02b
24c29cd
b2d6c1c
c70f7f8
e47e85a
6ab7980
82750e1
a886b9a
9d6b4a7
1216808
b5a0e96
e1cf759
33df3e8
734966f
ed696e5
319e18a
42f6e23
d35ed59
fbafe30
d65c9f0
eecdc14
185ff81
c28093a
707856b
a702b6a
d9c3a00
20b463c
47e3b80
d533077
936f0c2
4a86baf
cabba78
955e643
a2007b0
d55e3cf
aae6fd5
e603175
3bfe07c
0ffe221
3b7cb97
68101a0
efbe7c3
88ade73
464bf37
8007439
5552674
9c8bc8d
b68d141
0ce0a2b
37719c8
b670fbf
c445128
e1c756b
88cb816
499b9b4
d83fde7
5be0f19
0da82c3
d7d6233
09a114b
9789ee6
c0ae5d9
6966cea
7bd2878
799778e
56b5e1d
9039274
212b606
a660894
220167b
06089a2
2c7e2ad
763996e
4a23268
1dd0a81
d3947ea
4d599a8
ec04efe
ed4b2fb
b4801ae
988c1eb
4e39db8
1d0ef86
52c6aa7
e288425
d8b8e46
6a94cde
a940c37
5f0693b
8571943
bc2a0b3
8b5fbfc
5d3ae8f
52afaf2
ca244fc
655ac06
2bfcbf2
e50c0eb
5db0bbd
3dfbd6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| *_test.go | ||
| integration-tests | ||
| bin | ||
| .github | ||
| amazon-cloudwatch-agent-operator |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ permissions: | |
| jobs: | ||
| InstrumentationTest: | ||
| name: InstrumentationTest | ||
| needs: [BuildAndCacheImage] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
|
|
@@ -31,7 +32,7 @@ jobs: | |
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-go@v5 | ||
| - name: Start minikube | ||
| uses: medyagh/setup-minikube@master | ||
|
|
||
|
|
@@ -44,11 +45,17 @@ jobs: | |
| sleep 10 | ||
| kubectl get pods -A | ||
|
|
||
| - name: Build image | ||
| - name: Restore cached Docker image | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: image.tar | ||
| key: docker-image-${{ github.sha }} | ||
|
|
||
| - name: Load Docker image | ||
| run: | | ||
| eval $(minikube docker-env) | ||
| make container | ||
| docker images | ||
| docker load < image.tar | ||
|
|
||
|
|
||
| - name: Deploy operator to minikube | ||
| run: | | ||
|
|
@@ -78,6 +85,7 @@ jobs: | |
| kubectl wait --for=condition=Ready pod --all -n default | ||
| kubectl get pods -A | ||
| kubectl describe pods -n default | ||
| kubectl logs deployment/cloudwatch-controller-manager --all-containers=true -n amazon-cloudwatch | ||
| go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/java/default_instrumentation_java_env_variables.json app_signals | ||
|
|
||
| - name: Test for defined instrumentation resources for Java | ||
|
|
@@ -230,6 +238,7 @@ jobs: | |
|
|
||
| DeploymentAnnotationsTest: | ||
| name: DeploymentAnnotationsTest | ||
| needs: [BuildAndCacheImage] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
|
|
@@ -239,6 +248,7 @@ jobs: | |
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
|
|
||
| - name: Start minikube | ||
| uses: medyagh/setup-minikube@master | ||
|
|
@@ -252,11 +262,16 @@ jobs: | |
| sleep 10 | ||
| kubectl get pods -A | ||
|
|
||
| - name: Build image | ||
| - name: Restore cached Docker image | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: image.tar | ||
| key: docker-image-${{ github.sha }} | ||
|
|
||
| - name: Load Docker image | ||
| run: | | ||
| eval $(minikube docker-env) | ||
| make container | ||
| docker images | ||
| docker load < image.tar | ||
|
|
||
| - name: Deploy operator to minikube | ||
| run: | | ||
|
|
@@ -280,9 +295,97 @@ jobs: | |
| go test -v -run TestNodeJSOnlyDeployment ./integration-tests/manifests/annotations -timeout 30m | ||
| sleep 5 | ||
| go test -v -run TestAnnotationsOnMultipleResources ./integration-tests/manifests/annotations -timeout 30m | ||
| DefineAutoMonitorTestMatrix: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-go@v5 | ||
| - name: Generate test list | ||
| id: tests | ||
| run: | | ||
| cd integration-tests/manifests/automonitor/ && \ | ||
| echo "tests<<EOF" >> $GITHUB_OUTPUT | ||
| go test -list . | sed -e '$d' >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
| - name: Create test matrix | ||
| id: set-matrix | ||
| run: | | ||
| TESTS=$(echo "${{ steps.tests.outputs.tests }}" | jq -R -s -c 'split("\n") | map(select(length > 0))') | ||
| echo "matrix={\"test\":${TESTS}}" >> $GITHUB_OUTPUT | ||
| BuildAndCacheImage: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
| - name: Build image | ||
| run: | | ||
| make container | ||
| docker save $(docker images --format '{{.Repository}}:{{.Tag}}' | grep operator | head -n 1) > image.tar | ||
|
|
||
| - name: Cache Docker image | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: image.tar | ||
| key: docker-image-${{ github.sha }} | ||
|
|
||
| AutoMonitorTest: | ||
| name: AutoMonitorTest | ||
| runs-on: ubuntu-latest | ||
| needs: [DefineAutoMonitorTestMatrix, BuildAndCacheImage] | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| strategy: | ||
| matrix: ${{fromJson(needs.DefineAutoMonitorTestMatrix.outputs.matrix)}} | ||
| fail-fast: false | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
|
|
||
| - name: Start minikube | ||
| uses: medyagh/setup-minikube@master | ||
|
|
||
| - name: Deploy cert-manager to minikube | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: at some point we should combine the |
||
| 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: Restore cached Docker image | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: image.tar | ||
| key: docker-image-${{ github.sha }} | ||
|
|
||
| - name: Load Docker image | ||
| run: | | ||
| eval $(minikube docker-env) | ||
| docker load < image.tar | ||
|
|
||
| - name: Deploy operator to minikube | ||
| run: | | ||
| make deploy | ||
|
|
||
| - name: Test AutoMonitor-created annotations | ||
| run: | | ||
| kubectl get pods -A | ||
| kubectl describe pods -n default | ||
| go test -v ./integration-tests/manifests/automonitor -run ^${{ matrix.test }}$ -timeout 60m -controllerManagerName 'cloudwatch-controller-manager' | ||
|
|
||
| DaemonsetAnnotationsTest: | ||
| name: DaemonsetAnnotationsTest | ||
| needs: [BuildAndCacheImage] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
|
|
@@ -292,6 +395,7 @@ jobs: | |
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
|
|
||
| - name: Start minikube | ||
| uses: medyagh/setup-minikube@master | ||
|
|
@@ -305,11 +409,17 @@ jobs: | |
| sleep 10 | ||
| kubectl get pods -A | ||
|
|
||
| - name: Build image | ||
| - name: Restore cached Docker image | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: image.tar | ||
| key: docker-image-${{ github.sha }} | ||
|
|
||
| - name: Load Docker image | ||
| run: | | ||
| eval $(minikube docker-env) | ||
| make container | ||
| docker images | ||
| docker load < image.tar | ||
|
|
||
|
|
||
| - name: Deploy operator to minikube | ||
| run: | | ||
|
|
@@ -336,6 +446,7 @@ jobs: | |
|
|
||
| StatefulsetAnnotationsTest: | ||
| name: StatefulsetAnnotationsTest | ||
| needs: [BuildAndCacheImage] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
|
|
@@ -345,6 +456,7 @@ jobs: | |
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
|
|
||
| - name: Start minikube | ||
| uses: medyagh/setup-minikube@master | ||
|
|
@@ -358,11 +470,17 @@ jobs: | |
| sleep 10 | ||
| kubectl get pods -A | ||
|
|
||
| - name: Build image | ||
| - name: Restore cached Docker image | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: image.tar | ||
| key: docker-image-${{ github.sha }} | ||
|
|
||
| - name: Load Docker image | ||
| run: | | ||
| eval $(minikube docker-env) | ||
| make container | ||
| docker images | ||
| docker load < image.tar | ||
|
|
||
|
|
||
| - name: Deploy operator to minikube | ||
| run: | | ||
|
|
@@ -390,6 +508,7 @@ jobs: | |
|
|
||
| NamespaceAnnotationsTest: | ||
| name: NamespaceAnnotationsTest | ||
| needs: [BuildAndCacheImage] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
|
|
@@ -399,6 +518,7 @@ jobs: | |
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
|
|
||
| - name: Start minikube | ||
| uses: medyagh/setup-minikube@master | ||
|
|
@@ -411,11 +531,17 @@ jobs: | |
| run: | | ||
| kubectl get pods -A | ||
|
|
||
| - name: Build image | ||
| - name: Restore cached Docker image | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: image.tar | ||
| key: docker-image-${{ github.sha }} | ||
|
|
||
| - name: Load Docker image | ||
| run: | | ||
| eval $(minikube docker-env) | ||
| make container | ||
| docker images | ||
| docker load < image.tar | ||
|
|
||
|
|
||
| - name: Deploy operator to minikube | ||
| run: | | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| apiVersion: apps/v1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all of these manifests are pretty much identical but just different names. Can we re-use just 1? |
||
| kind: Deployment | ||
| metadata: | ||
| name: admin-dashboard | ||
| labels: | ||
| app: admin-dashboard | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: admin-dashboard | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: admin-dashboard | ||
| spec: | ||
| containers: | ||
| - name: admin-dashboard-container | ||
| image: nginx:latest | ||
| ports: | ||
| - containerPort: 80 | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: admin-dashboard-service | ||
| spec: | ||
| selector: | ||
| app: admin-dashboard | ||
| ports: | ||
| - port: 80 | ||
| targetPort: 80 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, can we call the test directly using absolute path?