Skip to content

Commit 9a669d0

Browse files
committed
Added ingress e2e tests
Signed-off-by: Yuri Sa <[email protected]>
1 parent 2f1b576 commit 9a669d0

File tree

5 files changed

+76
-16
lines changed

5 files changed

+76
-16
lines changed

controllers/suite_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727

2828
routev1 "github.com/openshift/api/route/v1"
2929
"github.com/stretchr/testify/assert"
30-
autoscalingv2 "k8s.io/api/autoscaling/v2"
3130
v1 "k8s.io/api/core/v1"
3231
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
3332
"k8s.io/apimachinery/pkg/api/errors"
@@ -121,11 +120,6 @@ func TestMain(m *testing.M) {
121120
os.Exit(1)
122121
}
123122

124-
if err = autoscalingv2.AddToScheme(testScheme); err != nil {
125-
fmt.Printf("failed to register scheme: %v", err)
126-
os.Exit(1)
127-
}
128-
129123
if err = v1alpha1.AddToScheme(testScheme); err != nil {
130124
fmt.Printf("failed to register scheme: %v", err)
131125
os.Exit(1)

tests/e2e-autoscale/autoscale/chainsaw-test.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ spec:
3333
name: telemetrygen-set-utilization
3434
- assert:
3535
file: 03-assert.yaml
36+
# applying the same OpenTelemetryCollector from the 00-step, but this time without the spec.autoscaler, which should inform the controller to delete the HPAs resources. So, we should get an error checking if the HPAs still exist
3637
- name: step-04
3738
try:
38-
- apply:
39-
file: 04-install.yaml
40-
- error:
41-
file: 04-error.yaml
39+
- apply:
40+
file: 04-install.yaml
41+
- error:
42+
file: 04-error.yaml

tests/e2e/ingress/01-error.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
annotations:
6+
something.com: "true"
7+
labels:
8+
app.kubernetes.io/managed-by: opentelemetry-operator
9+
app.kubernetes.io/name: simplest-ingress
10+
name: simplest-ingress
11+
ownerReferences:
12+
- apiVersion: opentelemetry.io/v1alpha1
13+
blockOwnerDeletion: true
14+
controller: true
15+
kind: OpenTelemetryCollector
16+
name: simplest
17+
spec:
18+
rules:
19+
- host: example.com
20+
http:
21+
paths:
22+
- backend:
23+
service:
24+
name: simplest-collector
25+
port:
26+
name: otlp-grpc
27+
path: /otlp-grpc
28+
pathType: Prefix
29+
- backend:
30+
service:
31+
name: simplest-collector
32+
port:
33+
name: otlp-http
34+
path: /otlp-http
35+
pathType: Prefix

tests/e2e/ingress/01-install.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
apiVersion: opentelemetry.io/v1alpha1
3+
kind: OpenTelemetryCollector
4+
metadata:
5+
name: simplest
6+
spec:
7+
mode: "deployment"
8+
config: |
9+
receivers:
10+
otlp:
11+
protocols:
12+
grpc:
13+
http:
14+
15+
exporters:
16+
debug:
17+
18+
service:
19+
pipelines:
20+
traces:
21+
receivers: [otlp]
22+
processors: []
23+
exporters: [debug]

tests/e2e/ingress/chainsaw-test.yaml

+13-6
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ metadata:
66
name: ingress
77
spec:
88
steps:
9-
- name: step-00
10-
try:
11-
- apply:
12-
file: 00-install.yaml
13-
- assert:
14-
file: 00-assert.yaml
9+
- name: step-00
10+
try:
11+
- apply:
12+
file: 00-install.yaml
13+
- assert:
14+
file: 00-assert.yaml
15+
# Applying the same OpenTelemetryCollector from the previous step, but this time without the spec.ingress, which should inform the controller to delete the ingress resource. So, we should get an error checking if the ingress still exists.
16+
- name: step-01
17+
try:
18+
- apply:
19+
file: 01-install.yaml
20+
- error:
21+
file: 01-error.yaml

0 commit comments

Comments
 (0)