@@ -101,6 +101,20 @@ var _ = Describe("indingsep test", func() {
101101 // Ensure that Indexer Cluster is in Ready phase
102102 testcaseEnvInst .Log .Info ("Ensure that Indexer Cluster is in Ready phase" )
103103 testenv .SingleSiteIndexersReady (ctx , deployment , testcaseEnvInst )
104+
105+ // Delete the Indexer Cluster
106+ idxc := & enterpriseApi.IndexerCluster {}
107+ err = deployment .GetInstance (ctx , deployment .GetName ()+ "-idxc" , idxc )
108+ Expect (err ).To (Succeed (), "Unable to get Indexer Cluster instance" , "Indexer Cluster Name" , idxc )
109+ err = deployment .DeleteCR (ctx , idxc )
110+ Expect (err ).To (Succeed (), "Unable to delete Indexer Cluster instance" , "Indexer Cluster Name" , idxc )
111+
112+ // Delete the Ingestor Cluster
113+ ingest := & enterpriseApi.IngestorCluster {}
114+ err = deployment .GetInstance (ctx , deployment .GetName ()+ "-ingest" , ingest )
115+ Expect (err ).To (Succeed (), "Unable to get Ingestor Cluster instance" , "Ingestor Cluster Name" , ingest )
116+ err = deployment .DeleteCR (ctx , ingest )
117+ Expect (err ).To (Succeed (), "Unable to delete Ingestor Cluster instance" , "Ingestor Cluster Name" , ingest )
104118 })
105119 })
106120
@@ -171,33 +185,240 @@ var _ = Describe("indingsep test", func() {
171185 outputsPath := "opt/splunk/etc/system/local/outputs.conf"
172186 outputsConf , err := testenv .GetConfFile (pod , outputsPath , deployment .GetName ())
173187 Expect (err ).To (Succeed (), "Failed to get outputs.conf from Ingestor Cluster pod" )
174- testenv .ValidateConfFileContent (outputsConf , outputs )
188+ testenv .ValidateContent (outputsConf , outputs , true )
189+
190+ // Verify default-mode.conf
191+ testcaseEnvInst .Log .Info ("Verify default-mode.conf" )
192+ defaultsPath := "opt/splunk/etc/system/local/default-mode.conf"
193+ defaultsConf , err := testenv .GetConfFile (pod , defaultsPath , deployment .GetName ())
194+ Expect (err ).To (Succeed (), "Failed to get default-mode.conf from Ingestor Cluster pod" )
195+ testenv .ValidateContent (defaultsConf , defaultsAll , true )
196+
197+ // Verify AWS env variables
198+ testcaseEnvInst .Log .Info ("Verify AWS env variables" )
199+ envVars , err := testenv .GetAWSEnv (pod , deployment .GetName ())
200+ Expect (err ).To (Succeed (), "Failed to get AWS env variables from Ingestor Cluster pod" )
201+ testenv .ValidateContent (envVars , awsEnvVars , true )
202+ }
203+
204+ if strings .Contains (pod , "ingest" ) {
205+ // Verify default-mode.conf
206+ testcaseEnvInst .Log .Info ("Verify default-mode.conf" )
207+ testenv .ValidateContent (defaultsConf , defaultsIngest , true )
208+ } else if strings .Contains (pod , "idxc" ) {
209+ // Verify inputs.conf
210+ testcaseEnvInst .Log .Info ("Verify inputs.conf" )
211+ inputsPath := "opt/splunk/etc/system/local/inputs.conf"
212+ inputsConf , err := testenv .GetConfFile (pod , inputsPath , deployment .GetName ())
213+ Expect (err ).To (Succeed (), "Failed to get inputs.conf from Indexer Cluster pod" )
214+ testenv .ValidateContent (inputsConf , inputs , true )
215+ }
216+ }
217+ })
218+ })
219+
220+ Context ("Ingestor and Indexer deployment" , func () {
221+ It ("indingsep, integration, indingsep: Splunk Operator can update Ingestors and Indexers with correct setup" , func () {
222+ // Create Service Account
223+ testcaseEnvInst .Log .Info ("Create Service Account" )
224+ testcaseEnvInst .CreateServiceAccount (serviceAccountName )
225+
226+ // Deploy Ingestor Cluster
227+ testcaseEnvInst .Log .Info ("Deploy Ingestor Cluster" )
228+ _ , err := deployment .DeployIngestorCluster (ctx , deployment .GetName ()+ "-ingest" , 3 , bus , pipelineConfig , serviceAccountName )
229+ Expect (err ).To (Succeed (), "Unable to deploy Ingestor Cluster" )
230+
231+ // Deploy Cluster Manager
232+ testcaseEnvInst .Log .Info ("Deploy Cluster Manager" )
233+ _ , err = deployment .DeployClusterManagerWithGivenSpec (ctx , deployment .GetName (), cmSpec )
234+ Expect (err ).To (Succeed (), "Unable to deploy Cluster Manager" )
235+
236+ // Deploy Indexer Cluster
237+ testcaseEnvInst .Log .Info ("Deploy Indexer Cluster" )
238+ _ , err = deployment .DeployIndexerCluster (ctx , deployment .GetName ()+ "-idxc" , "" , 3 , deployment .GetName (), "" , bus , pipelineConfig , serviceAccountName )
239+ Expect (err ).To (Succeed (), "Unable to deploy Indexer Cluster" )
240+
241+ // Ensure that Ingestor Cluster is in Ready phase
242+ testcaseEnvInst .Log .Info ("Ensure that Ingestor Cluster is in Ready phase" )
243+ testenv .IngestorReady (ctx , deployment , testcaseEnvInst )
244+
245+ // Ensure that Cluster Manager is in Ready phase
246+ testcaseEnvInst .Log .Info ("Ensure that Cluster Manager is in Ready phase" )
247+ testenv .ClusterManagerReady (ctx , deployment , testcaseEnvInst )
248+
249+ // Ensure that Indexer Cluster is in Ready phase
250+ testcaseEnvInst .Log .Info ("Ensure that Indexer Cluster is in Ready phase" )
251+ testenv .SingleSiteIndexersReady (ctx , deployment , testcaseEnvInst )
252+
253+ // Get instance of current Ingestor Cluster CR with latest config
254+ testcaseEnvInst .Log .Info ("Get instance of current Ingestor Cluster CR with latest config" )
255+ ingest := & enterpriseApi.IngestorCluster {}
256+ err = deployment .GetInstance (ctx , deployment .GetName ()+ "-ingest" , ingest )
257+ Expect (err ).To (Succeed (), "Failed to get instance of Ingestor Cluster" )
258+
259+ // Update instance of Ingestor Cluster CR with new pushbus config
260+ testcaseEnvInst .Log .Info ("Update instance of Ingestor Cluster CR with new pushbus config" )
261+ ingest .Spec .PushBus = updateBus
262+ err = deployment .UpdateCR (ctx , ingest )
263+ Expect (err ).To (Succeed (), "Unable to deploy Ingestor Cluster with updated CR" )
264+
265+ // Verify Ingestor Cluster Status
266+ testcaseEnvInst .Log .Info ("Verify Ingestor Cluster Status" )
267+ Expect (ingest .Status .PushBus ).To (Equal (updateBus ), "Ingestor PushBus status is not the same as provided as input" )
268+ Expect (ingest .Status .PipelineConfig ).To (Equal (pipelineConfig ), "Ingestor PipelineConfig status is not the same as provided as input" )
269+
270+ // Ensure that Ingestor Cluster has not been restarted
271+ testcaseEnvInst .Log .Info ("Ensure that Ingestor Cluster has not been restarted" )
272+ testenv .IngestorReady (ctx , deployment , testcaseEnvInst )
273+
274+ // Get instance of current Indexer Cluster CR with latest config
275+ testcaseEnvInst .Log .Info ("Get instance of current Indexer Cluster CR with latest config" )
276+ index := & enterpriseApi.IndexerCluster {}
277+ err = deployment .GetInstance (ctx , deployment .GetName ()+ "-idxc" , index )
278+ Expect (err ).To (Succeed (), "Failed to get instance of Indexer Cluster" )
279+
280+ // Update instance of Indexer Cluster CR with new pullbus config
281+ testcaseEnvInst .Log .Info ("Update instance of Indexer Cluster CR with new pullbus config" )
282+ index .Spec .PullBus = updateBus
283+ err = deployment .UpdateCR (ctx , index )
284+ Expect (err ).To (Succeed (), "Unable to deploy Indexer Cluster with updated CR" )
285+
286+ // Verify Indexer Cluster Status
287+ testcaseEnvInst .Log .Info ("Verify Indexer Cluster Status" )
288+ Expect (index .Status .PullBus ).To (Equal (updateBus ), "Indexer PullBus status is not the same as provided as input" )
289+ Expect (index .Status .PipelineConfig ).To (Equal (pipelineConfig ), "Indexer PipelineConfig status is not the same as provided as input" )
290+
291+ // Ensure that Indexer Cluster has not been restarted
292+ testcaseEnvInst .Log .Info ("Ensure that Indexer Cluster has not been restarted" )
293+ testenv .SingleSiteIndexersReady (ctx , deployment , testcaseEnvInst )
294+
295+ // Verify conf files
296+ testcaseEnvInst .Log .Info ("Verify conf files" )
297+ pods := testenv .DumpGetPods (deployment .GetName ())
298+ for _ , pod := range pods {
299+ defaultsConf := ""
300+
301+ if strings .Contains (pod , "ingest" ) || strings .Contains (pod , "idxc" ) {
302+ // Verify outputs.conf
303+ testcaseEnvInst .Log .Info ("Verify outputs.conf" )
304+ outputsPath := "opt/splunk/etc/system/local/outputs.conf"
305+ outputsConf , err := testenv .GetConfFile (pod , outputsPath , deployment .GetName ())
306+ Expect (err ).To (Succeed (), "Failed to get outputs.conf from Ingestor Cluster pod" )
307+ testenv .ValidateContent (outputsConf , updatedOutputs , true )
308+ testenv .ValidateContent (outputsConf , outputsShouldNotContain , false )
309+
310+ // Verify default-mode.conf
311+ testcaseEnvInst .Log .Info ("Verify default-mode.conf" )
312+ defaultsPath := "opt/splunk/etc/system/local/default-mode.conf"
313+ defaultsConf , err := testenv .GetConfFile (pod , defaultsPath , deployment .GetName ())
314+ Expect (err ).To (Succeed (), "Failed to get default-mode.conf from Ingestor Cluster pod" )
315+ testenv .ValidateContent (defaultsConf , defaultsAll , true )
316+
317+ // Verify AWS env variables
318+ testcaseEnvInst .Log .Info ("Verify AWS env variables" )
319+ envVars , err := testenv .GetAWSEnv (pod , deployment .GetName ())
320+ Expect (err ).To (Succeed (), "Failed to get AWS env variables from Ingestor Cluster pod" )
321+ testenv .ValidateContent (envVars , awsEnvVars , true )
322+ }
323+
324+ if strings .Contains (pod , "ingest" ) {
325+ // Verify default-mode.conf
326+ testcaseEnvInst .Log .Info ("Verify default-mode.conf" )
327+ testenv .ValidateContent (defaultsConf , defaultsIngest , true )
328+ } else if strings .Contains (pod , "idxc" ) {
329+ // Verify inputs.conf
330+ testcaseEnvInst .Log .Info ("Verify inputs.conf" )
331+ inputsPath := "opt/splunk/etc/system/local/inputs.conf"
332+ inputsConf , err := testenv .GetConfFile (pod , inputsPath , deployment .GetName ())
333+ Expect (err ).To (Succeed (), "Failed to get inputs.conf from Indexer Cluster pod" )
334+ testenv .ValidateContent (inputsConf , updatedInputs , true )
335+ testenv .ValidateContent (inputsConf , inputsShouldNotContain , false )
336+ }
337+ }
338+
339+ // Get instance of current Ingestor Cluster CR with latest config
340+ testcaseEnvInst .Log .Info ("Get instance of current Ingestor Cluster CR with latest config" )
341+ ingest = & enterpriseApi.IngestorCluster {}
342+ err = deployment .GetInstance (ctx , deployment .GetName ()+ "-ingest" , ingest )
343+ Expect (err ).To (Succeed (), "Failed to get instance of Ingestor Cluster" )
344+
345+ // Update instance of Ingestor Cluster CR with new pipelineconfig config
346+ testcaseEnvInst .Log .Info ("Update instance of Ingestor Cluster CR with new pipelineconfig config" )
347+ ingest .Spec .PipelineConfig = updatePipelineConfig
348+ err = deployment .UpdateCR (ctx , ingest )
349+ Expect (err ).To (Succeed (), "Unable to deploy Ingestor Cluster with updated CR" )
350+
351+ // Verify Ingestor Cluster Status
352+ testcaseEnvInst .Log .Info ("Verify Ingestor Cluster Status" )
353+ Expect (ingest .Status .PushBus ).To (Equal (updateBus ), "Ingestor PushBus status is not the same as provided as input" )
354+ Expect (ingest .Status .PipelineConfig ).To (Equal (updatePipelineConfig ), "Ingestor PipelineConfig status is not the same as provided as input" )
355+
356+ // Ensure that Ingestor Cluster has not been restarted
357+ testcaseEnvInst .Log .Info ("Ensure that Ingestor Cluster has not been restarted" )
358+ testenv .IngestorReady (ctx , deployment , testcaseEnvInst )
359+
360+ // Get instance of current Indexer Cluster CR with latest config
361+ testcaseEnvInst .Log .Info ("Get instance of current Indexer Cluster CR with latest config" )
362+ index = & enterpriseApi.IndexerCluster {}
363+ err = deployment .GetInstance (ctx , deployment .GetName ()+ "-idxc" , index )
364+ Expect (err ).To (Succeed (), "Failed to get instance of Indexer Cluster" )
365+
366+ // Update instance of Indexer Cluster CR with new pipelineconfig config
367+ testcaseEnvInst .Log .Info ("Update instance of Indexer Cluster CR with new pipelineconfig config" )
368+ index .Spec .PipelineConfig = updatePipelineConfig
369+ err = deployment .UpdateCR (ctx , index )
370+ Expect (err ).To (Succeed (), "Unable to deploy Indexer Cluster with updated CR" )
371+
372+ // Verify Indexer Cluster Status
373+ testcaseEnvInst .Log .Info ("Verify Indexer Cluster Status" )
374+ Expect (index .Status .PullBus ).To (Equal (updateBus ), "Indexer PullBus status is not the same as provided as input" )
375+ Expect (index .Status .PipelineConfig ).To (Equal (updatePipelineConfig ), "Indexer PipelineConfig status is not the same as provided as input" )
376+
377+ // Ensure that Indexer Cluster has not been restarted
378+ testcaseEnvInst .Log .Info ("Ensure that Indexer Cluster has not been restarted" )
379+ testenv .SingleSiteIndexersReady (ctx , deployment , testcaseEnvInst )
380+
381+ // Verify conf files
382+ testcaseEnvInst .Log .Info ("Verify conf files" )
383+ pods = testenv .DumpGetPods (deployment .GetName ())
384+ for _ , pod := range pods {
385+ defaultsConf := ""
386+
387+ if strings .Contains (pod , "ingest" ) || strings .Contains (pod , "idxc" ) {
388+ // Verify outputs.conf
389+ testcaseEnvInst .Log .Info ("Verify outputs.conf" )
390+ outputsPath := "opt/splunk/etc/system/local/outputs.conf"
391+ outputsConf , err := testenv .GetConfFile (pod , outputsPath , deployment .GetName ())
392+ Expect (err ).To (Succeed (), "Failed to get outputs.conf from Ingestor Cluster pod" )
393+ testenv .ValidateContent (outputsConf , updatedOutputs , true )
394+ testenv .ValidateContent (outputsConf , outputsShouldNotContain , false )
175395
176396 // Verify default-mode.conf
177397 testcaseEnvInst .Log .Info ("Verify default-mode.conf" )
178398 defaultsPath := "opt/splunk/etc/system/local/default-mode.conf"
179399 defaultsConf , err := testenv .GetConfFile (pod , defaultsPath , deployment .GetName ())
180400 Expect (err ).To (Succeed (), "Failed to get default-mode.conf from Ingestor Cluster pod" )
181- testenv .ValidateConfFileContent (defaultsConf , defaultsAll )
401+ testenv .ValidateContent (defaultsConf , updatedDefaultsAll , true )
182402
183403 // Verify AWS env variables
184404 testcaseEnvInst .Log .Info ("Verify AWS env variables" )
185405 envVars , err := testenv .GetAWSEnv (pod , deployment .GetName ())
186406 Expect (err ).To (Succeed (), "Failed to get AWS env variables from Ingestor Cluster pod" )
187- testenv .ValidateConfFileContent (envVars , awsEnvVars )
407+ testenv .ValidateContent (envVars , awsEnvVars , true )
188408 }
189409
190410 if strings .Contains (pod , "ingest" ) {
191411 // Verify default-mode.conf
192412 testcaseEnvInst .Log .Info ("Verify default-mode.conf" )
193- testenv .ValidateConfFileContent (defaultsConf , defaultsIngest )
413+ testenv .ValidateContent (defaultsConf , updatedDefaultsIngest , true )
194414 } else if strings .Contains (pod , "idxc" ) {
195415 // Verify inputs.conf
196416 testcaseEnvInst .Log .Info ("Verify inputs.conf" )
197417 inputsPath := "opt/splunk/etc/system/local/inputs.conf"
198418 inputsConf , err := testenv .GetConfFile (pod , inputsPath , deployment .GetName ())
199419 Expect (err ).To (Succeed (), "Failed to get inputs.conf from Indexer Cluster pod" )
200- testenv .ValidateConfFileContent (inputsConf , inputs )
420+ testenv .ValidateContent (inputsConf , updatedInputs , true )
421+ testenv .ValidateContent (inputsConf , inputsShouldNotContain , false )
201422 }
202423 }
203424 })
0 commit comments