S19: share workstation runner and move agent workflows to landscape
This commit is contained in:
@@ -14,7 +14,7 @@ class CiTests {
|
||||
static void test(String name, Test test) throws Exception {
|
||||
test.run();
|
||||
count++;
|
||||
System.out.println("PASS " + name);
|
||||
IO.println("PASS " + name);
|
||||
}
|
||||
|
||||
static void equal(Object expected, Object actual) {
|
||||
@@ -32,6 +32,55 @@ class CiTests {
|
||||
|
||||
static void run() throws Exception {
|
||||
count = 0;
|
||||
test("shared runner scope and identity are independent of the application", () -> {
|
||||
equal("mini-pc", Setup.runnerName(Map.of("PROJECT_NAME", "first")));
|
||||
equal("mini-pc", Setup.runnerName(Map.of("PROJECT_NAME", "second")));
|
||||
equal("/api/v1/user/actions/runners/registration-token", Setup.runnerRegistrationPath(Map.of()));
|
||||
equal(
|
||||
"/api/v1/admin/actions/runners/registration-token",
|
||||
Setup.runnerRegistrationPath(Map.of("RUNNER_SCOPE", "instance")));
|
||||
equal(
|
||||
"/api/v1/orgs/team/actions/runners/registration-token",
|
||||
Setup.runnerRegistrationPath(
|
||||
Map.of("RUNNER_SCOPE", "organization", "RUNNER_ORGANIZATION", "team")));
|
||||
equal(
|
||||
"/api/v1/repos/owner/app/actions/runners/registration-token",
|
||||
Setup.runnerRegistrationPath(Map.of("RUNNER_SCOPE", "repository", "CI_REPOSITORY", "owner/app")));
|
||||
failure(() -> Setup.runnerRegistrationPath(Map.of("RUNNER_SCOPE", "unknown")));
|
||||
failure(() -> Setup.runnerRegistrationPath(
|
||||
Map.of("RUNNER_SCOPE", "organization", "RUNNER_ORGANIZATION", "../unsafe")));
|
||||
failure(() -> Setup.runnerName(Map.of("RUNNER_NAME", "../unsafe")));
|
||||
});
|
||||
test("runner preflight rejects unavailable offline and differently labelled runners", () -> {
|
||||
equal(false, Setup.hasRunner(Map.of("runners", List.of()), "mini-pc"));
|
||||
equal(
|
||||
false,
|
||||
Setup.hasRunner(
|
||||
Map.of(
|
||||
"runners",
|
||||
List.of(Map.of("status", "offline", "labels", List.of(Map.of("name", "mini-pc"))))),
|
||||
"mini-pc"));
|
||||
equal(
|
||||
false,
|
||||
Setup.hasRunner(
|
||||
Map.of(
|
||||
"runners",
|
||||
List.of(Map.of("status", "online", "labels", List.of(Map.of("name", "other"))))),
|
||||
"mini-pc"));
|
||||
equal(
|
||||
true,
|
||||
Setup.hasRunner(
|
||||
Map.of(
|
||||
"runners",
|
||||
List.of(Map.of(
|
||||
"status",
|
||||
"online",
|
||||
"busy",
|
||||
true,
|
||||
"labels",
|
||||
List.of(Map.of("name", "mini-pc"))))),
|
||||
"mini-pc"));
|
||||
});
|
||||
test("recipe supports backend-only and frontend-only projects", () -> {
|
||||
equal(List.of("backend"), Recipe.roles(Map.of("BACKEND_MODULE", "server")));
|
||||
equal(List.of("frontend"), Recipe.roles(Map.of("FRONTEND_MODULE", "web")));
|
||||
@@ -253,7 +302,7 @@ class CiTests {
|
||||
Pipeline.deleteTree(dir);
|
||||
}
|
||||
});
|
||||
System.out.println(count + " CI tests passed");
|
||||
IO.println(count + " CI tests passed");
|
||||
}
|
||||
|
||||
static class Fixture implements AutoCloseable {
|
||||
|
||||
Reference in New Issue
Block a user