aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
diff options
context:
space:
mode:
Diffstat (limited to 'controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java')
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java37
1 files changed, 13 insertions, 24 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
index 5a8d6a45e43..5b141716eaa 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
@@ -22,20 +22,17 @@ import com.yahoo.vespa.hosted.controller.api.application.v4.model.ClusterMetrics
import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeploymentData;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.EndpointStatus;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.ProtonMetrics;
-import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ConfigChangeActions;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ApplicationReindexing;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ApplicationReindexing.Status;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Cluster;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ContainerEndpoint;
+import com.yahoo.vespa.hosted.controller.api.integration.configserver.DeploymentResult;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.LoadBalancer;
-import com.yahoo.vespa.hosted.controller.api.integration.configserver.Log;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeFilter;
-import com.yahoo.vespa.hosted.controller.api.integration.configserver.PrepareResponse;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ProxyResponse;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.QuotaUsage;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.ServiceConvergence;
@@ -51,7 +48,6 @@ import java.io.InputStream;
import java.net.URI;
import java.time.Duration;
import java.time.Instant;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -67,6 +63,7 @@ import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import static com.yahoo.config.provision.NodeResources.DiskSpeed.slow;
import static com.yahoo.config.provision.NodeResources.StorageType.remote;
@@ -89,7 +86,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
private final Set<DeploymentId> suspendedApplications = new HashSet<>();
private final Map<ZoneId, Set<LoadBalancer>> loadBalancers = new HashMap<>();
private final Set<Environment> deferLoadBalancerProvisioning = new HashSet<>();
- private final Map<DeploymentId, List<Log>> warnings = new HashMap<>();
+ private final Map<DeploymentId, List<DeploymentResult.LogEntry>> warnings = new HashMap<>();
private final Map<DeploymentId, Set<ContainerEndpoint>> containerEndpoints = new HashMap<>();
private final Map<DeploymentId, List<ClusterMetrics>> clusterMetrics = new HashMap<>();
private final Map<DeploymentId, TestReport> testReport = new HashMap<>();
@@ -266,15 +263,13 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
}
public void generateWarnings(DeploymentId deployment, int count) {
- List<Log> logs = new ArrayList<>(count);
- for (int i = 0; i < count; i++) {
- Log log = new Log();
- log.time = Instant.now().toEpochMilli();
- log.level = Level.WARNING.getName();
- log.message = "log message " + (count + 1) + " generated by unit test";
- logs.add(log);
- }
- warnings.put(deployment, List.copyOf(logs));
+ warnings.put(deployment,
+ IntStream.rangeClosed(1, count)
+ .mapToObj(i -> new DeploymentResult.LogEntry(Instant.now().toEpochMilli(),
+ "log message " + i + " generated by unit test",
+ Level.WARNING,
+ false))
+ .toList());
}
public Map<DeploymentId, Set<ContainerEndpoint>> containerEndpoints() {
@@ -407,6 +402,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
Optional.of("dns-zone-1"))));
}
+ // TODO jonmv: compute on deploy, not when getting the result.
return () -> {
Application application = applications.get(id);
application.activate();
@@ -428,12 +424,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
1))
.collect(Collectors.toList())));
- PrepareResponse prepareResponse = new PrepareResponse();
- prepareResponse.message = "foo";
- prepareResponse.configChangeActions = new ConfigChangeActions(List.of(), List.of(), List.of());
- prepareResponse.tenant = new TenantId("tenant");
- prepareResponse.log = warnings.getOrDefault(id, Collections.emptyList());
- return prepareResponse;
+ return new DeploymentResult("foo", warnings.getOrDefault(id, List.of()));
};
}
@@ -549,9 +540,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
@Override
public QuotaUsage getQuotaUsage(DeploymentId deploymentId) {
- var q = new QuotaUsage();
- q.rate = 42.42;
- return q;
+ return new QuotaUsage(42);
}
@Override