Skip to content

Commit b8b7285

Browse files
committed
test
1 parent a8da5f4 commit b8b7285

File tree

2 files changed

+21
-35
lines changed

2 files changed

+21
-35
lines changed

pkg/splunk/enterprise/ingestorcluster.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func ApplyIngestorCluster(ctx context.Context, client client.Client, cr *enterpr
7272
// Update the CR Status
7373
defer updateCRStatus(ctx, client, cr, &err)
7474

75+
scopedLog.Info("TestKasia", "cr.Status.Replicas < cr.Spec.Replicas", cr.Status.Replicas < cr.Spec.Replicas)
7576
if cr.Status.Replicas < cr.Spec.Replicas {
7677
cr.Status.BusConfiguration = enterpriseApi.BusConfigurationSpec{}
7778
}
@@ -208,6 +209,7 @@ func ApplyIngestorCluster(ctx context.Context, client client.Client, cr *enterpr
208209
}
209210
cr.Status.Phase = phase
210211

212+
scopedLog.Info("TestKasia", "cr.Status.Phase == enterpriseApi.PhaseReady", cr.Status.Phase == enterpriseApi.PhaseReady)
211213
// No need to requeue if everything is ready
212214
if cr.Status.Phase == enterpriseApi.PhaseReady {
213215
// Bus config
@@ -225,7 +227,9 @@ func ApplyIngestorCluster(ctx context.Context, client client.Client, cr *enterpr
225227
return result, err
226228
}
227229
}
230+
scopedLog.Info("TestKasia", "busConfig", busConfig)
228231

232+
scopedLog.Info("TestKasia", "!reflect.DeepEqual(cr.Status.BusConfiguration, busConfig.Spec)", !reflect.DeepEqual(cr.Status.BusConfiguration, busConfig.Spec))
229233
// If bus config is updated
230234
if !reflect.DeepEqual(cr.Status.BusConfiguration, busConfig.Spec) {
231235
mgr := newIngestorClusterPodManager(scopedLog, cr, namespaceScopedSecret, splclient.NewSplunkClient)
@@ -312,7 +316,7 @@ func getIngestorStatefulSet(ctx context.Context, client splcommon.ControllerClie
312316
// Checks if only Bus or Pipeline config changed, and updates the conf file if so
313317
func (mgr *ingestorClusterPodManager) handlePushBusChange(ctx context.Context, newCR *enterpriseApi.IngestorCluster, busConfig enterpriseApi.BusConfiguration, k8s client.Client) error {
314318
// Only update config for pods that exist
315-
readyReplicas := newCR.Status.ReadyReplicas
319+
readyReplicas := newCR.Status.Replicas
316320

317321
// List all pods for this IngestorCluster StatefulSet
318322
var updateErr error

test/index_and_ingestion_separation/index_and_ingestion_separation_test.go

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -372,25 +372,29 @@ var _ = Describe("indingsep test", func() {
372372
testcaseEnvInst.Log.Info("Ensure that Indexer Cluster is in Ready phase")
373373
testenv.SingleSiteIndexersReady(ctx, deployment, testcaseEnvInst)
374374

375-
// Get instance of current Ingestor Cluster CR with latest config
376-
testcaseEnvInst.Log.Info("Get instance of current Ingestor Cluster CR with latest config")
377-
ingest := &enterpriseApi.IngestorCluster{}
378-
err = deployment.GetInstance(ctx, deployment.GetName()+"-ingest", ingest)
379-
Expect(err).To(Succeed(), "Failed to get instance of Ingestor Cluster")
380-
381-
// Update instance of Ingestor Cluster CR with new bus configuration
382-
testcaseEnvInst.Log.Info("Update instance of Ingestor Cluster CR with new bus configuration")
383-
ingest.Spec.BusConfigurationRef = v1.ObjectReference{Name: bc.Name}
384-
err = deployment.UpdateCR(ctx, ingest)
385-
Expect(err).To(Succeed(), "Unable to deploy Ingestor Cluster with updated CR")
375+
// Get instance of current Bus Configuration CR with latest config
376+
testcaseEnvInst.Log.Info("Get instance of current Bus Configuration CR with latest config")
377+
bus := &enterpriseApi.BusConfiguration{}
378+
err = deployment.GetInstance(ctx, bc.Name, bus)
379+
Expect(err).To(Succeed(), "Failed to get instance of Bus Configuration")
380+
381+
// Update instance of BusConfiguration CR with new bus configuration
382+
testcaseEnvInst.Log.Info("Update instance of BusConfiguration CR with new bus configuration")
383+
bus.Spec = updateBus
384+
err = deployment.UpdateCR(ctx, bus)
385+
Expect(err).To(Succeed(), "Unable to deploy Bus Configuration with updated CR")
386386

387387
// Ensure that Ingestor Cluster has not been restarted
388388
testcaseEnvInst.Log.Info("Ensure that Ingestor Cluster has not been restarted")
389389
testenv.IngestorReady(ctx, deployment, testcaseEnvInst)
390390

391+
// Ensure that Indexer Cluster has not been restarted
392+
testcaseEnvInst.Log.Info("Ensure that Indexer Cluster has not been restarted")
393+
testenv.SingleSiteIndexersReady(ctx, deployment, testcaseEnvInst)
394+
391395
// Get instance of current Ingestor Cluster CR with latest config
392396
testcaseEnvInst.Log.Info("Get instance of current Ingestor Cluster CR with latest config")
393-
ingest = &enterpriseApi.IngestorCluster{}
397+
ingest := &enterpriseApi.IngestorCluster{}
394398
err = deployment.GetInstance(ctx, deployment.GetName()+"-ingest", ingest)
395399
Expect(err).To(Succeed(), "Failed to get instance of Ingestor Cluster")
396400

@@ -404,22 +408,6 @@ var _ = Describe("indingsep test", func() {
404408
err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", index)
405409
Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster")
406410

407-
// Update instance of Indexer Cluster CR with new bus configuration
408-
testcaseEnvInst.Log.Info("Update instance of Indexer Cluster CR with new bus configuration")
409-
index.Spec.BusConfigurationRef = v1.ObjectReference{Name: bc.Name}
410-
err = deployment.UpdateCR(ctx, index)
411-
Expect(err).To(Succeed(), "Unable to deploy Indexer Cluster with updated CR")
412-
413-
// Ensure that Indexer Cluster has not been restarted
414-
testcaseEnvInst.Log.Info("Ensure that Indexer Cluster has not been restarted")
415-
testenv.SingleSiteIndexersReady(ctx, deployment, testcaseEnvInst)
416-
417-
// Get instance of current Indexer Cluster CR with latest config
418-
testcaseEnvInst.Log.Info("Get instance of current Indexer Cluster CR with latest config")
419-
index = &enterpriseApi.IndexerCluster{}
420-
err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", index)
421-
Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster")
422-
423411
// Verify Indexer Cluster Status
424412
testcaseEnvInst.Log.Info("Verify Indexer Cluster Status")
425413
Expect(index.Status.BusConfiguration).To(Equal(updateBus), "Indexer bus configuration status is not the same as provided as input")
@@ -468,12 +456,6 @@ var _ = Describe("indingsep test", func() {
468456
}
469457
}
470458

471-
// Get instance of current Indexer Cluster CR with latest config
472-
testcaseEnvInst.Log.Info("Get instance of current Indexer Cluster CR with latest config")
473-
index = &enterpriseApi.IndexerCluster{}
474-
err = deployment.GetInstance(ctx, deployment.GetName()+"-idxc", index)
475-
Expect(err).To(Succeed(), "Failed to get instance of Indexer Cluster")
476-
477459
// Verify conf files
478460
testcaseEnvInst.Log.Info("Verify conf files")
479461
pods = testenv.DumpGetPods(deployment.GetName())

0 commit comments

Comments
 (0)