Search in sources :

Example 1 with Version

use of com.walmartlabs.concord.plugins.packer.commands.Version in project concord-plugins by walmartlabs.

the class PackerTaskTest method valiateDownloadingNonDefaultVersionOfPacker.

@Test
public void valiateDownloadingNonDefaultVersionOfPacker() throws Exception {
    ToolInitializer toolInitializer = new ToolInitializer(new OKHttpDownloadManager("packer"));
    Map<String, ToolCommand> commands = ImmutableMap.of("packer/version", new Version());
    PackerTask task = new PackerTask(commands, toolInitializer);
    Map<String, Object> args = Maps.newHashMap(mapBuilder().put("version", "1.5.2").put("command", "version").put("saveOutput", true).build());
    Context context = context(args);
    task.execute(context);
    String expectedCommandLine = "packer version";
    assertThat(normalizedCommandLineArguments(context)).isEqualTo(expectedCommandLine);
    // Retrieve the logs from the context and assert we retrieved an alternate version
    assertThat(varAsString(context, "logs")).contains("Packer v1.5.2");
}
Also used : Context(com.walmartlabs.concord.sdk.Context) OKHttpDownloadManager(com.walmartlabs.concord.plugins.OKHttpDownloadManager) Version(com.walmartlabs.concord.plugins.packer.commands.Version) ToolInitializer(ca.vanzyl.concord.plugins.tool.ToolInitializer) ToolCommand(ca.vanzyl.concord.plugins.tool.ToolCommand) Test(org.junit.Test)

Aggregations

ToolCommand (ca.vanzyl.concord.plugins.tool.ToolCommand)1 ToolInitializer (ca.vanzyl.concord.plugins.tool.ToolInitializer)1 OKHttpDownloadManager (com.walmartlabs.concord.plugins.OKHttpDownloadManager)1 Version (com.walmartlabs.concord.plugins.packer.commands.Version)1 Context (com.walmartlabs.concord.sdk.Context)1 Test (org.junit.Test)1