Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ jobs:
run: .github/scripts/run_docker-tests
timeout-minutes: 60

- name: Tar Druid container logs
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: tar cvzf ./druid-container-logs.tgz ./embedded-tests/druid-container-logs

- name: Upload Druid container logs to GitHub
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: failure-druid-container-logs
path: druid-container-logs.tgz
- name: Collect docker logs on failure
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ public void beforeStart(EmbeddedDruidCluster cluster)
);

// Mount directories used by this container for easier debugging with service logs
this.containerDirectory = cluster.getTestFolder().getOrCreateFolder(name);
final File clusterDirectory = new File("druid-container-logs", cluster.getTestClassName());
this.containerDirectory = new File(clusterDirectory, name);
cleanDirectory(containerDirectory);

final File logDirectory = new File(containerDirectory, "log");
this.serviceLogsDirectory = new MountedDir(new File("/opt/druid/log"), logDirectory);
Expand All @@ -179,7 +181,7 @@ protected DruidContainer createContainer()

log.info(
"Starting Druid container[%s] with image[%s], exposed ports[%s] and mounted directory[%s].",
name, imageName, Arrays.toString(command.getExposedPorts()), containerDirectory
name, imageName, Arrays.toString(command.getExposedPorts()), containerDirectory.getAbsolutePath()
);

setCommonProperties(container);
Expand Down Expand Up @@ -235,6 +237,16 @@ private static void createLogDirectory(File dir)
}
}

private static void cleanDirectory(File dir)
{
try {
FileUtils.deleteDirectory(dir);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}

@Override
public String toString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected KinesisSupervisorSpec createKinesisSupervisor(KinesisResource kinesis,
Period.millis(10),
Period.millis(10),
true,
Period.seconds(5),
Period.seconds(60),
null, null, null, null, null, null, null, null,
false,
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class EmbeddedDruidCluster implements EmbeddedResource
private final List<Class<? extends DruidModule>> extensionModules = new ArrayList<>();
private final Properties commonProperties = new Properties();

private String testClassName;
private EmbeddedHostname embeddedHostname = EmbeddedHostname.localhost();
private boolean startedFirstDruidServer = false;

Expand Down Expand Up @@ -249,6 +250,16 @@ public EmbeddedDruidCluster useContainerFriendlyHostname()
return this;
}

public void setTestClassName(String testClassName)
{
this.testClassName = testClassName;
}

public String getTestClassName()
{
return testClassName;
}

/**
* Hostname to be used for embedded services (both Druid or external).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ protected static String getServerHttpsUrl(EmbeddedDruidServer<?> server)
protected void setup() throws Exception
{
cluster = createCluster();
cluster.setTestClassName(getClass().getSimpleName());
cluster.start();
}

Expand Down
Loading