Skip to content

Commit bd0ed36

Browse files
committed
fix(tests): Round 34 - Fix bool pointer types
InsecureSkipVerify bool to *bool conversion: - Added boolPtr helper function to create bool pointers - Changed InsecureSkipVerify: false to InsecureSkipVerify: boolPtr(false) - SafeTLSConfig.InsecureSkipVerify expects *bool not bool - Fixes type mismatch at line 145 Errors fixed in Round 34: 1 Total errors fixed across ALL 34 rounds: 144
1 parent a33a354 commit bd0ed36

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

adapters/vnf-operator/tests/monitoring/servicemonitor_test.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import (
1515
v1 "k8s.io/api/core/v1"
1616
)
1717

18+
// Helper function to create bool pointer
19+
func boolPtr(b bool) *bool {
20+
return &b
21+
}
22+
1823
// MockServiceMonitorClient mocks the ServiceMonitor client interface
1924
type MockServiceMonitorClient struct {
2025
mock.Mock
@@ -142,7 +147,7 @@ func TestServiceMonitorCreation(t *testing.T) {
142147
ScrapeTimeout: "5s",
143148
TLSConfig: &monitoringv1.TLSConfig{
144149
SafeTLSConfig: monitoringv1.SafeTLSConfig{
145-
InsecureSkipVerify: false,
150+
InsecureSkipVerify: boolPtr(false),
146151
ServerName: "vnf-operator.o-ran-mano.svc.cluster.local",
147152
},
148153
CertFile: "/etc/ssl/certs/client.crt",
@@ -411,7 +416,7 @@ func TestTLSConfiguration(t *testing.T) {
411416
name: "valid TLS configuration with certificates",
412417
tlsConfig: &monitoringv1.TLSConfig{
413418
SafeTLSConfig: monitoringv1.SafeTLSConfig{
414-
InsecureSkipVerify: false,
419+
InsecureSkipVerify: boolPtr(false),
415420
ServerName: "orchestrator.o-ran-mano.svc.cluster.local",
416421
},
417422
CertFile: "/etc/ssl/certs/client.crt",
@@ -440,7 +445,7 @@ func TestTLSConfiguration(t *testing.T) {
440445
name: "TLS with secret references",
441446
tlsConfig: &monitoringv1.TLSConfig{
442447
SafeTLSConfig: monitoringv1.SafeTLSConfig{
443-
InsecureSkipVerify: false,
448+
InsecureSkipVerify: boolPtr(false),
444449
ServerName: "dms.o-ran-mano.svc.cluster.local",
445450
Cert: monitoringv1.SecretOrConfigMap{
446451
Secret: &v1.SecretKeySelector{
@@ -475,7 +480,7 @@ func TestTLSConfiguration(t *testing.T) {
475480
name: "invalid TLS - missing certificate",
476481
tlsConfig: &monitoringv1.TLSConfig{
477482
SafeTLSConfig: monitoringv1.SafeTLSConfig{
478-
InsecureSkipVerify: false,
483+
InsecureSkipVerify: boolPtr(false),
479484
ServerName: "secure-service.o-ran-mano.svc.cluster.local",
480485
},
481486
// Missing certificate configuration
@@ -490,7 +495,7 @@ func TestTLSConfiguration(t *testing.T) {
490495
name: "invalid TLS - mismatched server name",
491496
tlsConfig: &monitoringv1.TLSConfig{
492497
SafeTLSConfig: monitoringv1.SafeTLSConfig{
493-
InsecureSkipVerify: false,
498+
InsecureSkipVerify: boolPtr(false),
494499
ServerName: "wrong-hostname", // Doesn't match actual service
495500
},
496501
CertFile: "/etc/ssl/certs/client.crt",
@@ -585,7 +590,7 @@ func TestAuthentication(t *testing.T) {
585590
BearerToken: "service-account-token",
586591
TLSConfig: &monitoringv1.TLSConfig{
587592
SafeTLSConfig: monitoringv1.SafeTLSConfig{
588-
InsecureSkipVerify: false,
593+
InsecureSkipVerify: boolPtr(false),
589594
ServerName: "secure-metrics.o-ran-mano.svc.cluster.local",
590595
},
591596
CAFile: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt",

0 commit comments

Comments
 (0)