Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sidhdirenge committed Jan 16, 2025
1 parent 717d587 commit f64ebf1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 39 deletions.
4 changes: 2 additions & 2 deletions api/v1alpha1/cdapmaster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
5 changes: 4 additions & 1 deletion config/crd/bases/cdap.cdap.io_cdapmasters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |-
Expand Down
68 changes: 32 additions & 36 deletions controllers/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f64ebf1

Please sign in to comment.