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] add integration test #3677

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
61 changes: 61 additions & 0 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
java-autoinstrumentation:
env:
KUBECONFIG: /tmp/kube-config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: make our image
run: VERSION=dev make container
- name: make java autoinstrumentation image
run: |
cd autoinstrumentation/java && docker build -t java-autoinstrumentation:dev --build-arg version=$(cat version.txt) .
- name: Create kind cluster
uses: helm/[email protected]
with:
cluster_name: kind
node_image: kindest/node:v1.27.3
- name: Deploy certificate signing request
run: kubectl apply -f tests/integration/certs.yaml
- name: Approve our certificate signing request
run: kubectl certificate approve operator
- name: register our image
run: |
img=$(docker images | grep operator | awk '{print $1":"$2}')
docker tag $img manager:dev
kind load docker-image manager:dev --name kind
kind load docker-image java-autoinstrumentation:dev --name kind
- name: Deploy collector
run: kubectl apply -f tests/integration/collector.yaml
- name: Deploy operator collector CRDs
run: kubectl apply -f tests/integration/crd-opentelemetrycollector.yaml
- name: Sleep 10s
run: sleep 10
- name: Deploy operator instrumentation CRDs
run: kubectl apply -f tests/integration/crd-opentelemetryinstrumentation.yaml
- name: Deploy operator opampbridge CRDs
run: kubectl apply -f tests/integration/crd-opampbridges.yaml
- name: Deploy instrumentation
run: kubectl apply -f tests/integration/instrumentation.yaml
- name: Sleep 10s
run: sleep 10
- name: Deploy operator
run: kubectl apply -f tests/integration/operator.yaml
- name: Sleep 10s
run: sleep 10
- name: Deploy java app
run: kubectl apply -f tests/integration/java.yaml
- name: Sleep 20s
run: sleep 20
- name: Check logs
run: |
COLLECTOR_POD=$(kubectl get pod -l app=collector -o jsonpath="{.items[0].metadata.name}")
LOGS=$(kubectl logs ${COLLECTOR_POD})
echo ${LOGS}
echo ${LOGS} | grep "Starting Servlet engine"
69 changes: 69 additions & 0 deletions tests/integration/certs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
apiVersion: certificates.k8s.io/v1
kind: CertificateSigningRequest
metadata:
name: operator
spec:
request: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQzJEQ0NBY0FDQVFBd0p6RWxNQ01HQTFVRUF3d2NiM0JsY21GMGIzSXRkMlZpYUc5dmF5NWtaV1poZFd4MApMbk4yWXpDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTXcyZGoyTlByTVFyWTRTCkF1UEEwL0lsK1BBV3N5eGR0ZzZoS3prdm81VTVVTmp5NGRYbGVuOGdVTGZFaEVwS3Z0d0JvLzQvSTY4SWZpYUkKMjNjSCt0WURYYUZEYyttOVB1bXdPNWFqbldWS2F6dEt0RGUxZ3RJL0c4NTkzSko3MHBNNHFmMlNTdXZQWmlkYwprdDBIYzZwYmJjOWRmYlBXNlZxa003UzQwM0w3Y1AxdlJncmFxVE9QUGFOdUNpMXFGVm00bGd1UTMwOTA2VnVTCnlDOHNBZlREQ1FkZ3pLQkpiT044MEtsZkNBYkJzZkU5OEFsaFFONHhkZEtuWWRpWjd2Z2ZRUGR2cmRmNWpNdFgKRkx0RDNiWUY5TFlZK2prMHM5dGhpTEhjV2gwUjVuT01nTndpTURQTW53a0k2cTBIMXhHZjFNcTk0WUx0Y3RhYwovM3lNYzRNQ0F3RUFBYUJzTUdvR0NTcUdTSWIzRFFFSkRqRmRNRnN3RGdZRFZSMFBBUUgvQkFRREFnV2dNQ0FHCkExVWRKUUVCL3dRV01CUUdDQ3NHQVFVRkJ3TUJCZ2dyQmdFRkJRY0RBakFuQmdOVkhSRUVJREFlZ2h4dmNHVnkKWVhSdmNpMTNaV0pvYjI5ckxtUmxabUYxYkhRdWMzWmpNQTBHQ1NxR1NJYjNEUUVCQ3dVQUE0SUJBUUFna3krYwpNbFZPd1JrUFpQdEE4cWxYMndTS3p1QmdrNGVFc3JwYm90akxXbC9HV2s0a1pqaHN4M2NEeDFXSnUwL3AxMHQxCmlzOE4zL0tnaVNPZjMzVHl6OGtaelBWekRmWTJoT09Semd0ZU01OG4vY1ErQk1UT0ZhQXBueThEVE80VzloL1oKSytSdzlwNVdrKzRvbHVOc2RTaEU5OG8zN3hVYVc4eEpYQUF4OFVDZ2g3MWdaNGJUNjhhU2doUktBWTAvM04rVQp6OTJYVWF6MVVSQXpXMnExRTNkUk15cnhxWHhCWDJLNjAvczlVKzlweXUzR1IvZ2JVaHJaNjNxMWpJZ0lPSFVHClp2aWpTUFdsQ05CNGlkd29tVW1Eb0syYWl6TXRTWnNETHdLTFcxS2RkaVFacjQxNWpBc0ovOWNXcW81MU9oSGQKcDZMYTFSVTQ4Ymhoclo3NAotLS0tLUVORCBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0K"
signerName: example.com/serving
usages:
- digital signature
- key encipherment
- server auth
---
apiVersion: v1
kind: ConfigMap
metadata:
name: certs
data:
tls.key: |
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDMNnY9jT6zEK2O
EgLjwNPyJfjwFrMsXbYOoSs5L6OVOVDY8uHV5Xp/IFC3xIRKSr7cAaP+PyOvCH4m
iNt3B/rWA12hQ3PpvT7psDuWo51lSms7SrQ3tYLSPxvOfdySe9KTOKn9kkrrz2Yn
XJLdB3OqW23PXX2z1ulapDO0uNNy+3D9b0YK2qkzjz2jbgotahVZuJYLkN9PdOlb
ksgvLAH0wwkHYMygSWzjfNCpXwgGwbHxPfAJYUDeMXX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DgQWBBTeVi00CIUEE+Bk
kEiDl25qjVcfGTANBgkqhkiG9w0BAQsFAAOCAQEAWYfXUwV9wgJhfPIZuI9puX59
fXlzksS/X2EE9C9gDg5zuPLZ8MmfBglFR+xBO3PXLBKxCU0U2nwZwuKT1qbTXcHf
kPywNOnMDAvbfO3I8zg+4eNeMM5WWrrL7JA6L6kSMY3wk1VPriRTajrmJP53T9rI
1XZLRM6C0xl34gniOqRK+CnmpYUw0yQUi0neeMgQFmhzClaafdNWd6aerBQik1jg
kn4iNr5FKfmDHNr/WrmcDJ8GTCgKU4R+f4zFFhgO7dHpUs5zD4szirq6n2ayEd8b
aSU0+wL2C4Kd72AYDHrkaG2Qi19xCZJDIFqT14m5Rexpbx4i+9E6LgonqX0g4w==
-----END CERTIFICATE-----

