@@ -26,6 +26,7 @@ import (
26
26
"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/openshift"
27
27
"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/prometheus"
28
28
"github.com/open-telemetry/opentelemetry-operator/internal/autodetect/rbac"
29
+ "github.com/open-telemetry/opentelemetry-operator/internal/autodetect/targetallocator"
29
30
"github.com/open-telemetry/opentelemetry-operator/internal/config"
30
31
)
31
32
@@ -60,6 +61,9 @@ func TestConfigChangesOnAutoDetect(t *testing.T) {
60
61
CertManagerAvailabilityFunc : func (ctx context.Context ) (certmanager.Availability , error ) {
61
62
return certmanager .Available , nil
62
63
},
64
+ TargetAllocatorAvailabilityFunc : func () (targetallocator.Availability , error ) {
65
+ return targetallocator .Available , nil
66
+ },
63
67
}
64
68
cfg := config .New (
65
69
config .WithAutoDetect (mock ),
@@ -68,6 +72,9 @@ func TestConfigChangesOnAutoDetect(t *testing.T) {
68
72
// sanity check
69
73
require .Equal (t , openshift .RoutesNotAvailable , cfg .OpenShiftRoutesAvailability ())
70
74
require .Equal (t , prometheus .NotAvailable , cfg .PrometheusCRAvailability ())
75
+ require .Equal (t , rbac .NotAvailable , cfg .CreateRBACPermissions ())
76
+ require .Equal (t , certmanager .NotAvailable , cfg .CertManagerAvailability ())
77
+ require .Equal (t , targetallocator .NotAvailable , cfg .TargetAllocatorAvailability ())
71
78
72
79
// test
73
80
err := cfg .AutoDetect ()
@@ -76,6 +83,9 @@ func TestConfigChangesOnAutoDetect(t *testing.T) {
76
83
// verify
77
84
assert .Equal (t , openshift .RoutesAvailable , cfg .OpenShiftRoutesAvailability ())
78
85
require .Equal (t , prometheus .Available , cfg .PrometheusCRAvailability ())
86
+ require .Equal (t , rbac .Available , cfg .CreateRBACPermissions ())
87
+ require .Equal (t , certmanager .Available , cfg .CertManagerAvailability ())
88
+ require .Equal (t , targetallocator .Available , cfg .TargetAllocatorAvailability ())
79
89
}
80
90
81
91
var _ autodetect.AutoDetect = (* mockAutoDetect )(nil )
@@ -85,6 +95,7 @@ type mockAutoDetect struct {
85
95
PrometheusCRsAvailabilityFunc func () (prometheus.Availability , error )
86
96
RBACPermissionsFunc func (ctx context.Context ) (rbac.Availability , error )
87
97
CertManagerAvailabilityFunc func (ctx context.Context ) (certmanager.Availability , error )
98
+ TargetAllocatorAvailabilityFunc func () (targetallocator.Availability , error )
88
99
}
89
100
90
101
func (m * mockAutoDetect ) FIPSEnabled (_ context.Context ) bool {
@@ -118,3 +129,10 @@ func (m *mockAutoDetect) CertManagerAvailability(ctx context.Context) (certmanag
118
129
}
119
130
return certmanager .NotAvailable , nil
120
131
}
132
+
133
+ func (m * mockAutoDetect ) TargetAllocatorAvailability () (targetallocator.Availability , error ) {
134
+ if m .TargetAllocatorAvailabilityFunc != nil {
135
+ return m .TargetAllocatorAvailabilityFunc ()
136
+ }
137
+ return targetallocator .NotAvailable , nil
138
+ }
0 commit comments