Skip to content

Commit

Permalink
Add additional devc properties to metadata file (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbsox authored Oct 31, 2023
1 parent d5b02e9 commit 1172cbb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5701,13 +5701,22 @@ public void writeDevcMetadata(boolean alive) {
metadataWriter.writeStartElement("devcModeMetaData");
writeElement(metadataWriter, "containerEngine", isDocker ? DEVC_CONTAINER_DOCKER : DEVC_CONTAINER_PODMAN);
writeElement(metadataWriter, "containerName", containerName != null ? containerName : DEVMODE_CONTAINER_BASE_NAME);
writeElement(metadataWriter, "imageName", imageName);
if (containerfile != null) {
writeElement(metadataWriter, "containerfile", containerfile.getCanonicalPath());
}
if (containerBuildContext != null) {
writeElement(metadataWriter, "containerBuildContext", containerBuildContext.getCanonicalPath());
}
writeElement(metadataWriter, "containerAlive", String.valueOf(alive));
writeElement(metadataWriter, "containerBuildTimeout", Integer.toString(containerBuildTimeout));
writeElement(metadataWriter, "containerRunOpts", containerRunOpts);
metadataWriter.writeEndElement();
metadataWriter.writeEndDocument();
metadataWriter.flush();
metadataWriter.close();
} catch (Exception e) {
warn("Failed to write metadata.");
warn("Failed to write metadata.\n" + e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,18 @@ public void testWriteDevcMetadataSimple() throws XMLStreamException, FactoryConf
String content = FileUtils.readFileToString(metaDataXml, "UTF-8");
assertTrue(content.contains("<containerName>liberty-dev</containerName"));
assertTrue(content.contains("<containerAlive>true</containerAlive>"));
assertTrue(content.contains("<containerBuildTimeout>600</containerBuildTimeout>"));
assertTrue(content.contains("<containerEngine>docker</containerEngine>"));
assertTrue(content.contains("<containerRunOpts></containerRunOpts>"));
assertTrue(content.contains("<imageName></imageName>"));

util.writeDevcMetadata(false);
content = FileUtils.readFileToString(metaDataXml, "UTF-8");
assertTrue(content.contains("<containerName>liberty-dev</containerName"));
assertTrue(content.contains("<containerAlive>false</containerAlive>"));
assertTrue(content.contains("<containerBuildTimeout>600</containerBuildTimeout>"));
assertTrue(content.contains("<containerEngine>docker</containerEngine>"));
assertTrue(content.contains("<containerRunOpts></containerRunOpts>"));
assertTrue(content.contains("<imageName></imageName>"));
}
}

0 comments on commit 1172cbb

Please sign in to comment.