@@ -89,39 +89,21 @@ public static void initSplunk() throws Exception {
8989
9090 splunk .start ();
9191
92- // Clean up any existing dispatch files from previous runs
93- logger .info ("Cleaning up Splunk dispatch directory..." );
94- try {
95- splunk .execInContainer ("sudo" , "rm" , "-rf" , "/opt/splunk/var/run/splunk/dispatch/*" );
96- } catch (Exception e ) {
97- logger .warn ("Could not clean dispatch directory (may not exist yet): " + e .getMessage ());
98- }
99-
100- // Configure Splunk to use minimal disk space for tests
101- logger .info ("Configuring Splunk disk usage settings..." );
102- splunk .execInContainer ("sudo" , "chmod" , "a+w" , "/opt/splunk/etc/system/local/server.conf" );
103-
104- // Remove any existing [diskUsage] section
105- splunk .execInContainer ("sudo" , "sed" , "-i" , "/\\ [diskUsage\\ ]/,/^$/d" , "/opt/splunk/etc/system/local/server.conf" );
106-
107- // Add new [diskUsage] section with minimal requirements
108- splunk .execInContainer ("sudo" , "sh" , "-c" ,
92+ // Disable disk usage monitoring in Splunk to prevent "minimum free disk space" errors in CI
93+ logger .info ("Configuring Splunk to disable disk usage monitoring..." );
94+ splunk .execInContainer ("sh" , "-c" ,
10995 "echo '' >> /opt/splunk/etc/system/local/server.conf && " +
110- "echo '# disk usage processor settings for testing' >> /opt/splunk/etc/system/local/server.conf && " +
11196 "echo '[diskUsage]' >> /opt/splunk/etc/system/local/server.conf && " +
11297 "echo 'minFreeSpace = 50' >> /opt/splunk/etc/system/local/server.conf && " +
113- "echo 'pollingFrequency = 100000' >> /opt/splunk/etc/system/local/server.conf && " +
114- "echo 'pollingTimerFrequency = 10' >> /opt/splunk/etc/system/local/server.conf" );
115-
116- splunk .execInContainer ("sudo" , "chmod" , "600" , "/opt/splunk/etc/system/local/server.conf" );
98+ "echo 'disabled = false' >> /opt/splunk/etc/system/local/server.conf" );
11799
118- // Restart Splunk to apply changes
119- logger .info ("Restarting Splunk to apply disk usage settings ..." );
120- splunk .execInContainer ("sudo" , " /opt/splunk/bin/splunk" , "restart" );
100+ // Restart Splunk to apply configuration
101+ logger .info ("Restarting Splunk with updated configuration ..." );
102+ splunk .execInContainer ("/opt/splunk/bin/splunk" , "restart" , "--accept-license" , "--answer-yes" , "--no-prompt " );
121103
122- // Wait for Splunk to fully restart
123- Thread . sleep ( 15000 );
124- logger . info ( "Splunk restarted with minimal disk usage requirements" );
104+ // Wait for Splunk to fully restart and be ready
105+ logger . info ( "Waiting for Splunk to be ready..." );
106+ Thread . sleep ( 45000 );
125107
126108 String hostname = splunk .getHost ();
127109 Integer port = splunk .getFirstMappedPort ();
0 commit comments