Skip to content

Commit

Permalink
feat: adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jnarezo committed Oct 8, 2024
1 parent 5948165 commit bd0ecb0
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 99 deletions.
8 changes: 5 additions & 3 deletions apis/v1alpha1/instrumentation_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ func TestInstrumentationValidatingWebhook(t *testing.T) {
},
{
name: "with volume and volumeSizeLimit",
err: "spec.nodejs.volume and spec.nodejs.volumeSizeLimit cannot both be defined",
err: "spec.nodejs.volumeClaimTemplate and spec.nodejs.volumeSizeLimit cannot both be defined",
inst: Instrumentation{
Spec: InstrumentationSpec{
NodeJS: NodeJS{
Volume: corev1.Volume{
Name: "vol1",
VolumeClaimTemplate: corev1.PersistentVolumeClaimTemplate{
Spec: corev1.PersistentVolumeClaimSpec{
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},
},
},
VolumeSizeLimit: &defaultVolumeSize,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ spec:
env:
- name: OTEL_NODEJS_DEBUG
value: "true"
volume:
name: ephemeral-volume
ephemeral:
volumeClaimTemplate:
metadata:
labels:
type: my-test-volume
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
volumeClaimTemplate:
metadata:
labels:
type: my-test-volume
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi
156 changes: 72 additions & 84 deletions tests/e2e-instrumentation/instrumentation-nodejs-volume/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,93 +8,81 @@ metadata:
app: my-nodejs
spec:
containers:
- env:
- name: OTEL_NODE_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: OTEL_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NODE_PATH
value: /usr/local/lib/node_modules
- name: OTEL_NODEJS_DEBUG
value: "true"
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js'
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://localhost:4317
- name: OTEL_EXPORTER_OTLP_TIMEOUT
value: "20"
- name: OTEL_TRACES_SAMPLER
value: parentbased_traceidratio
- name: OTEL_TRACES_SAMPLER_ARG
value: "0.85"
- name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED
value: "true"
- name: OTEL_METRICS_EXPORTER
value: prometheus
- name: OTEL_SERVICE_NAME
value: my-nodejs
- name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: OTEL_PROPAGATORS
value: jaeger,b3
- name: OTEL_RESOURCE_ATTRIBUTES
name: myapp
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
readOnly: true
- mountPath: /otel-auto-instrumentation-nodejs
name: ephemeral-volume
- args:
- --feature-gates=-component.UseLocalHostAsDefaultHost
- --config=env:OTEL_CONFIG
name: otc-container
- env:
- name: OTEL_NODE_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: OTEL_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: NODE_PATH
value: /usr/local/lib/node_modules
- name: OTEL_NODEJS_DEBUG
value: "true"
- name: NODE_OPTIONS
value: " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js"
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://localhost:4317
- name: OTEL_EXPORTER_OTLP_TIMEOUT
value: "20"
- name: OTEL_TRACES_SAMPLER
value: parentbased_traceidratio
- name: OTEL_TRACES_SAMPLER_ARG
value: "0.85"
- name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED
value: "true"
- name: OTEL_METRICS_EXPORTER
value: prometheus
- name: OTEL_SERVICE_NAME
value: my-nodejs
- name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: OTEL_PROPAGATORS
value: jaeger,b3
- name: OTEL_RESOURCE_ATTRIBUTES
name: myapp
volumeMounts:
- mountPath: /var/run/secrets/kubernetes.io/serviceaccount
readOnly: true
- mountPath: /otel-auto-instrumentation-nodejs
name: ephemeral-volume
- args:
- --feature-gates=-component.UseLocalHostAsDefaultHost
- --config=env:OTEL_CONFIG
name: otc-container
initContainers:
- name: opentelemetry-auto-instrumentation-nodejs
- name: opentelemetry-auto-instrumentation-nodejs
volumes:
- projected:
defaultMode: 420
sources:
- configMap:
items:
- key: ca.crt
path: ca.crt
name: kube-root-ca.crt
- ephemeral:
volumeClaimTemplate:
metadata:
creationTimestamp: null
labels:
type: my-test-volume
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
volumeMode: Filesystem
- ephemeral:
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
volumeMode: Filesystem
status:
containerStatuses:
- name: myapp
ready: true
started: true
- name: otc-container
ready: true
started: true
- name: myapp
ready: true
started: true
- name: otc-container
ready: true
started: true
initContainerStatuses:
- name: opentelemetry-auto-instrumentation-nodejs
ready: true
- name: opentelemetry-auto-instrumentation-nodejs
ready: true
phase: Running

0 comments on commit bd0ecb0

Please sign in to comment.