Skip to content

Commit 6f543e5

Browse files
author
Shakeel Mohamed
committed
fix uploadtest
1 parent bc056ab commit 6f543e5

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/com/splunk/UploadTest.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,27 @@
1818

1919
import org.junit.Test;
2020

21+
import java.io.File;
22+
import java.io.FileWriter;
23+
import java.io.IOException;
24+
import java.util.Date;
25+
2126
public class UploadTest extends SDKTestCase {
2227
@Test
23-
public void testOneshot() throws InterruptedException {
24-
// Slow down for CI to wait for splunkd.log to exist
25-
Thread.sleep(8000);
26-
28+
public void testOneshot() throws IOException {
2729
String filename = locateSystemLog();
28-
if (System.getenv("SPLUNK_HOME") != null) {
30+
if (System.getenv("TRAVIS_CI") != null) {
31+
File tempfile = File.createTempFile((new Date()).toString(), "");
32+
tempfile.deleteOnExit();
33+
34+
FileWriter f = new FileWriter(tempfile, true);
35+
f.append("some data here");
36+
37+
filename = tempfile.getAbsolutePath();
38+
}
39+
else if (System.getenv("SPLUNK_HOME") != null) {
2940
filename = System.getenv("SPLUNK_HOME") + "/var/log/splunk/splunkd.log";
3041
}
31-
3242
service.getUploads().create(filename);
3343

3444
for (Upload oneshot : service.getUploads().values()) {

0 commit comments

Comments
 (0)