Skip to content

Commit

Permalink
Add gradle tests for native image build
Browse files Browse the repository at this point in the history
  • Loading branch information
kdubois authored and gsmet committed Jan 9, 2023
1 parent 4c5a39f commit b8479af
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.quarkus.cli.image;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
Expand Down Expand Up @@ -94,6 +95,10 @@ public void testUsage() throws Exception {
// 1 image --dry-run
result = CliDriver.execute(project, "image", "--dry-run");
assertEquals(CommandLine.ExitCode.OK, result.getExitCode(), "Expected OK return code." + result);
assertFalse(result.getStdout().contains("-Dquarkus.package.type=native"));
result = CliDriver.execute(project, "image", "--native", "--dry-run");
assertEquals(CommandLine.ExitCode.OK, result.getExitCode(), "Expected OK return code." + result);
assertTrue(result.getStdout().contains("-Dquarkus.package.type=native"));

// 2 image build --dry-run
result = CliDriver.execute(project, "image", "build", "--dry-run");
Expand Down Expand Up @@ -121,11 +126,13 @@ public void testUsage() throws Exception {
assertTrue(result.getStdout().contains("--builder=openshift"));
assertTrue(result.getStdout().contains("--init-script="));

result = CliDriver.execute(project, "image", "build", "--group=mygroup", "--name=myname", "--tag=1.0", "--dry-run");
result = CliDriver.execute(project, "image", "build", "--group=mygroup", "--name=myname", "--tag=1.0", "--native",
"--dry-run");
assertEquals(CommandLine.ExitCode.OK, result.getExitCode(), "Expected OK return code." + result);
assertTrue(result.getStdout().contains("-Dquarkus.container-image.group=mygroup"));
assertTrue(result.getStdout().contains("-Dquarkus.container-image.name=myname"));
assertTrue(result.getStdout().contains("-Dquarkus.container-image.tag=1.0"));
assertTrue(result.getStdout().contains("-Dquarkus.package.type=native"));

// 3 image push --dry-run
result = CliDriver.execute(project, "image", "push", "--dry-run");
Expand Down

0 comments on commit b8479af

Please sign in to comment.