diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-07-05 15:38:33 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-07-05 15:38:33 +0200 |
commit | b5e421942570cf18c840124e2528642b9f143e08 (patch) | |
tree | a5197c5a85e73f6fff12e94c28cf2c36eea26901 /controller-api | |
parent | 7b10c6fab21895ddd635c9a221f3da23b99a21bc (diff) |
Interface with tester and almost done InternalStepRunner
Diffstat (limited to 'controller-api')
2 files changed, 97 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/Testers.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/Testers.java new file mode 100644 index 00000000000..dccc0e47ceb --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/Testers.java @@ -0,0 +1,59 @@ +package com.yahoo.vespa.hosted.controller.api.integration.deployment; + +import java.net.URI; + +/** + * Allows running some predefined tests -- typically remotely. + * + * @author jonmv + */ +public interface Testers { + + /** Signals the tester to run its tests. */ + void startTests(URI testerUrl, Suite suite, byte[] config); + + /** Returns the currently stored logs from the tester. */ + byte[] getLogs(URI testerUrl); + + /** Returns the current status of the tester. */ + Status getStatus(URI testerUrl); + + + enum Status { + + /** Tests have not yet started. */ + NOT_STARTED, + + /** Tests are running. */ + RUNNING, + + /** Tests failed. */ + FAILURE, + + /** The tester encountered an exception. */ + ERROR, + + /** The tests were successful. */ + SUCCESS + + } + + + enum Suite { + + system, + + staging, + + production; + + public static Suite of(JobType type) { + if (type == JobType.systemTest) return system; + if (type == JobType.stagingTest) return staging; + if (type.isProduction()) return production; + throw new AssertionError("Unknown JobType '" + type + "'!"); + } + + } + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesters.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesters.java new file mode 100644 index 00000000000..021e4d7f293 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesters.java @@ -0,0 +1,38 @@ +package com.yahoo.vespa.hosted.controller.api.integration.stubs; + +import com.yahoo.vespa.hosted.controller.api.integration.deployment.Testers; + +import java.net.URI; +import java.util.Arrays; + +import static com.yahoo.vespa.hosted.controller.api.integration.deployment.Testers.Status.FAILURE; +import static com.yahoo.vespa.hosted.controller.api.integration.deployment.Testers.Status.NOT_STARTED; +import static com.yahoo.vespa.hosted.controller.api.integration.deployment.Testers.Status.RUNNING; +import static com.yahoo.vespa.hosted.controller.api.integration.deployment.Testers.Status.SUCCESS; + +public class MockTesters implements Testers { + + private byte[] logs = new byte[0]; + private Status status = NOT_STARTED; + + @Override + public void startTests(URI testerUrl, Suite suite, byte[] config) { + status = RUNNING; + } + + @Override + public byte[] getLogs(URI testerUrl) { + return Arrays.copyOf(logs, logs.length); + } + + @Override + public Status getStatus(URI testerUrl) { + return status; + } + + public void set(byte[] logs, Status status) { + this.logs = Arrays.copyOf(logs, logs.length); + this.status = status; + } + +} |