80 changes: 80 additions & 0 deletions tests/integration/collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: collector
spec:
replicas: 1
selector:
matchLabels:
app: collector
template:
metadata:
name: collector
labels:
app: collector
spec:
automountServiceAccountToken: false
containers:
- image: otel/opentelemetry-collector-contrib:latest
name: collector
imagePullPolicy: IfNotPresent
volumeMounts:
- name: config-volume
mountPath: /etc/otelcol-contrib/config.yaml
subPath: config.yaml
ports:
- containerPort: 4317
name: otlp
- containerPort: 4318
name: otlphttp
volumes:
- name: config-volume
configMap:
name: collector-config
---
apiVersion: v1
kind: Service
metadata:
name: collector
namespace: default
spec:
ports:
- port: 4317
protocol: TCP
targetPort: otlp
name: otlp
- port: 4318
protocol: TCP
targetPort: otlphttp
name: otlphttp
selector:
app: collector
---
apiVersion: v1
kind: ConfigMap
metadata:
name: collector-config
namespace: default
data:
config.yaml: |
receivers:
otlp:
protocols:
grpc:
endpoint: "0.0.0.0:4317"
http:
endpoint: "0.0.0.0:4318"
exporters:
debug:
verbosity: detailed
service:
pipelines:
metrics:
receivers: [otlp]
exporters: [debug]
traces:
receivers: [otlp]
exporters: [debug]
logs:
receivers: [otlp]
exporters: [debug]
Loading
Loading