@@ -152,7 +152,7 @@ def compose_up(self):
152152 def get_number_of_containers (self , filename ):
153153 yml = {}
154154 with open (filename , "r" ) as f :
155- yml = yaml .load (f )
155+ yml = yaml .load (f , Loader = yaml . Loader )
156156 return len (yml ["services" ])
157157
158158 def wait_for_containers (self , count , label = None , name = None , timeout = 300 ):
@@ -2553,10 +2553,18 @@ def test_compose_1deployment1cm(self):
25532553 exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunk/etc/apps/splunk_app_example/local/" , user = "splunk" )
25542554 std_out = self .client .exec_start (exec_command )
25552555 assert "savedsearches.conf" in std_out
2556+ assert "app.conf" in std_out
2557+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/apps/splunk_app_example/local/app.conf" , user = "splunk" )
2558+ std_out = self .client .exec_start (exec_command )
2559+ assert "state = disabled" in std_out
25562560 # Check that the app exists in etc/deployment-apps
25572561 exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunk/etc/deployment-apps/splunk_app_example/local/" , user = "splunk" )
25582562 std_out = self .client .exec_start (exec_command )
2559- assert "savedsearches.conf" not in std_out
2563+ assert "savedsearches.conf" in std_out
2564+ assert "app.conf" in std_out
2565+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/deployment-apps/splunk_app_example/local/app.conf" , user = "splunk" )
2566+ std_out = self .client .exec_start (exec_command )
2567+ assert "# Autogenerated file " == std_out
25602568 if container_name == "cm1" :
25612569 # Check if the created file exists
25622570 exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/users/admin/user-prefs/local/user-prefs.conf" , user = "splunk" )
@@ -2575,6 +2583,14 @@ def test_compose_1deployment1cm(self):
25752583 status , content = self .handle_request_retry ("GET" , url , kwargs )
25762584 assert status == 200
25772585 assert json .loads (content )["entry" ][0 ]["content" ]["version" ] == "0.0.1"
2586+ exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunk/etc/apps/splunk_app_example/local/" , user = "splunk" )
2587+ std_out = self .client .exec_start (exec_command )
2588+ assert "savedsearches.conf" in std_out
2589+ assert "app.conf" in std_out
2590+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/apps/splunk_app_example/local/app.conf" , user = "splunk" )
2591+ std_out = self .client .exec_start (exec_command )
2592+ assert "# Autogenerated file" in std_out
2593+ assert "state = enabled" in std_out
25782594 except Exception as e :
25792595 self .logger .error (e )
25802596 if i < RETRIES - 1 :
@@ -2632,10 +2648,18 @@ def test_compose_1deployment1so(self):
26322648 exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunk/etc/apps/splunk_app_example/local/" , user = "splunk" )
26332649 std_out = self .client .exec_start (exec_command )
26342650 assert "savedsearches.conf" in std_out
2651+ assert "app.conf" in std_out
2652+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/apps/splunk_app_example/local/app.conf" , user = "splunk" )
2653+ std_out = self .client .exec_start (exec_command )
2654+ assert "state = disabled" in std_out
26352655 # Check that the app exists in etc/deployment-apps
26362656 exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunk/etc/deployment-apps/splunk_app_example/local/" , user = "splunk" )
26372657 std_out = self .client .exec_start (exec_command )
2638- assert "savedsearches.conf" not in std_out
2658+ assert "savedsearches.conf" in std_out
2659+ assert "app.conf" in std_out
2660+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/deployment-apps/splunk_app_example/local/app.conf" , user = "splunk" )
2661+ std_out = self .client .exec_start (exec_command )
2662+ assert "# Autogenerated file " == std_out
26392663 if container_name == "so1" :
26402664 RETRIES = 5
26412665 for i in range (RETRIES ):
@@ -2646,6 +2670,14 @@ def test_compose_1deployment1so(self):
26462670 status , content = self .handle_request_retry ("GET" , url , kwargs )
26472671 assert status == 200
26482672 assert json .loads (content )["entry" ][0 ]["content" ]["version" ] == "0.0.1"
2673+ exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunk/etc/apps/splunk_app_example/local/" , user = "splunk" )
2674+ std_out = self .client .exec_start (exec_command )
2675+ assert "savedsearches.conf" in std_out
2676+ assert "app.conf" in std_out
2677+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/apps/splunk_app_example/local/app.conf" , user = "splunk" )
2678+ std_out = self .client .exec_start (exec_command )
2679+ assert "# Autogenerated file" in std_out
2680+ assert "state = enabled" in std_out
26492681 except Exception as e :
26502682 self .logger .error (e )
26512683 if i < RETRIES - 1 :
@@ -2703,10 +2735,18 @@ def test_compose_1deployment1uf(self):
27032735 exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunk/etc/apps/splunk_app_example/local/" , user = "splunk" )
27042736 std_out = self .client .exec_start (exec_command )
27052737 assert "savedsearches.conf" in std_out
2738+ assert "app.conf" in std_out
2739+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/apps/splunk_app_example/local/app.conf" , user = "splunk" )
2740+ std_out = self .client .exec_start (exec_command )
2741+ assert "state = disabled" in std_out
27062742 # Check that the app exists in etc/deployment-apps
27072743 exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunk/etc/deployment-apps/splunk_app_example/local/" , user = "splunk" )
27082744 std_out = self .client .exec_start (exec_command )
2709- assert "savedsearches.conf" not in std_out
2745+ assert "savedsearches.conf" in std_out
2746+ assert "app.conf" in std_out
2747+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunk/etc/deployment-apps/splunk_app_example/local/app.conf" , user = "splunk" )
2748+ std_out = self .client .exec_start (exec_command )
2749+ assert "# Autogenerated file " == std_out
27102750 if container_name == "uf1" :
27112751 RETRIES = 5
27122752 for i in range (RETRIES ):
@@ -2717,6 +2757,14 @@ def test_compose_1deployment1uf(self):
27172757 status , content = self .handle_request_retry ("GET" , url , kwargs )
27182758 assert status == 200
27192759 assert json .loads (content )["entry" ][0 ]["content" ]["version" ] == "0.0.1"
2760+ exec_command = self .client .exec_create (container ["Id" ], "ls /opt/splunkforwarder/etc/apps/splunk_app_example/local/" , user = "splunk" )
2761+ std_out = self .client .exec_start (exec_command )
2762+ assert "savedsearches.conf" in std_out
2763+ assert "app.conf" in std_out
2764+ exec_command = self .client .exec_create (container ["Id" ], "cat /opt/splunkforwarder/etc/apps/splunk_app_example/local/app.conf" , user = "splunk" )
2765+ std_out = self .client .exec_start (exec_command )
2766+ assert "# Autogenerated file" in std_out
2767+ assert "state = enabled" in std_out
27202768 except Exception as e :
27212769 self .logger .error (e )
27222770 if i < RETRIES - 1 :
0 commit comments