diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-01-23 08:46:51 +0100 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2020-01-23 08:46:51 +0100 |
commit | 6b307b2941b4e3d7d1299b42e8f797295ecc6c9c (patch) | |
tree | cba326bc802dd114faf50785fd381a4901665758 | |
parent | c430519892bc41b296c7b8bf8885014b734940fd (diff) |
Add more methods
2 files changed, 40 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java index a395d61e933..36b13b3496a 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java @@ -17,15 +17,22 @@ public interface TesterCloud { /** Signals the tester to run its tests. */ void startTests(URI testerUrl, Suite suite, byte[] config); + /** Signals the tester to run its tests. */ + // TODO: Remove default implementation when implementations have been updated + default void startTests(DeploymentId deploymentId, Suite suite, byte[] config) {} + /** Returns the log entries from the tester with ids after the given threshold. */ List<LogEntry> getLog(URI testerUrl, long after); + /** Returns the log entries from the tester with ids after the given threshold. */ + // TODO: Remove default implementation when implementations have been updated + default List<LogEntry> getLog(DeploymentId deploymentId, long after) { return List.of(); } + /** Returns the current status of the tester. */ Status getStatus(URI testerUrl); /** Returns the current status of the tester. */ - // TODO: Remove default implementation when implementors have been updated - default Status getStatus(DeploymentId deploymentId) { return Status.FAILURE; } + Status getStatus(DeploymentId deploymentId); /** Returns whether the container is ready to serve. */ boolean ready(URI endpointUrl); @@ -33,9 +40,18 @@ public interface TesterCloud { /** Returns whether the test container is ready to serve */ boolean testerReady(URI endpointUrl); + /** Returns whether the test container is ready to serve */ + // TODO: Remove default implementation when implementations have been updated + default boolean testerReady(DeploymentId deploymentId) { return false; } + /** Returns whether the given URL is registered in DNS. */ boolean exists(URI endpointUrl); + /** + * Returns whether the given URL is registered in DNS. Always returns true, + * as endpoints are not use in this case + */ + default boolean exists(DeploymentId deploymentId) { return true; } enum Status { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java index e08141c422b..d2914f95360 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java @@ -28,11 +28,23 @@ public class MockTesterCloud implements TesterCloud { } @Override + public void startTests(DeploymentId deploymentId, Suite suite, byte[] config) { + this.status = RUNNING; + this.config = config; + this.testerUrl = null; + } + + @Override public List<LogEntry> getLog(URI testerUrl, long after) { return log.stream().filter(entry -> entry.id() > after).collect(Collectors.toList()); } @Override + public List<LogEntry> getLog(DeploymentId deploymentId, long after) { + return log.stream().filter(entry -> entry.id() > after).collect(Collectors.toList()); + } + + @Override public Status getStatus(URI testerUrl) { return status; } @Override @@ -49,10 +61,20 @@ public class MockTesterCloud implements TesterCloud { } @Override + public boolean testerReady(DeploymentId deploymentId) { + return true; + } + + @Override public boolean exists(URI endpointUrl) { return true; } + @Override + public boolean exists(DeploymentId deploymentId) { + return true; + } + public void add(LogEntry entry) { log.add(entry); } |