From f64ebf18160064a2f8ea3078de7431cd94768f49 Mon Sep 17 00:00:00 2001 From: sidhdirenge Date: Thu, 16 Jan 2025 05:40:13 +0000 Subject: [PATCH] Fix unit test --- api/v1alpha1/cdapmaster_types.go | 4 +- .../crd/bases/cdap.cdap.io_cdapmasters.yaml | 5 +- controllers/utils_test.go | 68 +++++++++---------- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/api/v1alpha1/cdapmaster_types.go b/api/v1alpha1/cdapmaster_types.go index d92baae4..c48035f4 100644 --- a/api/v1alpha1/cdapmaster_types.go +++ b/api/v1alpha1/cdapmaster_types.go @@ -70,8 +70,8 @@ type CDAPMasterSpec struct { // Logs is specification for the CDAP logging service. Logs LogsSpec `json:"logs,omitempty"` // Messaging is specification for the CDAP messaging service. - // To disable this service: either omit or set the field to nil - // To enable this service: set it to a pointer to a MessagingSpec struct (can be an empty struct) + // To disable this service: either omit or set the field to nil + // To enable this service: set it to a pointer to a MessagingSpec struct (can be an empty struct) Messaging *MessagingSpec `json:"messaging,omitempty"` // Metadata is specification for the CDAP metadata service. Metadata MetadataSpec `json:"metadata,omitempty"` diff --git a/config/crd/bases/cdap.cdap.io_cdapmasters.yaml b/config/crd/bases/cdap.cdap.io_cdapmasters.yaml index 651e5317..8afb3193 100644 --- a/config/crd/bases/cdap.cdap.io_cdapmasters.yaml +++ b/config/crd/bases/cdap.cdap.io_cdapmasters.yaml @@ -15730,7 +15730,10 @@ spec: type: string type: object messaging: - description: Messaging is specification for the CDAP messaging service. + description: |- + Messaging is specification for the CDAP messaging service. + To disable this service: either omit or set the field to nil + To enable this service: set it to a pointer to a MessagingSpec struct (can be an empty struct) properties: additionalVolumeMounts: description: |- diff --git a/controllers/utils_test.go b/controllers/utils_test.go index 3e6af1c9..7732e668 100644 --- a/controllers/utils_test.go +++ b/controllers/utils_test.go @@ -18,48 +18,44 @@ var _ = Describe("Controller Suite", func() { BeforeEach(func() { master = &v1alpha1.CDAPMaster{} serviceToSpec = map[string]*v1alpha1.CDAPServiceSpec{ - serviceLogs: &master.Spec.Logs.CDAPServiceSpec, - serviceAppFabric: &master.Spec.AppFabric.CDAPServiceSpec, - serviceAppFabricProcessor: &master.Spec.AppFabricProcessor.CDAPServiceSpec, - serviceMetrics: &master.Spec.Metrics.CDAPServiceSpec, - serviceRouter: &master.Spec.Router.CDAPServiceSpec, - serviceMessaging: &master.Spec.Messaging.CDAPServiceSpec, - serviceMetadata: &master.Spec.Metadata.CDAPServiceSpec, - servicePreview: &master.Spec.Preview.CDAPServiceSpec, - serviceUserInterface: &master.Spec.UserInterface.CDAPServiceSpec, + serviceLogs: &master.Spec.Logs.CDAPServiceSpec, + serviceAppFabric: &master.Spec.AppFabric.CDAPServiceSpec, + serviceAppFabricProcessor: &master.Spec.AppFabricProcessor.CDAPServiceSpec, + serviceMetrics: &master.Spec.Metrics.CDAPServiceSpec, + serviceRouter: &master.Spec.Router.CDAPServiceSpec, + serviceMetadata: &master.Spec.Metadata.CDAPServiceSpec, + servicePreview: &master.Spec.Preview.CDAPServiceSpec, + serviceUserInterface: &master.Spec.UserInterface.CDAPServiceSpec, } serviceToScalableSpec = map[string]*v1alpha1.CDAPScalableServiceSpec{ - serviceLogs: nil, - serviceAppFabric: &master.Spec.AppFabric.CDAPScalableServiceSpec, - serviceAppFabricProcessor: nil, - serviceMetrics: nil, - serviceRouter: &master.Spec.Router.CDAPScalableServiceSpec, - serviceMessaging: nil, - serviceMetadata: &master.Spec.Metadata.CDAPScalableServiceSpec, - servicePreview: nil, - serviceUserInterface: &master.Spec.UserInterface.CDAPScalableServiceSpec, + serviceLogs: nil, + serviceAppFabric: &master.Spec.AppFabric.CDAPScalableServiceSpec, + serviceAppFabricProcessor: nil, + serviceMetrics: nil, + serviceRouter: &master.Spec.Router.CDAPScalableServiceSpec, + serviceMetadata: &master.Spec.Metadata.CDAPScalableServiceSpec, + servicePreview: nil, + serviceUserInterface: &master.Spec.UserInterface.CDAPScalableServiceSpec, } serviceToStatefulSpec = map[string]*v1alpha1.CDAPStatefulServiceSpec{ - serviceLogs: &master.Spec.Logs.CDAPStatefulServiceSpec, - serviceAppFabric: nil, - serviceAppFabricProcessor: &master.Spec.AppFabricProcessor.CDAPStatefulServiceSpec, - serviceMetrics: &master.Spec.Metrics.CDAPStatefulServiceSpec, - serviceRouter: nil, - serviceMessaging: &master.Spec.Messaging.CDAPStatefulServiceSpec, - serviceMetadata: nil, - servicePreview: &master.Spec.Preview.CDAPStatefulServiceSpec, - serviceUserInterface: nil, + serviceLogs: &master.Spec.Logs.CDAPStatefulServiceSpec, + serviceAppFabric: nil, + serviceAppFabricProcessor: &master.Spec.AppFabricProcessor.CDAPStatefulServiceSpec, + serviceMetrics: &master.Spec.Metrics.CDAPStatefulServiceSpec, + serviceRouter: nil, + serviceMetadata: nil, + servicePreview: &master.Spec.Preview.CDAPStatefulServiceSpec, + serviceUserInterface: nil, } serviceToExternalSpec = map[string]*v1alpha1.CDAPExternalServiceSpec{ - serviceLogs: nil, - serviceAppFabric: nil, - serviceAppFabricProcessor: nil, - serviceMetrics: nil, - serviceRouter: &master.Spec.Router.CDAPExternalServiceSpec, - serviceMessaging: nil, - serviceMetadata: nil, - servicePreview: nil, - serviceUserInterface: &master.Spec.UserInterface.CDAPExternalServiceSpec, + serviceLogs: nil, + serviceAppFabric: nil, + serviceAppFabricProcessor: nil, + serviceMetrics: nil, + serviceRouter: &master.Spec.Router.CDAPExternalServiceSpec, + serviceMetadata: nil, + servicePreview: nil, + serviceUserInterface: &master.Spec.UserInterface.CDAPExternalServiceSpec, } }) It("Successfully get pointer to CDAPServiceSpec", func() {