Report missing Docker clearly and preserve CI attempt setup
Some checks failed
Build, test and publish / verify (push) Failing after 3m9s
Some checks failed
Build, test and publish / verify (push) Failing after 3m9s
This commit is contained in:
@@ -82,6 +82,14 @@ class CiTests {
|
||||
test("Older commit cannot move main", () -> {
|
||||
try (Fixture f = new Fixture()) { f.fake.head = "c".repeat(40); f.pipeline.publish(); equal(2L,f.calls("push")); }
|
||||
});
|
||||
test("Unavailable Docker fails before build with a concrete cause", () -> {
|
||||
try (Fixture f = new Fixture()) {
|
||||
f.fake.dockerAvailable = false;
|
||||
try { f.pipeline.verify(); throw new AssertionError("Expected failure"); }
|
||||
catch (IllegalArgumentException error) { equal(true,error.getMessage().contains("Docker is unavailable")); }
|
||||
equal(0L,f.fake.calls.stream().filter(a -> a.getFirst().equals("mvn")).count());
|
||||
}
|
||||
});
|
||||
test("Architecture mismatch blocks publication", () -> {
|
||||
try (Fixture f = new Fixture()) { f.pipeline.env.put("TARGET_PLATFORM","linux/arm64"); failure(f.pipeline::publish); equal(0L,f.calls("push")); }
|
||||
});
|
||||
@@ -128,6 +136,7 @@ class CiTests {
|
||||
final Map<String,String> images = new HashMap<>(), tags = new HashMap<>();
|
||||
String head = SHA, pushFailure = "", pullFailure = "";
|
||||
boolean manifestError, mavenFailure;
|
||||
boolean dockerAvailable = true;
|
||||
FakeCommands() { super(Duration.ofMinutes(1)); }
|
||||
@Override Result execute(List<String> args, Path cwd, Map<String,String> env, String input, boolean echo) {
|
||||
calls.add(List.copyOf(args));
|
||||
@@ -135,7 +144,7 @@ class CiTests {
|
||||
if (args.getFirst().equals("mvn") && mavenFailure) return new Result(42,"deliberate failure");
|
||||
if (!args.getFirst().equals("docker")) return new Result(0,"");
|
||||
String command = args.get(1), ref = args.getLast();
|
||||
if (command.equals("info")) return new Result(0,args.contains("{{.Architecture}}") ? "amd64" : "linux");
|
||||
if (command.equals("info")) return new Result(dockerAvailable ? 0 : 1,args.contains("{{.Architecture}}") ? "amd64" : "linux");
|
||||
if (command.equals("context")) return new Result(0,"unix:///tmp/test-docker.sock");
|
||||
if (command.equals("manifest")) {
|
||||
if (manifestError) return new Result(1,"unauthorized");
|
||||
|
||||
Reference in New Issue
Block a user