Skip to content

Commit

Permalink
fixed cm test
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekr-splunk committed Jul 21, 2023
1 parent 5d5851a commit 28694ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/splunk/enterprise/clustermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type splunkManager struct {

// ApplyClusterManager reconciles the state of a Splunk Enterprise cluster manager.
func (p *splunkManager) ApplyClusterManager(ctx context.Context, client splcommon.ControllerClient, cr *enterpriseApi.ClusterManager) (reconcile.Result, error) {

// unless modified, reconcile for this object will be requeued after 5 seconds
result := reconcile.Result{
Requeue: true,
Expand Down Expand Up @@ -120,7 +119,7 @@ func (p *splunkManager) ApplyClusterManager(ctx context.Context, client splcommo
// 1. Initialize the S3Clients based on providers
// 2. Check the status of apps on remote storage.
if len(cr.Spec.AppFrameworkConfig.AppSources) != 0 {
err := initAndCheckAppInfoStatus(ctx, p.client, cr, &cr.Spec.AppFrameworkConfig, &cr.Status.AppContext)
err := initAndCheckAppInfoStatus(ctx, client, cr, &cr.Spec.AppFrameworkConfig, &cr.Status.AppContext)
if err != nil {
eventPublisher.Warning(ctx, "initAndCheckAppInfoStatus", fmt.Sprintf("init and check app info status failed %s", err.Error()))
cr.Status.AppContext.IsDeploymentInProgress = false
Expand All @@ -129,7 +128,7 @@ func (p *splunkManager) ApplyClusterManager(ctx context.Context, client splcommo
}

// create or update general config resources
namespaceScopedSecret, err := ApplySplunkConfig(ctx, p.client, cr, cr.Spec.CommonSplunkSpec, SplunkIndexer)
namespaceScopedSecret, err := ApplySplunkConfig(ctx, client, cr, cr.Spec.CommonSplunkSpec, SplunkIndexer)
if err != nil {
scopedLog.Error(err, "create or update general config failed", "error", err.Error())
eventPublisher.Warning(ctx, "ApplySplunkConfig", fmt.Sprintf("create or update general config failed with error %s", err.Error()))
Expand All @@ -140,7 +139,7 @@ func (p *splunkManager) ApplyClusterManager(ctx context.Context, client splcommo
if cr.ObjectMeta.DeletionTimestamp != nil {
if cr.Spec.MonitoringConsoleRef.Name != "" {
extraEnv, _ := VerifyCMisMultisite(ctx, cr, namespaceScopedSecret)
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, p.client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, extraEnv, false)
_, err = ApplyMonitoringConsoleEnvConfigMap(ctx, client, cr.GetNamespace(), cr.GetName(), cr.Spec.MonitoringConsoleRef.Name, extraEnv, false)
if err != nil {
return result, err
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/splunk/enterprise/clustermanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func TestApplyClusterManager(t *testing.T) {
reconcile := func(c *spltest.MockClient, cr interface{}) error {
manager := setCreds(t, c, cr.(*enterpriseApi.ClusterManager))
_, err := manager.ApplyClusterManager(ctx, c, cr.(*enterpriseApi.ClusterManager))
//_, err := ApplyClusterManager(ctx, c, cr.(*enterpriseApi.ClusterManager))
return err
}
spltest.ReconcileTesterWithoutRedundantCheck(t, "TestApplyClusterManager", &current, revised, createCalls, updateCalls, reconcile, true)
Expand All @@ -157,6 +158,7 @@ func TestApplyClusterManager(t *testing.T) {
deleteFunc := func(cr splcommon.MetaObject, c splcommon.ControllerClient) (bool, error) {
manager := setCreds(t, c, &current)
_, err := manager.ApplyClusterManager(ctx, c, cr.(*enterpriseApi.ClusterManager))
//_, err := ApplyClusterManager(ctx, c, cr.(*enterpriseApi.ClusterManager))
return true, err
}
splunkDeletionTester(t, revised, deleteFunc)
Expand Down

0 comments on commit 28694ae

Please sign in to comment.