diff options
137 files changed, 653 insertions, 931 deletions
diff --git a/client/go/Makefile b/client/go/Makefile index 95da52c2383..e0f22836c45 100644 --- a/client/go/Makefile +++ b/client/go/Makefile @@ -34,6 +34,7 @@ all: test checkfmt install # # $ make dist-homebrew --dist-homebrew: dist-version + brew update brew bump-formula-pr --version $(VERSION) --no-audit --no-browse vespa-cli dist-homebrew: diff --git a/cloud-tenant-base-dependencies-enforcer/pom.xml b/cloud-tenant-base-dependencies-enforcer/pom.xml index 1b39095bc55..8b069933970 100644 --- a/cloud-tenant-base-dependencies-enforcer/pom.xml +++ b/cloud-tenant-base-dependencies-enforcer/pom.xml @@ -146,6 +146,9 @@ <include>io.airlift:airline:${airline.vespa.version}:test</include> <include>io.prometheus:simpleclient:${prometheus.client.vespa.version}:test</include> <include>io.prometheus:simpleclient_common:${prometheus.client.vespa.version}:test</include> + <include>io.prometheus:simpleclient_tracer_common:${prometheus.client.vespa.version}:test</include> + <include>io.prometheus:simpleclient_tracer_otel:${prometheus.client.vespa.version}:test</include> + <include>io.prometheus:simpleclient_tracer_otel_agent:${prometheus.client.vespa.version}:test</include> <include>junit:junit:${junit4.vespa.version}:test</include> <include>net.java.dev.jna:jna:${jna.vespa.version}:test</include> <include>net.openhft:zero-allocation-hashing:jar:${zero-allocation-hashing.vespa.version}:test</include> diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/Metrics.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/Metrics.java index ec24eff6aa5..91f219cdb7f 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/Metrics.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/Metrics.java @@ -67,11 +67,7 @@ public class Metrics { } public static class Value { - private final Long last; - private final Double average; - private final Long count; - public Value( @JsonProperty("average") Double average, @JsonProperty("count") Long count, @@ -80,13 +76,9 @@ public class Metrics { @JsonProperty("max") Long max, @JsonProperty("last") Long last) { this.last = last; - this.average = average; - this.count = count; } public Long getLast() { return last; } - public Double getAverage() { return average; } - public Long getCount() { return count; } } // We initialize it in case the metrics is missing in the JSON. diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/ValidationOverrides.java b/config-model-api/src/main/java/com/yahoo/config/application/api/ValidationOverrides.java index a07ef4b313a..f69cfa6d4c5 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/ValidationOverrides.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/ValidationOverrides.java @@ -104,7 +104,7 @@ public class ValidationOverrides { try { return fromXml(IOUtils.readAll(reader)); } catch (IOException e) { - throw new IllegalArgumentException("Could not read deployment spec", e); + throw new IllegalArgumentException("Could not read validation-overrides", e); } } @@ -123,12 +123,16 @@ public class ValidationOverrides { Element root = XML.getDocument(xmlForm).getDocumentElement(); List<ValidationOverrides.Allow> overrides = new ArrayList<>(); for (Element allow : XML.getChildren(root, "allow")) { - Instant until = LocalDate.parse(allow.getAttribute("until"), DateTimeFormatter.ISO_DATE) - .atStartOfDay().atZone(ZoneOffset.UTC).toInstant() - .plus(Duration.ofDays(1)); // Make the override valid *on* the "until" date - Optional<ValidationId> validationId = ValidationId.from(XML.getValue(allow)); - // skip unknown ids as they may be valid for other model versions - validationId.ifPresent(id -> overrides.add(new Allow(id, until))); + try { + Instant until = LocalDate.parse(allow.getAttribute("until"), DateTimeFormatter.ISO_DATE) + .atStartOfDay().atZone(ZoneOffset.UTC).toInstant() + .plus(Duration.ofDays(1)); // Make the override valid *on* the "until" date + Optional<ValidationId> validationId = ValidationId.from(XML.getValue(allow)); + // skip unknown ids as they may be valid for other model versions + validationId.ifPresent(id -> overrides.add(new Allow(id, until))); + } catch (RuntimeException e) { + throw new IllegalArgumentException(e); + } } return new ValidationOverrides(overrides, xmlForm); } diff --git a/config-model-api/src/test/java/com/yahoo/config/application/api/ValidationOverrideTest.java b/config-model-api/src/test/java/com/yahoo/config/application/api/ValidationOverrideTest.java index bf71947a983..57f306bf989 100644 --- a/config-model-api/src/test/java/com/yahoo/config/application/api/ValidationOverrideTest.java +++ b/config-model-api/src/test/java/com/yahoo/config/application/api/ValidationOverrideTest.java @@ -69,6 +69,26 @@ public class ValidationOverrideTest { e.getMessage()); } } + + @Test + public void testInvalidDate() { + String validationOverrides = + "<validation-overrides>" + + " <allow until='2000-02-31'>indexing-change</allow>" + + "</validation-overrides>"; + + try { + ValidationOverrides overrides = ValidationOverrides.fromXml(new StringReader(validationOverrides)); + Instant now = ManualClock.at("2000-01-01T23:59:00"); + overrides.allows("indexing-change", now); + overrides.validate(now); + Assert.fail("Expected validation interval override validation validation failure"); + } + catch (IllegalArgumentException e) { + Assert.assertEquals("java.time.format.DateTimeParseException: Text '2000-02-31' could not be parsed: Invalid date 'FEBRUARY 31'", + e.getMessage()); + } + } @Test public void testEmpty() { diff --git a/config-model-fat/pom.xml b/config-model-fat/pom.xml index 34034f5e53b..adf511faabe 100644 --- a/config-model-fat/pom.xml +++ b/config-model-fat/pom.xml @@ -204,6 +204,9 @@ <i>com.thaiopensource:jing:*:*</i> <i>io.prometheus:simpleclient:*:*</i> <i>io.prometheus:simpleclient_common:*:*</i> + <i>io.prometheus:simpleclient_tracer_common:*:*</i> + <i>io.prometheus:simpleclient_tracer_otel:*:*</i> + <i>io.prometheus:simpleclient_tracer_otel_agent:*:*</i> <i>javax.inject:javax.inject:*:*</i> <i>net.openhft:zero-allocation-hashing:*:*</i> <i>org.antlr:antlr-runtime:*:*</i> diff --git a/config-model/pom.xml b/config-model/pom.xml index 7c6fb610bae..58df48a5763 100644 --- a/config-model/pom.xml +++ b/config-model/pom.xml @@ -52,11 +52,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <version>${protobuf.vespa.version}</version> diff --git a/config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java b/config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java index abd803dcebb..ad50ad02171 100644 --- a/config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java +++ b/config-model/src/main/java/com/yahoo/config/model/ConfigModelContext.java @@ -9,6 +9,7 @@ import com.yahoo.config.model.api.ModelContext; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.producer.AnyConfigProducer; import com.yahoo.config.model.producer.TreeConfigProducer; +import com.yahoo.config.provision.CloudAccount; import com.yahoo.config.provision.ClusterInfo; import com.yahoo.config.provision.ClusterInfo.Builder; import com.yahoo.config.provision.zone.ZoneId; @@ -81,13 +82,8 @@ public final class ConfigModelContext { ClusterInfo.Builder builder = new ClusterInfo.Builder(); spec.hostTTL(properties().applicationId().instance(), deployState.zone().environment(), deployState.zone().region()) .filter(ttl -> ! ttl.isZero()) - .ifPresent(ttl -> { - ZoneId zoneId = ZoneId.from(deployState.zone().environment(), deployState.zone().region()); - if (spec.cloudAccount(deployState.zone().cloud().name(), properties().applicationId().instance(), zoneId).isUnspecified()) - throw new IllegalArgumentException("deployment spec specifies host TTL for " + zoneId + - " but no cloud account is specified for this zone"); - builder.hostTTL(ttl); - }); + .filter(__ -> deployState.getProperties().cloudAccount().map(account -> ! account.isUnspecified()).orElse(false)) + .ifPresent(builder::hostTTL); spec.instance(properties().applicationId().instance()) .flatMap(instance -> instance.bcp().groups().stream() .filter(group -> group.memberRegions().contains(properties().zone().region())) diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java index c0b0ec3943d..123048c1638 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java @@ -3,10 +3,8 @@ package com.yahoo.vespa.model.content; import com.yahoo.config.model.api.ModelContext; import com.yahoo.config.model.deploy.DeployState; -import com.yahoo.config.model.producer.AnyConfigProducer; import com.yahoo.config.model.producer.TreeConfigProducer; import com.yahoo.vespa.config.content.StorFilestorConfig; -import com.yahoo.vespa.config.content.core.StorBucketmoverConfig; import com.yahoo.vespa.config.content.core.StorServerConfig; import com.yahoo.vespa.defaults.Defaults; import com.yahoo.vespa.model.application.validation.RestartConfigs; @@ -21,7 +19,7 @@ import java.util.Optional; /** * Class to provide config related to a specific storage node. */ -@RestartConfigs({StorFilestorConfig.class, StorBucketmoverConfig.class}) +@RestartConfigs({StorFilestorConfig.class}) public class StorageNode extends ContentNode implements StorServerConfig.Producer, StorFilestorConfig.Producer { static final String rootFolder = Defaults.getDefaults().underVespaHome("var/db/vespa/search/"); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/IntegrityCheckerProducer.java b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/IntegrityCheckerProducer.java deleted file mode 100644 index 4f81bbf165f..00000000000 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/IntegrityCheckerProducer.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.model.content.storagecluster; - -import com.yahoo.vespa.config.content.core.StorIntegritycheckerConfig; -import com.yahoo.vespa.model.builder.xml.dom.ModelElement; -import com.yahoo.vespa.model.content.cluster.ContentCluster; - -/** - * Serves stor-integritychecker config for storage clusters. - */ -public class IntegrityCheckerProducer implements StorIntegritycheckerConfig.Producer { - - public static class Builder { - protected IntegrityCheckerProducer build(ContentCluster cluster, ModelElement clusterElem) { - return integrityCheckerDisabled(); - } - } - - private final Integer startTime; - private final Integer stopTime; - private final String weeklyCycle; - - IntegrityCheckerProducer(Integer startTime, Integer stopTime, String weeklyCycle) { - this.startTime = startTime; - this.stopTime = stopTime; - this.weeklyCycle = weeklyCycle; - } - - private static IntegrityCheckerProducer integrityCheckerDisabled() { - // Leave start/start times at default, but mark each day of the week as - // not allowing the integrity checker to be run. - return new IntegrityCheckerProducer(null, null, "-------"); - } - - @Override - public void getConfig(StorIntegritycheckerConfig.Builder builder) { - if (startTime != null) { - builder.dailycyclestart(startTime); - } - - if (stopTime != null) { - builder.dailycyclestop(stopTime); - } - - if (weeklyCycle != null) { - builder.weeklycycle(weeklyCycle); - } - } -} diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java index a1e809098f2..872fda9d909 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/storagecluster/StorageCluster.java @@ -3,8 +3,6 @@ package com.yahoo.vespa.model.content.storagecluster; import ai.vespa.metrics.StorageMetrics; import com.yahoo.config.model.deploy.DeployState; -import com.yahoo.vespa.config.content.core.StorIntegritycheckerConfig; -import com.yahoo.vespa.config.content.core.StorBucketmoverConfig; import com.yahoo.vespa.config.content.core.StorVisitorConfig; import com.yahoo.vespa.config.content.StorFilestorConfig; import com.yahoo.vespa.config.content.core.StorServerConfig; @@ -23,8 +21,6 @@ import org.w3c.dom.Element; */ public class StorageCluster extends TreeConfigProducer<StorageNode> implements StorServerConfig.Producer, - StorBucketmoverConfig.Producer, - StorIntegritycheckerConfig.Producer, StorFilestorConfig.Producer, StorVisitorConfig.Producer, PersistenceConfig.Producer, @@ -39,7 +35,6 @@ public class StorageCluster extends TreeConfigProducer<StorageNode> return new StorageCluster(ancestor, ContentCluster.getClusterId(clusterElem), new FileStorProducer.Builder().build(deployState.getProperties(), cluster, clusterElem), - new IntegrityCheckerProducer.Builder().build(cluster, clusterElem), new StorServerProducer.Builder().build(clusterElem), new StorVisitorProducer.Builder().build(clusterElem), new PersistenceProducer.Builder().build(clusterElem)); @@ -48,7 +43,6 @@ public class StorageCluster extends TreeConfigProducer<StorageNode> private final String clusterName; private final FileStorProducer fileStorProducer; - private final IntegrityCheckerProducer integrityCheckerProducer; private final StorServerProducer storServerProducer; private final StorVisitorProducer storVisitorProducer; private final PersistenceProducer persistenceProducer; @@ -56,24 +50,18 @@ public class StorageCluster extends TreeConfigProducer<StorageNode> StorageCluster(TreeConfigProducer<?> parent, String clusterName, FileStorProducer fileStorProducer, - IntegrityCheckerProducer integrityCheckerProducer, StorServerProducer storServerProducer, StorVisitorProducer storVisitorProducer, PersistenceProducer persistenceProducer) { super(parent, "storage"); this.clusterName = clusterName; this.fileStorProducer = fileStorProducer; - this.integrityCheckerProducer = integrityCheckerProducer; this.storServerProducer = storServerProducer; this.storVisitorProducer = storVisitorProducer; this.persistenceProducer = persistenceProducer; } @Override - public void getConfig(StorBucketmoverConfig.Builder builder) { - } - - @Override public void getConfig(MetricsmanagerConfig.Builder builder) { ContentCluster.getMetricBuilder("fleetcontroller", builder). addedmetrics(StorageMetrics.VDS_DATASTORED_ALLDISKS_DOCS.baseName()). @@ -101,11 +89,6 @@ public class StorageCluster extends TreeConfigProducer<StorageNode> } @Override - public void getConfig(StorIntegritycheckerConfig.Builder builder) { - integrityCheckerProducer.getConfig(builder); - } - - @Override public void getConfig(StorServerConfig.Builder builder) { storServerProducer.getConfig(builder); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java index 53da4d31488..e49eed1eaa0 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java @@ -10,7 +10,6 @@ import com.yahoo.config.provision.NodeResources; import com.yahoo.metrics.MetricsmanagerConfig; import com.yahoo.searchlib.TranslogserverConfig; import com.yahoo.vespa.config.content.StorFilestorConfig; -import com.yahoo.vespa.config.content.core.StorBucketmoverConfig; import com.yahoo.vespa.config.content.core.StorCommunicationmanagerConfig; import com.yahoo.vespa.config.content.core.StorServerConfig; import com.yahoo.vespa.config.content.core.StorStatusConfig; @@ -44,8 +43,7 @@ import static com.yahoo.vespa.defaults.Defaults.getDefaults; * @author hmusum */ @RestartConfigs({ProtonConfig.class, MetricsmanagerConfig.class, TranslogserverConfig.class, - StorFilestorConfig.class, StorBucketmoverConfig.class, - StorCommunicationmanagerConfig.class, StorStatusConfig.class, + StorFilestorConfig.class, StorCommunicationmanagerConfig.class, StorStatusConfig.class, StorServerConfig.class}) public class SearchNode extends AbstractService implements SearchInterface, diff --git a/config-model/src/test/java/com/yahoo/vespa/model/ClusterInfoTest.java b/config-model/src/test/java/com/yahoo/vespa/model/ClusterInfoTest.java index 1734e9f074f..16e13a66a44 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/ClusterInfoTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/ClusterInfoTest.java @@ -12,6 +12,7 @@ import com.yahoo.config.provision.Cloud; import com.yahoo.config.provision.CloudAccount; import com.yahoo.config.provision.CloudName; import com.yahoo.config.provision.ClusterSpec; +import com.yahoo.config.provision.ClusterSpec.Id; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.InstanceName; import com.yahoo.config.provision.RegionName; @@ -216,7 +217,7 @@ public class ClusterInfoTest { <deployment version='1.0' empty-host-ttl='1d'> <instance id='default'> <prod> - <region cloud-account='gcp:foobar'>us-east-1</region> + <region>us-east-1</region> <region empty-host-ttl='0m'>us-north-1</region> <region>us-west-1</region> </prod> @@ -228,10 +229,7 @@ public class ClusterInfoTest { CloudAccount account = CloudAccount.from("gcp:foobar"); assertEquals(Duration.ofHours(24), requestedCapacityIn(account, gcp, "default", "us-east-1", servicesXml, deploymentXml).get(new ClusterSpec.Id("testcontainer")).clusterInfo().hostTTL()); assertEquals(Duration.ZERO, requestedCapacityIn(account, gcp, "default", "us-north-1", servicesXml, deploymentXml).get(new ClusterSpec.Id("testcontainer")).clusterInfo().hostTTL()); - assertEquals("In container cluster 'testcontainer': deployment spec specifies host TTL for prod.us-west-1 but no cloud account is specified for this zone", - Exceptions.toMessageString(assertThrows(IllegalArgumentException.class, - () -> requestedCapacityIn(account, gcp, "default", "us-west-1", servicesXml, deploymentXml)))); - + assertEquals(Duration.ZERO, requestedCapacityIn(CloudAccount.empty, gcp, "default", "us-west-1", servicesXml, deploymentXml).get(new Id("testcontainer")).clusterInfo().hostTTL()); } private Map<ClusterSpec.Id, Capacity> requestedCapacityIn(String instance, String region, String servicesXml, String deploymentXml) throws Exception { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/BundleValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/BundleValidatorTest.java index d5bcf1e5e49..0e98225aba5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/BundleValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/BundleValidatorTest.java @@ -17,7 +17,6 @@ import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import static com.yahoo.yolean.Exceptions.uncheck; -import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -65,12 +64,12 @@ public class BundleValidatorTest { JarFile jarFile = createTemporaryJarFile(tempDir, "import-warnings"); validator.validateJarFile(state, jarFile); String output = buffer.toString(); - assertThat(output) + assertTrue(output .contains("JAR file 'import-warnings.jar' imports the packages [org.json] from 'org.json:json'. \n" + - "This bundle is no longer provided on Vespa 8 - see https://docs.vespa.ai/en/vespa8-release-notes.html#container-runtime."); - assertThat(output) + "This bundle is no longer provided on Vespa 8 - see https://docs.vespa.ai/en/vespa8-release-notes.html#container-runtime.")); + assertTrue(output .contains("JAR file 'import-warnings.jar' imports the packages [org.eclipse.jetty.client.api] from 'jetty'. \n" + - "The Jetty bundles are no longer provided on Vespa 8 - see https://docs.vespa.ai/en/vespa8-release-notes.html#container-runtime."); + "The Jetty bundles are no longer provided on Vespa 8 - see https://docs.vespa.ai/en/vespa8-release-notes.html#container-runtime.")); } static DeployState createDeployState(StringBuffer buffer) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/http/DefaultFilterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/http/DefaultFilterTest.java index 3e80b319e88..a52b6117482 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/http/DefaultFilterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/http/DefaultFilterTest.java @@ -11,10 +11,12 @@ import com.yahoo.vespa.model.container.xml.ContainerModelBuilder; import org.junit.jupiter.api.Test; import org.w3c.dom.Element; +import java.util.Map; import java.util.Set; +import static java.util.stream.Collectors.toMap; import static java.util.stream.Collectors.toSet; -import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author bjorncs @@ -53,17 +55,12 @@ public class DefaultFilterTest extends DomBuilderTest { ChainsConfig chainsConfig = root.getConfig(ChainsConfig.class, "container/filters/chain"); Set<String> chainsIds = chainsConfig.chains().stream().map(ChainsConfig.Chains::id).collect(toSet()); - assertThat(chainsIds) - .containsExactlyInAnyOrder( - "request-chain-with-binding", "response-chain-with-binding", "my-default-request-chain", "my-default-response-chain"); + assertEquals(chainsIds, Set.of("request-chain-with-binding", "response-chain-with-binding", "my-default-request-chain", "my-default-response-chain")); } private static void assertDefaultFiltersInConfig(ServerConfig config) { - assertThat(config.defaultFilters()) - .containsExactlyInAnyOrder( - new ServerConfig.DefaultFilters(new ServerConfig.DefaultFilters.Builder() - .filterId("my-default-request-chain").localPort(8000)), - new ServerConfig.DefaultFilters(new ServerConfig.DefaultFilters.Builder() - .filterId("my-default-response-chain").localPort(8000))); + var asMap = config.defaultFilters().stream().collect(toMap(ServerConfig.DefaultFilters::filterId, ServerConfig.DefaultFilters::localPort)); + assertEquals(asMap, Map.of("my-default-request-chain", 8000, "my-default-response-chain", 8000)); + } } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/search/searchchain/FederationTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/search/searchchain/FederationTest.java index ff884d6072f..3c96edc482a 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/search/searchchain/FederationTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/search/searchchain/FederationTest.java @@ -7,7 +7,6 @@ import org.w3c.dom.Element; import java.util.List; -import static org.assertj.core.api.Fail.fail; import static org.junit.jupiter.api.Assertions.*; /** diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java index 540f625cf2b..2404c6399eb 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java @@ -9,7 +9,6 @@ import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.config.provision.Flavor; import com.yahoo.config.provisioning.FlavorsConfig; import com.yahoo.vespa.config.content.core.StorCommunicationmanagerConfig; -import com.yahoo.vespa.config.content.core.StorIntegritycheckerConfig; import com.yahoo.vespa.config.content.core.StorVisitorConfig; import com.yahoo.vespa.config.content.StorFilestorConfig; import com.yahoo.vespa.config.content.core.StorServerConfig; @@ -327,15 +326,6 @@ public class StorageClusterTest { } @Test - void integrity_checker_explicitly_disabled_when_not_running_with_vds_provider() { - StorIntegritycheckerConfig.Builder builder = new StorIntegritycheckerConfig.Builder(); - parse(cluster("bees", "")).getConfig(builder); - StorIntegritycheckerConfig config = new StorIntegritycheckerConfig(builder); - // '-' --> don't run on the given week day - assertEquals("-------", config.weeklycycle()); - } - - @Test void testCapacity() { String xml = joinLines( "<cluster id=\"storage\">", diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/Deployer.java b/config-provisioning/src/main/java/com/yahoo/config/provision/Deployer.java index f184519e928..e9ceb34570e 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/Deployer.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/Deployer.java @@ -57,6 +57,9 @@ public interface Deployer { /** Returns the time the active session was activated, or empty if there is no active session */ Optional<Instant> activationTime(ApplicationId application); + /** Returns the time of last deployed session for this application or empty if there are no deployments */ + Optional<Instant> deployTime(ApplicationId application); + /** Whether the deployer is bootstrapping, some users of the deployer will want to hold off with deployments in that case. */ default boolean bootstrapping() { return false; } diff --git a/configserver-flags/pom.xml b/configserver-flags/pom.xml index 63525805669..02824f2e6e3 100644 --- a/configserver-flags/pom.xml +++ b/configserver-flags/pom.xml @@ -110,11 +110,6 @@ <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> </dependencies> <build> <plugins> diff --git a/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java b/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java index 2700ab114e9..3c4c99e0337 100644 --- a/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java +++ b/configserver-flags/src/test/java/com/yahoo/vespa/configserver/flags/http/FlagsHandlerTest.java @@ -23,8 +23,8 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author hakonhall @@ -36,8 +36,6 @@ public class FlagsHandlerTest { "id2", true, List.of("joe"), "2010-01-01", "2030-01-01", "desc2", "mod2", FetchVector.Dimension.HOSTNAME, FetchVector.Dimension.APPLICATION_ID); - private static final String FLAGS_V1_URL = "https://foo.com:4443/flags/v1"; - private final FlagsDb flagsDb = new FlagsDbImpl(new MockCurator()); private final FlagsHandler handler = new FlagsHandler(FlagsHandler.testContext(), flagsDb); @@ -71,14 +69,15 @@ public class FlagsHandlerTest { void testData() { // PUT flag with ID id1 verifySuccessfulRequest(Method.PUT, "/data/" + FLAG1.id(), - "{\n" + - " \"id\": \"id1\",\n" + - " \"rules\": [\n" + - " {\n" + - " \"value\": true\n" + - " }\n" + - " ]\n" + - "}", + """ + { + "id": "id1", + "rules": [ + { + "value": true + } + ] + }""", ""); // GET on ID id1 should return the same as the put. @@ -99,29 +98,31 @@ public class FlagsHandlerTest { // PUT id2 verifySuccessfulRequest(Method.PUT, "/data/" + FLAG2.id(), - "{\n" + - " \"id\": \"id2\",\n" + - " \"rules\": [\n" + - " {\n" + - " \"conditions\": [\n" + - " {\n" + - " \"type\": \"whitelist\",\n" + - " \"dimension\": \"hostname\",\n" + - " \"values\": [ \"host1\", \"host2\" ]\n" + - " },\n" + - " {\n" + - " \"type\": \"blacklist\",\n" + - " \"dimension\": \"application\",\n" + - " \"values\": [ \"app1\", \"app2\" ]\n" + - " }\n" + - " ],\n" + - " \"value\": true\n" + - " }\n" + - " ],\n" + - " \"attributes\": {\n" + - " \"zone\": \"zone1\"\n" + - " }\n" + - "}\n", + """ + { + "id": "id2", + "rules": [ + { + "conditions": [ + { + "type": "whitelist", + "dimension": "hostname", + "values": [ "host1", "host2" ] + }, + { + "type": "blacklist", + "dimension": "application", + "values": [ "app1", "app2" ] + } + ], + "value": true + } + ], + "attributes": { + "zone": "zone1" + } + } + """, ""); // GET on id2 should now return what was put @@ -135,14 +136,16 @@ public class FlagsHandlerTest { // Putting (overriding) id1 should work silently verifySuccessfulRequest(Method.PUT, "/data/" + FLAG1.id(), - "{\n" + - " \"id\": \"id1\",\n" + - " \"rules\": [\n" + - " {\n" + - " \"value\": false\n" + - " }\n" + - " ]\n" + - "}\n", + """ + { + "id": "id1", + "rules": [ + { + "value": false + } + ] + } + """, ""); // Verify PUT @@ -162,16 +165,16 @@ public class FlagsHandlerTest { @Test void testForcing() { - assertThat(handle(Method.PUT, "/data/" + new FlagId("undef"), "", 400)).contains("There is no flag 'undef'"); + assertTrue(handle(Method.PUT, "/data/" + new FlagId("undef"), "", 400).contains("There is no flag 'undef'")); - assertThat(handle(Method.PUT, "/data/" + new FlagId("undef") + "?force=true", "", 400)). - contains("No content to map due to end-of-input"); + assertTrue(handle(Method.PUT, "/data/" + new FlagId("undef") + "?force=true", "", 400). + contains("No content to map due to end-of-input")); - assertThat(handle(Method.PUT, "/data/" + FLAG1.id(), "{}", 400)). - contains("Flag ID missing"); + assertTrue(handle(Method.PUT, "/data/" + FLAG1.id(), "{}", 400). + contains("Flag ID missing")); - assertThat(handle(Method.PUT, "/data/" + FLAG1.id(), "{\"id\": \"id1\",\"rules\": [{\"value\":\"string\"}]}", 400)). - contains("Wrong type of JsonNode: STRING"); + assertTrue(handle(Method.PUT, "/data/" + FLAG1.id(), "{\"id\": \"id1\",\"rules\": [{\"value\":\"string\"}]}", 400). + contains("Wrong type of JsonNode: STRING")); assertEquals(handle(Method.PUT, "/data/" + FLAG1.id() + "?force=true", "{\"id\": \"id1\",\"rules\": [{\"value\":\"string\"}]}", 200), ""); diff --git a/configserver/pom.xml b/configserver/pom.xml index ece1e497d44..bfef0748989 100644 --- a/configserver/pom.xml +++ b/configserver/pom.xml @@ -106,11 +106,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.yahoo.vespa</groupId> <artifactId>airlift-zstd</artifactId> <version>${project.version}</version> diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java index 138d963b250..acc195729e0 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java @@ -43,6 +43,7 @@ import com.yahoo.transaction.Transaction; import com.yahoo.vespa.applicationmodel.InfrastructureApplication; import com.yahoo.vespa.config.server.application.Application; import com.yahoo.vespa.config.server.application.ApplicationCuratorDatabase; +import com.yahoo.vespa.config.server.application.ApplicationData; import com.yahoo.vespa.config.server.application.ApplicationReindexing; import com.yahoo.vespa.config.server.application.ApplicationVersions; import com.yahoo.vespa.config.server.application.ClusterReindexing; @@ -445,11 +446,28 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye public Optional<Instant> activationTime(ApplicationId application) { Tenant tenant = tenantRepository.getTenant(application.tenant()); if (tenant == null) return Optional.empty(); + Optional<Instant> activatedTime = getActiveSession(tenant, application).map(Session::getActivatedTime); log.log(Level.FINEST, application + " last activated " + activatedTime.orElse(Instant.EPOCH)); return activatedTime; } + @Override + public Optional<Instant> deployTime(ApplicationId application) { + Tenant tenant = tenantRepository.getTenant(application.tenant()); + if (tenant == null) return Optional.empty(); + + // TODO: Fallback to empty instead if no deploy time (in Vespa 9) + Optional<Long> lastDeployedSession = tenant.getApplicationRepo().applicationData(application) + .flatMap(ApplicationData::lastDeployedSession); + if (lastDeployedSession.isEmpty()) return activationTime(application); + + Instant createTime = getRemoteSession(tenant, lastDeployedSession.get()).getCreateTime(); + log.log(Level.FINEST, application + " last deployed " + createTime); + + return Optional.of(createTime); + } + public ApplicationId activate(Tenant tenant, long sessionId, TimeoutBudget timeoutBudget, diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java index c355be5090a..2a79e2c03aa 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java @@ -97,7 +97,6 @@ public class ApplicationRepositoryTest { private ApplicationRepository applicationRepository; private TenantRepository tenantRepository; - private MockProvisioner provisioner; private OrchestratorMock orchestrator; private TimeoutBudget timeoutBudget; private Curator curator; @@ -123,7 +122,7 @@ public class ApplicationRepositoryTest { .build(); flagSource = new InMemoryFlagSource(); fileDirectory = new FileDirectory(configserverConfig); - provisioner = new MockProvisioner(); + MockProvisioner provisioner = new MockProvisioner(); tenantRepository = new TestTenantRepository.Builder() .withClock(clock) .withConfigserverConfig(configserverConfig) diff --git a/container-core/pom.xml b/container-core/pom.xml index b3794142d0e..3df232406ca 100644 --- a/container-core/pom.xml +++ b/container-core/pom.xml @@ -390,11 +390,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest</artifactId> <scope>test</scope> diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java index 06d1a707be9..06a9986e996 100644 --- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java +++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottler.java @@ -46,11 +46,11 @@ class ConnectionThrottler extends ContainerLifeCycle implements SelectorManager. private boolean isThrottling = false; ConnectionThrottler(AbstractConnector connector, ConnectorConfig.Throttling config) { - this(Runtime.getRuntime(), new RateStatistic(1, TimeUnit.SECONDS), connector.getScheduler(), connector, config); + this(Jvm.fromRuntime(), new RateStatistic(1, TimeUnit.SECONDS), connector.getScheduler(), connector, config); } // Intended for unit testing - ConnectionThrottler(Runtime runtime, + ConnectionThrottler(Jvm runtime, RateStatistic rateStatistic, Scheduler scheduler, AbstractConnector connector, @@ -150,10 +150,10 @@ class ConnectionThrottler extends ContainerLifeCycle implements SelectorManager. * Note: implementation inspired by Jetty's {@link LowResourceMonitor} */ private static class HeapResourceLimit extends AbstractLifeCycle implements ResourceLimit { - private final Runtime runtime; + private final Jvm runtime; private final double maxHeapUtilization; - HeapResourceLimit(Runtime runtime, double maxHeapUtilization) { + HeapResourceLimit(Jvm runtime, double maxHeapUtilization) { this.runtime = runtime; this.maxHeapUtilization = maxHeapUtilization; } @@ -269,4 +269,18 @@ class ConnectionThrottler extends ContainerLifeCycle implements SelectorManager. } } } + + interface Jvm { + long maxMemory(); + long freeMemory(); + + static Jvm fromRuntime() { + return new Jvm() { + final Runtime rt = Runtime.getRuntime(); + + @Override public long maxMemory() { return rt.maxMemory(); } + @Override public long freeMemory() { return rt.freeMemory(); } + }; + } + } } diff --git a/container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java b/container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java index 86b7f545762..8590983d0ad 100644 --- a/container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java +++ b/container-core/src/test/java/com/yahoo/container/jdisc/ThreadedHttpRequestHandlerTest.java @@ -7,7 +7,8 @@ import org.junit.jupiter.api.Test; import java.util.concurrent.Executors; -import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author bjorncs @@ -22,10 +23,10 @@ public class ThreadedHttpRequestHandlerTest { driver.sendRequest("http://localhost/myhandler").readAll(); String expectedMetricName = "jdisc.http.handler.unhandled_exceptions"; - assertThat(metricMock.innvocations()) - .containsKey(expectedMetricName); - assertThat(((MetricMock.SimpleMetricContext) metricMock.innvocations().get(expectedMetricName).ctx).dimensions) - .containsEntry("exception", "DummyException"); + assertTrue(metricMock.innvocations() + .containsKey(expectedMetricName)); + assertEquals("DummyException", + ((MetricMock.SimpleMetricContext) metricMock.innvocations().get(expectedMetricName).ctx).dimensions.get("exception")); } diff --git a/container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java b/container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java index b5c65733436..220c09481c2 100644 --- a/container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java +++ b/container-core/src/test/java/com/yahoo/container/logging/LogFileHandlerTestCase.java @@ -25,8 +25,10 @@ import java.util.logging.LogRecord; import java.util.zip.GZIPInputStream; import static com.yahoo.yolean.Exceptions.uncheck; -import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Bob Travis @@ -50,8 +52,8 @@ public class LogFileHandlerTestCase { long tomorrowDays = (now / millisPerDay) + 1; long tomorrowMillis = tomorrowDays * millisPerDay; - assertThat(tomorrowMillis + 1000).isEqualTo(h.logThread.getNextRotationTime(tomorrowMillis)); - assertThat(tomorrowMillis + 10000).isEqualTo(h.logThread.getNextRotationTime(tomorrowMillis + 3000)); + assertEquals(tomorrowMillis + 1000, h.logThread.getNextRotationTime(tomorrowMillis)); + assertEquals(tomorrowMillis + 10000, h.logThread.getNextRotationTime(tomorrowMillis + 3000)); String message = "test"; h.publish(message); h.publish("another test"); @@ -118,11 +120,11 @@ public class LogFileHandlerTestCase { String longMessage = formatter.format(new LogRecord(Level.INFO, "string which is way longer than the word test")); handler.publish(longMessage); handler.flush(); - assertThat(Files.size(Paths.get(firstFile))).isEqualTo(31); + assertEquals(31, Files.size(Paths.get(firstFile))); final long expectedSecondFileLength = 72; long symlinkFileLength = Files.size(root.toPath().resolve("symlink")); - assertThat(symlinkFileLength).isEqualTo(expectedSecondFileLength); + assertEquals(expectedSecondFileLength, symlinkFileLength); handler.shutdown(); } @@ -135,8 +137,8 @@ public class LogFileHandlerTestCase { firstHandler.publishAndWait("test"); firstHandler.shutdown(); - assertThat(Files.size(Paths.get(firstHandler.getFileName()))).isEqualTo(5); - assertThat(root.toPath().resolve("symlink").toRealPath().toString()).isEqualTo( + assertEquals(5, Files.size(Paths.get(firstHandler.getFileName()))); + assertEquals(root.toPath().resolve("symlink").toRealPath().toString(), Paths.get(firstHandler.getFileName()).toRealPath().toString()); LogFileHandler<String> secondHandler = new LogFileHandler<>( @@ -144,11 +146,11 @@ public class LogFileHandlerTestCase { secondHandler.publishAndWait("test"); secondHandler.rotateNow(); - assertThat(root.toPath().resolve("symlink").toRealPath().toString()).isEqualTo( + assertEquals(root.toPath().resolve("symlink").toRealPath().toString(), Paths.get(secondHandler.getFileName()).toRealPath().toString()); while (Files.exists(root.toPath().resolve(firstHandler.getFileName()))) Thread.sleep(1); - assertThat(Files.exists(Paths.get(firstHandler.getFileName() + ".zst"))).isTrue(); + assertTrue(Files.exists(Paths.get(firstHandler.getFileName() + ".zst"))); secondHandler.shutdown(); } @@ -187,20 +189,20 @@ public class LogFileHandlerTestCase { } h.flush(); String f1 = h.getFileName(); - assertThat(f1).startsWith(root.getAbsolutePath() + "/logfilehandlertest."); + assertTrue(f1.startsWith(root.getAbsolutePath() + "/logfilehandlertest.")); File uncompressed = new File(f1); File compressed = new File(f1 + "." + fileExtension); - assertThat(uncompressed).exists(); - assertThat(compressed).doesNotExist(); + assertTrue(uncompressed.exists()); + assertFalse(compressed.exists()); String content = IOUtils.readFile(uncompressed); - assertThat(content).hasLineCount(logEntries); + assertEquals(logEntries, content.lines().count()); h.rotateNow(); while (uncompressed.exists()) { Thread.sleep(1); } - assertThat(compressed).exists(); + assertTrue(compressed.exists()); String uncompressedContent = decompressor.apply(compressed.toPath(), content.getBytes().length); - assertThat(uncompressedContent).isEqualTo(content); + assertEquals(uncompressedContent, content); h.shutdown(); } @@ -211,14 +213,6 @@ public class LogFileHandlerTestCase { outputStream.write(record.getBytes(StandardCharsets.UTF_8)); } - private static File newFolder(File root, String... subDirs) throws IOException { - String subFolder = String.join("/", subDirs); - File result = new File(root, subFolder); - if (!result.mkdirs()) { - throw new IOException("Couldn't create folders " + root); - } - return result; - } } private static File newFolder(File root, String... subDirs) throws IOException { diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottlerTest.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottlerTest.java index a65231db2b7..cc73ab52aa1 100644 --- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottlerTest.java +++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ConnectionThrottlerTest.java @@ -24,7 +24,7 @@ public class ConnectionThrottlerTest { @Test void throttles_when_any_resource_check_exceeds_configured_threshold() { - Runtime runtime = mock(Runtime.class); + var runtime = mock(ConnectionThrottler.Jvm.class); when(runtime.maxMemory()).thenReturn(100l); RateStatistic rateStatistic = new RateStatistic(1, TimeUnit.HOURS); MockScheduler scheduler = new MockScheduler(); diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java index ce49926c58b..cc839768ad5 100644 --- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java +++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/FilterTestCase.java @@ -28,7 +28,6 @@ import com.yahoo.jdisc.http.filter.ResponseHeaderFilter; import com.yahoo.jdisc.http.filter.chain.RequestFilterChain; import com.yahoo.jdisc.http.filter.chain.ResponseFilterChain; import com.yahoo.jdisc.http.server.jetty.testutils.ConnectorFactoryRegistryModule; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; @@ -44,6 +43,7 @@ import java.util.concurrent.atomic.AtomicReference; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; @@ -557,7 +557,7 @@ public class FilterTestCase { .expectStatusCode(is(Response.Status.OK)); ArgumentCaptor<HttpRequest> requestArgumentCaptor = ArgumentCaptor.forClass(HttpRequest.class); verify(filter).filter(requestArgumentCaptor.capture(), any(ResponseHandler.class)); - Assertions.assertThat(requestArgumentCaptor.getValue().context()).containsKey(RequestHandlerSpec.ATTRIBUTE_NAME); + assertTrue(requestArgumentCaptor.getValue().context().containsKey(RequestHandlerSpec.ATTRIBUTE_NAME)); } private static JettyTestDriver newDriver(MyRequestHandler requestHandler, FilterBindings filterBindings) { diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java index 97237e1c016..c4c9161ccfb 100644 --- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java +++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerTest.java @@ -38,7 +38,6 @@ import org.apache.hc.client5.http.entity.mime.StringBody; import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient; import org.apache.hc.core5.http.ConnectionClosedException; import org.apache.hc.core5.http.ContentType; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -85,12 +84,11 @@ import static com.yahoo.jdisc.http.server.jetty.Utils.createHttp2Client; import static com.yahoo.jdisc.http.server.jetty.Utils.createSslTestDriver; import static com.yahoo.jdisc.http.server.jetty.Utils.generatePrivateKeyAndCertificate; import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.startsWith; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.matchesPattern; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; @@ -127,7 +125,7 @@ public class HttpServerTest { .listenPort(driver.server().getListenPort()) ); } catch (final Throwable t) { - assertThat(t.getCause(), instanceOf(BindException.class)); + assertTrue(t.getCause() instanceof BindException); } assertTrue(driver.close()); } @@ -191,7 +189,7 @@ public class HttpServerTest { .expectStatusCode(is(REQUEST_URI_TOO_LONG)); RequestLogEntry entry = requestLogMock.poll(Duration.ofSeconds(5)); assertEquals(414, entry.statusCode().getAsInt()); - assertThat(driver.close(), is(true)); + assertTrue(driver.close()); } @Test @@ -473,7 +471,7 @@ public class HttpServerTest { final JettyTestDriver driver = JettyTestDriver.newInstance(new EchoWithHeaderRequestHandler(CONNECTION, CLOSE)); driver.client().get("/status.html") .expectHeader(CONNECTION, is(CLOSE)); - assertThat(driver.close(), is(true)); + assertTrue(driver.close()); } @Test @@ -583,7 +581,7 @@ public class HttpServerTest { driver.client().get("/status.html") .expectStatusCode(is(OK)) .expectContent(matchesPattern("\\d{13,}")); - assertThat(driver.close(), is(true)); + assertTrue(driver.close()); } @Test @@ -689,25 +687,25 @@ public class HttpServerTest { } assertTrue(driver.close()); List<ConnectionLogEntry> logEntries = connectionLog.logEntries(); - Assertions.assertThat(logEntries).hasSize(1); + assertEquals(1, logEntries.size()); ConnectionLogEntry logEntry = logEntries.get(0); assertEquals(4, UUID.fromString(logEntry.id()).version()); - Assertions.assertThat(logEntry.timestamp()).isAfter(Instant.EPOCH); - Assertions.assertThat(logEntry.requests()).hasValue(100L); - Assertions.assertThat(logEntry.responses()).hasValue(100L); - Assertions.assertThat(logEntry.peerAddress()).hasValue("127.0.0.1"); - Assertions.assertThat(logEntry.localAddress()).hasValue("127.0.0.1"); - Assertions.assertThat(logEntry.localPort()).hasValue(listenPort); - Assertions.assertThat(logEntry.httpBytesReceived()).hasValueSatisfying(value -> Assertions.assertThat(value).isGreaterThan(100000L)); - Assertions.assertThat(logEntry.httpBytesSent()).hasValueSatisfying(value -> Assertions.assertThat(value).isGreaterThan(10000L)); - Assertions.assertThat(logEntry.sslProtocol()).hasValueSatisfying(TlsContext.ALLOWED_PROTOCOLS::contains); - Assertions.assertThat(logEntry.sslPeerSubject()).hasValue("CN=localhost"); - Assertions.assertThat(logEntry.sslCipherSuite()).hasValueSatisfying(cipher -> Assertions.assertThat(cipher).isNotBlank()); - Assertions.assertThat(logEntry.sslSessionId()).hasValueSatisfying(sessionId -> Assertions.assertThat(sessionId).hasSize(64)); - Assertions.assertThat(logEntry.sslPeerNotBefore()).hasValue(Instant.EPOCH); - Assertions.assertThat(logEntry.sslPeerNotAfter()).hasValue(Instant.EPOCH.plus(100_000, ChronoUnit.DAYS)); - Assertions.assertThat(logEntry.sslBytesReceived()).hasValueSatisfying(value -> Assertions.assertThat(value).isGreaterThan(100000L)); - Assertions.assertThat(logEntry.sslBytesSent()).hasValueSatisfying(value -> Assertions.assertThat(value).isGreaterThan(10000L)); + assertTrue(logEntry.timestamp().isAfter(Instant.EPOCH)); + assertEquals(100L, logEntry.requests().get()); + assertEquals(100L, logEntry.responses().get()); + assertEquals("127.0.0.1", logEntry.peerAddress().get()); + assertEquals("127.0.0.1", logEntry.localAddress().get()); + assertEquals(listenPort, logEntry.localPort().get()); + assertTrue(logEntry.httpBytesReceived().get() > 100000L); + assertTrue(logEntry.httpBytesSent().get() > 10000L); + assertTrue(TlsContext.ALLOWED_PROTOCOLS.contains(logEntry.sslProtocol().get())); + assertEquals("CN=localhost", logEntry.sslPeerSubject().get()); + assertFalse(logEntry.sslCipherSuite().get().isBlank()); + assertEquals(64, logEntry.sslSessionId().get().length()); + assertEquals(Instant.EPOCH, logEntry.sslPeerNotBefore().get()); + assertEquals(Instant.EPOCH.plus(100_000, ChronoUnit.DAYS), logEntry.sslPeerNotAfter().get()); + assertTrue(logEntry.sslBytesReceived().get() > 100000L); + assertTrue(logEntry.sslBytesSent().get() > 10000L); } @Test @@ -720,9 +718,9 @@ public class HttpServerTest { binder -> binder.bind(RequestLog.class).toInstance(requestLogMock)); driver.client().newPost("/status.html").setContent("abcdef").execute().expectStatusCode(is(OK)); RequestLogEntry entry = requestLogMock.poll(Duration.ofSeconds(5)); - Assertions.assertThat(entry.statusCode()).hasValue(200); - Assertions.assertThat(entry.requestSize()).hasValue(6); - assertThat(driver.close(), is(true)); + assertEquals(200, entry.statusCode().getAsInt()); + assertEquals(6, entry.requestSize().getAsLong()); + assertTrue(driver.close()); } @Test @@ -734,7 +732,7 @@ public class HttpServerTest { InMemoryConnectionLog connectionLog = new InMemoryConnectionLog(); JettyTestDriver driver = createSslTestDriver(certificateFile, privateKeyFile, metricConsumer, connectionLog); driver.client().get("/").expectStatusCode(is(OK)); - assertThat(driver.close(), is(true)); + assertTrue(driver.close()); verify(metricConsumer.mockitoMock(), atLeast(1)) .set(MetricDefinitions.REQUESTS_PER_CONNECTION, 1L, MetricConsumerMock.STATIC_CONTEXT); } diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java index 246b7875692..811a8006720 100644 --- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java +++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/ProxyProtocolTest.java @@ -29,7 +29,6 @@ import java.util.logging.Logger; import static com.yahoo.jdisc.http.server.jetty.Utils.generatePrivateKeyAndCertificate; import static com.yahoo.yolean.Exceptions.uncheckInterrupted; -import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.jetty.client.ProxyProtocolClientConnectionFactory.V1; import static org.eclipse.jetty.client.ProxyProtocolClientConnectionFactory.V2; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -206,14 +205,14 @@ class ProxyProtocolTest { private static void assertLogEntryHasRemote(ConnectionLogEntry entry, String expectedAddress, int expectedPort) { if (expectedAddress != null) { - assertThat(entry.remoteAddress()).hasValue(expectedAddress); + assertEquals(expectedAddress, entry.remoteAddress().get()); } else { - assertThat(entry.remoteAddress()).isEmpty(); + assertTrue(entry.remoteAddress().isEmpty()); } if (expectedPort > 0) { - assertThat(entry.remotePort()).hasValue(expectedPort); + assertEquals(expectedPort, entry.remotePort().get()); } else { - assertThat(entry.remotePort()).isEmpty(); + assertTrue(entry.remotePort().isEmpty()); } } @@ -227,8 +226,8 @@ class ProxyProtocolTest { await(waitCondition); assertTrue(driver.close()); if (waitCondition.test(null)) await(waitCondition); - assertThat(reqLog.entries()).hasSize(expectedReqLogSize); - assertThat(connLog.logEntries()).hasSize(expectedConnLogSize); + assertEquals(expectedReqLogSize, reqLog.entries().size()); + assertEquals(expectedConnLogSize, connLog.logEntries().size()); } private static void await(Predicate<Void> waitCondition) { diff --git a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java index 99fa9bb2052..22699efbd46 100644 --- a/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java +++ b/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/SslHandshakeMetricsTest.java @@ -21,7 +21,6 @@ import java.util.logging.Logger; import static com.yahoo.jdisc.http.server.jetty.Utils.createSslTestDriver; import static com.yahoo.jdisc.http.server.jetty.Utils.generatePrivateKeyAndCertificate; -import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -59,7 +58,7 @@ class SslHandshakeMetricsTest { verify(metricConsumer.mockitoMock(), atLeast(1)) .add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_MISSING_CLIENT_CERT, 1L, MetricConsumerMock.STATIC_CONTEXT); assertTrue(driver.close()); - assertThat(connectionLog.logEntries()).hasSize(1); + assertEquals(1, connectionLog.logEntries().size()); assertSslHandshakeFailurePresent( connectionLog.logEntries().get(0), SSLHandshakeException.class, SslHandshakeFailure.MISSING_CLIENT_CERT.failureType()); } @@ -82,7 +81,7 @@ class SslHandshakeMetricsTest { verify(metricConsumer.mockitoMock(), atLeast(1)) .add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_INCOMPATIBLE_PROTOCOLS, 1L, MetricConsumerMock.STATIC_CONTEXT); assertTrue(driver.close()); - assertThat(connectionLog.logEntries()).hasSize(1); + assertEquals(1, connectionLog.logEntries().size()); assertSslHandshakeFailurePresent( connectionLog.logEntries().get(0), SSLHandshakeException.class, SslHandshakeFailure.INCOMPATIBLE_PROTOCOLS.failureType()); } @@ -103,7 +102,7 @@ class SslHandshakeMetricsTest { verify(metricConsumer.mockitoMock(), atLeast(1)) .add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_INCOMPATIBLE_CIPHERS, 1L, MetricConsumerMock.STATIC_CONTEXT); assertTrue(driver.close()); - assertThat(connectionLog.logEntries()).hasSize(1); + assertEquals(1, connectionLog.logEntries().size()); assertSslHandshakeFailurePresent( connectionLog.logEntries().get(0), SSLHandshakeException.class, SslHandshakeFailure.INCOMPATIBLE_CIPHERS.failureType()); } @@ -128,7 +127,7 @@ class SslHandshakeMetricsTest { verify(metricConsumer.mockitoMock(), atLeast(1)) .add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_INVALID_CLIENT_CERT, 1L, MetricConsumerMock.STATIC_CONTEXT); assertTrue(driver.close()); - assertThat(connectionLog.logEntries()).hasSize(1); + assertEquals(1, connectionLog.logEntries().size()); assertSslHandshakeFailurePresent( connectionLog.logEntries().get(0), SSLHandshakeException.class, SslHandshakeFailure.INVALID_CLIENT_CERT.failureType()); } @@ -153,7 +152,7 @@ class SslHandshakeMetricsTest { verify(metricConsumer.mockitoMock(), atLeast(1)) .add(MetricDefinitions.SSL_HANDSHAKE_FAILURE_EXPIRED_CLIENT_CERT, 1L, MetricConsumerMock.STATIC_CONTEXT); assertTrue(driver.close()); - assertThat(connectionLog.logEntries()).hasSize(1); + assertEquals(1, connectionLog.logEntries().size()); } @@ -169,7 +168,7 @@ class SslHandshakeMetricsTest { client.get("/status.html"); fail("SSLHandshakeException expected"); } catch (SSLHandshakeException e) { - assertThat(e.getMessage()).contains(expectedExceptionSubstring); + assertTrue(e.getMessage().contains(expectedExceptionSubstring)); } catch (SocketException | SSLException e) { // This exception is thrown if Apache httpclient's write thread detects the handshake failure before the read thread. var msg = e.getMessage(); @@ -182,7 +181,7 @@ class SslHandshakeMetricsTest { private static void assertSslHandshakeFailurePresent( ConnectionLogEntry entry, Class<? extends SSLHandshakeException> expectedException, String expectedType) { - assertThat(entry.sslHandshakeFailure()).isPresent(); + assertTrue(entry.sslHandshakeFailure().isPresent()); ConnectionLogEntry.SslHandshakeFailure failure = entry.sslHandshakeFailure().get(); assertEquals(expectedType, failure.type()); ConnectionLogEntry.SslHandshakeFailure.ExceptionEntry exceptionEntry = failure.exceptionChain().get(0); diff --git a/container-dependencies-enforcer/pom.xml b/container-dependencies-enforcer/pom.xml index 2706b95cfb1..3c991823d5d 100644 --- a/container-dependencies-enforcer/pom.xml +++ b/container-dependencies-enforcer/pom.xml @@ -160,6 +160,9 @@ <include>io.airlift:airline:${airline.vespa.version}:test</include> <include>io.prometheus:simpleclient:${prometheus.client.vespa.version}:test</include> <include>io.prometheus:simpleclient_common:${prometheus.client.vespa.version}:test</include> + <include>io.prometheus:simpleclient_tracer_common:${prometheus.client.vespa.version}:test</include> + <include>io.prometheus:simpleclient_tracer_otel:${prometheus.client.vespa.version}:test</include> + <include>io.prometheus:simpleclient_tracer_otel_agent:${prometheus.client.vespa.version}:test</include> <include>junit:junit:${junit4.vespa.version}:test</include> <include>net.java.dev.jna:jna:${jna.vespa.version}:test</include> <include>net.openhft:zero-allocation-hashing:jar:${zero-allocation-hashing.vespa.version}:test</include> diff --git a/container-disc/pom.xml b/container-disc/pom.xml index 65a03b48c59..164e74c5073 100644 --- a/container-disc/pom.xml +++ b/container-disc/pom.xml @@ -42,17 +42,12 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> + <groupId>com.yahoo.vespa</groupId> + <artifactId>annotations</artifactId> + <version>${project.version}</version> + <scope>provided</scope> </dependency> - <dependency> - <groupId>com.yahoo.vespa</groupId> - <artifactId>annotations</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> - <dependency> + <dependency> <groupId>com.yahoo.vespa</groupId> <artifactId>config-lib</artifactId> <version>${project.version}</version> diff --git a/container-search/pom.xml b/container-search/pom.xml index 31ce9a00e44..4c1d337d8ad 100644 --- a/container-search/pom.xml +++ b/container-search/pom.xml @@ -162,11 +162,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <scope>test</scope> diff --git a/container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java index f8e67a10076..6d02721c15e 100644 --- a/container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/grouping/vespa/RequestBuilderTestCase.java @@ -25,10 +25,8 @@ import com.yahoo.searchlib.expression.StrCatFunctionNode; import com.yahoo.searchlib.expression.StringResultNode; import com.yahoo.searchlib.expression.TimeStampFunctionNode; import com.yahoo.searchlib.expression.ToStringFunctionNode; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; -import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -468,29 +466,29 @@ public class RequestBuilderTestCase { String expectedA = "[{ Attribute, result = [Count] }]"; assertLayout("all(group(a) each(output(count())))", - Arrays.asList(expectedA).toString()); + List.of(expectedA).toString()); assertLayout("all(group(a) each(output(count()) all()))", - Arrays.asList(expectedA).toString()); + List.of(expectedA).toString()); assertLayout("all(group(a) each(output(count()) all(group(b))))", - Arrays.asList(expectedA).toString()); + List.of(expectedA).toString()); assertLayout("all(group(a) each(output(count()) all(group(b) each())))", - Arrays.asList(expectedA).toString()); + List.of(expectedA).toString()); assertLayout("all(group(a) each(output(count()) all(group(b) each())))", - Arrays.asList(expectedA).toString()); + List.of(expectedA).toString()); assertLayout("all(group(a) each(output(count()) all(group(b) each())) as(foo)" + " each())", - Arrays.asList(expectedA).toString()); + List.of(expectedA).toString()); assertLayout("all(group(a) each(output(count()) all(group(b) each())) as(foo)" + " each(group(b)))", - Arrays.asList(expectedA).toString()); + List.of(expectedA).toString()); assertLayout("all(group(a) each(output(count()) all(group(b) each())) as(foo)" + " each(group(b) each()))", - Arrays.asList(expectedA).toString()); + List.of(expectedA).toString()); String expectedB = "[{ Attribute }, { Attribute, result = [Count] }]"; assertLayout("all(group(a) each(output(count()) all(group(b) each())) as(foo)" + " each(group(b) each(output(count()))))", - Arrays.asList(expectedB, expectedA).toString()); + List.of(expectedB, expectedA).toString()); } @Test @@ -650,8 +648,8 @@ public class RequestBuilderTestCase { @Test void requireThatTimeZoneIsAppliedToTimeFunctions() { - for (String timePart : Arrays.asList("dayofmonth", "dayofweek", "dayofyear", "hourofday", - "minuteofhour", "monthofyear", "secondofminute", "year")) + for (String timePart : List.of("dayofmonth", "dayofweek", "dayofyear", "hourofday", + "minuteofhour", "monthofyear", "secondofminute", "year")) { String request = "all(output(avg(time." + timePart + "(foo))))"; assertTimeZone(request, "GMT-2", -7200L); @@ -686,7 +684,7 @@ public class RequestBuilderTestCase { test.expectedOutput = Boolean.toString(true); test.request = "all(output(avg(now() - foo)))"; test.outputWriter = new OutputWriter() { - long before = System.currentTimeMillis(); + final long before = System.currentTimeMillis(); @Override public String write(List<Grouping> groupingList, GroupingTransform transform) { @@ -836,7 +834,7 @@ public class RequestBuilderTestCase { builder.build(); fail(); } catch (IllegalInputException e) { - Assertions.assertThat(e.getMessage()).contains(errorSubstring); + assertTrue(e.getMessage().contains(errorSubstring)); } } @@ -924,7 +922,7 @@ public class RequestBuilderTestCase { RequestBuilder builder = new RequestBuilder(0); builder.setRootOperation(GroupingOperation.fromString(test.request)); builder.setTimeZone(TimeZone.getTimeZone(test.timeZone)); - builder.addContinuations(Arrays.asList(test.continuation)); + builder.addContinuations(test.continuation != null ? List.of(test.continuation) : List.of()); try { builder.build(); if (test.expectedException != null) { diff --git a/container-search/src/test/java/com/yahoo/search/handler/JSONSearchHandlerTestCase.java b/container-search/src/test/java/com/yahoo/search/handler/JSONSearchHandlerTestCase.java index 7536a8c4914..7b8015044c6 100644 --- a/container-search/src/test/java/com/yahoo/search/handler/JSONSearchHandlerTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/handler/JSONSearchHandlerTestCase.java @@ -16,7 +16,6 @@ import com.yahoo.search.searchchain.config.test.SearchChainConfigurerTestCase; import com.yahoo.slime.Inspector; import com.yahoo.slime.SlimeUtils; import com.yahoo.test.json.JsonTestHelper; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -149,7 +148,7 @@ public class JSONSearchHandlerTestCase { configurer.reloadConfig(); SearchHandler newSearchHandler = fetchSearchHandler(configurer); - assertTrue(searchHandler != newSearchHandler, "Do I have a new instance of the search handler?"); + assertNotSame(searchHandler, newSearchHandler, "Do I have a new instance of the search handler?"); try (RequestHandlerTestDriver newDriver = new RequestHandlerTestDriver(newSearchHandler)) { ObjectNode json = jsonMapper.createObjectNode(); json.put("yql", "selectz * from foo where bar > 1453501295"); @@ -193,13 +192,15 @@ public class JSONSearchHandlerTestCase { ObjectNode json = jsonMapper.createObjectNode(); json.put("format", "xml"); - assertEquals("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + - "<result total-hit-count=\"0\">\n" + - " <hit relevancy=\"1.0\">\n" + - " <field name=\"relevancy\">1.0</field>\n" + - " <field name=\"uri\">testHit</field>\n" + - " </hit>\n" + - "</result>\n", driver.sendRequest(uri, com.yahoo.jdisc.http.HttpRequest.Method.POST, json.toString(), JSON_CONTENT_TYPE).readAll()); + assertEquals(""" + <?xml version="1.0" encoding="utf-8" ?> + <result total-hit-count="0"> + <hit relevancy="1.0"> + <field name="relevancy">1.0</field> + <field name="uri">testHit</field> + </hit> + </result> + """, driver.sendRequest(uri, com.yahoo.jdisc.http.HttpRequest.Method.POST, json.toString(), JSON_CONTENT_TYPE).readAll()); } @Test @@ -253,13 +254,15 @@ public class JSONSearchHandlerTestCase { } private static final String xmlResult = - "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + - "<result total-hit-count=\"0\">\n" + - " <hit relevancy=\"1.0\">\n" + - " <field name=\"relevancy\">1.0</field>\n" + - " <field name=\"uri\">testHit</field>\n" + - " </hit>\n" + - "</result>\n"; + """ + <?xml version="1.0" encoding="utf-8" ?> + <result total-hit-count="0"> + <hit relevancy="1.0"> + <field name="relevancy">1.0</field> + <field name="uri">testHit</field> + </hit> + </result> + """; private void assertXmlResult(JsonNode json, RequestHandlerTestDriver driver) { assertOkResult(driver.sendRequest(uri, com.yahoo.jdisc.http.HttpRequest.Method.POST, json.toString(), JSON_CONTENT_TYPE), xmlResult); @@ -276,19 +279,6 @@ public class JSONSearchHandlerTestCase { } - private static final String pageResult = - "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + - "<page version=\"1.0\">\n" + - "\n" + - " <content>\n" + - " <hit relevance=\"1.0\">\n" + - " <id>testHit</id>\n" + - " <uri>testHit</uri>\n" + - " </hit>\n" + - " </content>\n" + - "\n" + - "</page>\n"; - private void assertOkResult(RequestHandlerTestDriver.MockResponseHandler response, String expected) { assertEquals(expected, response.readAll()); assertEquals(200, response.getStatus()); @@ -302,7 +292,7 @@ public class JSONSearchHandlerTestCase { configurer.reloadConfig(); SearchHandler newSearchHandler = fetchSearchHandler(configurer); - assertTrue(searchHandler != newSearchHandler, "Do I have a new instance of the search handler?"); + assertNotSame(searchHandler, newSearchHandler, "Do I have a new instance of the search handler?"); return new RequestHandlerTestDriver(newSearchHandler); } @@ -368,23 +358,25 @@ public class JSONSearchHandlerTestCase { @Test void testJsonWithWhereAndGroupingUnderSelect() { - String query = "{\n" + - " \"select\": {\n" + - " \"where\": {\n" + - " \"contains\": [\n" + - " \"field\",\n" + - " \"term\"\n" + - " ]\n" + - " },\n" + - " \"grouping\":[\n" + - " {\n" + - " \"all\": {\n" + - " \"output\": \"count()\"\n" + - " }\n" + - " }\n" + - " ]\n" + - " }\n" + - "}\n"; + String query = """ + { + "select": { + "where": { + "contains": [ + "field", + "term" + ] + }, + "grouping":[ + { + "all": { + "output": "count()" + } + } + ] + } + } + """; String result = driver.sendRequest(uri + "searchChain=echoingQuery", com.yahoo.jdisc.http.HttpRequest.Method.POST, query, JSON_CONTENT_TYPE).readAll(); String expected = "{\"root\":{\"id\":\"toplevel\",\"relevance\":1.0,\"fields\":{\"totalCount\":0},\"children\":[{\"id\":\"Query\",\"relevance\":1.0,\"fields\":{\"query\":\"select * from sources * where field contains \\\"term\\\" | all(output(count()))\"}}]}}"; @@ -393,21 +385,23 @@ public class JSONSearchHandlerTestCase { @Test void testJsonWithWhereAndGroupingSeparate() { - String query = "{\n" + - " \"select.where\": {\n" + - " \"contains\": [\n" + - " \"field\",\n" + - " \"term\"\n" + - " ]\n" + - " },\n" + - " \"select.grouping\":[\n" + - " {\n" + - " \"all\": {\n" + - " \"output\": \"count()\"\n" + - " }\n" + - " }\n" + - " ]\n" + - "}\n"; + String query = """ + { + "select.where": { + "contains": [ + "field", + "term" + ] + }, + "select.grouping":[ + { + "all": { + "output": "count()" + } + } + ] + } + """; String result = driver.sendRequest(uri + "searchChain=echoingQuery", com.yahoo.jdisc.http.HttpRequest.Method.POST, query, JSON_CONTENT_TYPE).readAll(); String expected = "{\"root\":{\"id\":\"toplevel\",\"relevance\":1.0,\"fields\":{\"totalCount\":0},\"children\":[{\"id\":\"Query\",\"relevance\":1.0,\"fields\":{\"query\":\"select * from sources * where field contains \\\"term\\\" | all(output(count()))\"}}]}}"; @@ -539,7 +533,7 @@ public class JSONSearchHandlerTestCase { // Get mapping Map<String, String> propertyMap = request.propertyMap(); - Assertions.assertThat(propertyMap).isEqualTo(map); + assertEquals(propertyMap, map); } @Test diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index bac2c0ab9d7..6d746c85d72 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -682,7 +682,9 @@ public class ApplicationController { if (testerCertificate.isPresent()) { operatorCertificates = Stream.concat(operatorCertificates.stream(), testerCertificate.stream()).toList(); } - Supplier<Optional<CloudAccount>> cloudAccount = () -> decideCloudAccountOf(deployment, applicationPackage.truncatedPackage().deploymentSpec()); + Supplier<Optional<CloudAccount>> cloudAccount = () -> decideCloudAccountOf(deployment, + zone.environment().isTest() ? requireApplication(TenantAndApplicationId.from(application)).deploymentSpec() + : applicationPackage.truncatedPackage().deploymentSpec()); List<DataplaneTokenVersions> dataplaneTokenVersions = controller.dataplaneTokenService().listTokens(application.tenant()); Supplier<Optional<EndpointCertificate>> endpointCertificateWrapper = () -> { Optional<EndpointCertificate> data = endpointCertificate.get(); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java index 07695c17042..0ce3a3d75d4 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java @@ -131,15 +131,15 @@ public class InternalStepRunner implements StepRunner { try { return switch (step.get()) { case deployTester -> deployTester(id, logger); + case installTester -> installTester(id, logger); case deployInitialReal -> deployInitialReal(id, logger); case installInitialReal -> installInitialReal(id, logger); case deployReal -> deployReal(id, logger); - case installTester -> installTester(id, logger); case installReal -> installReal(id, logger); case startStagingSetup -> startTests(id, true, logger); case endStagingSetup -> endTests(id, true, logger); - case endTests -> endTests(id, false, logger); case startTests -> startTests(id, false, logger); + case endTests -> endTests(id, false, logger); case copyVespaLogs -> copyVespaLogs(id, logger); case deactivateReal -> deactivateReal(id, logger); case deactivateTester -> deactivateTester(id, logger); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java index 622653e6f84..40b51e692f3 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.component.Version; import com.yahoo.config.provision.CloudName; -import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.zone.NodeSlice; import com.yahoo.config.provision.zone.ZoneApi; import com.yahoo.text.Text; @@ -52,11 +51,7 @@ public class SystemUpgrader extends InfrastructureUpgrader<VespaVersionTarget> { @Override protected boolean expectUpgradeOf(Node node, SystemApplication application, ZoneApi zone) { - // Temporary hack until GCP enclave works again - if (zone.getCloudName().equals(CloudName.GCP) && node.hostname().value().startsWith("e")) - return false; - - return eligibleForUpgrade(node); + return eligibleForUpgrade(node, zone); } @Override @@ -96,7 +91,11 @@ public class SystemUpgrader extends InfrastructureUpgrader<VespaVersionTarget> { } /** Returns whether node in application should be upgraded by this */ - public static boolean eligibleForUpgrade(Node node) { + public static boolean eligibleForUpgrade(Node node, ZoneApi zone) { + // Temporary hack until GCP enclave works again + if (zone.getCloudName().equals(CloudName.GCP) && node.hostname().value().startsWith("e")) + return false; + return upgradableNodeStates.contains(node.state()); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java index 9fb87735b42..a93c0dfda76 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/VersionStatus.java @@ -185,7 +185,7 @@ public record VersionStatus(List<VespaVersion> versions, int currentMajor) { for (var application : SystemApplication.notController()) { var nodes = controller.serviceRegistry().configServer().nodeRepository() .list(zone.getId(), NodeFilter.all().applications(application.id())).stream() - .filter(SystemUpgrader::eligibleForUpgrade) + .filter(node -> SystemUpgrader.eligibleForUpgrade(node, zone)) .toList(); if (nodes.isEmpty()) continue; boolean configConverged = application.configConvergedIn(zone.getId(), controller, Optional.empty()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgraderTest.java index d3d66715202..a3595ca587c 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgraderTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgraderTest.java @@ -16,7 +16,6 @@ import org.junit.jupiter.api.Test; import java.time.Duration; import java.util.List; import java.util.function.Function; -import java.util.stream.Collectors; import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -463,7 +462,7 @@ public class SystemUpgraderTest { private List<Node> listNodes(ZoneApi zone, SystemApplication application) { return nodeRepository().list(zone.getId(), NodeFilter.all().applications(application.id())).stream() - .filter(SystemUpgrader::eligibleForUpgrade) + .filter(node -> SystemUpgrader.eligibleForUpgrade(node, zone)) .toList(); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java index 0bf2610ae14..4eb6e080737 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiCloudTest.java @@ -27,7 +27,6 @@ import com.yahoo.vespa.hosted.controller.security.Auth0Credentials; import com.yahoo.vespa.hosted.controller.security.CloudTenantSpec; import com.yahoo.vespa.hosted.controller.security.Credentials; import com.yahoo.vespa.hosted.controller.tenant.CloudTenant; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -35,7 +34,6 @@ import java.io.File; import java.util.Collections; import java.util.Optional; import java.util.Set; -import java.util.regex.Pattern; import static com.yahoo.application.container.handler.Request.Method.DELETE; import static com.yahoo.application.container.handler.Request.Method.GET; @@ -471,13 +469,13 @@ public class ApplicationApiCloudTest extends ControllerContainerCloudTest { String regexGenerateToken = "\\{\"id\":\"myTokenId\",\"token\":\"vespa_cloud_.*\",\"fingerprint\":\".*\"}"; tester.assertResponse(request("/application/v4/tenant/scoober/token/myTokenId", POST).roles(Role.developer(tenantName)), - (response) -> Assertions.assertThat(new String(response.getBody(), UTF_8)).matches(Pattern.compile(regexGenerateToken)), + (response) -> assertTrue(new String(response.getBody(), UTF_8).matches(regexGenerateToken)), 200); String regexListTokens = "\\{\"tokens\":\\[\\{\"id\":\"myTokenId\",\"versions\":\\[\\{\"fingerprint\":\".*\",\"created\":\".*\",\"author\":\"user@test\",\"expiration\":\".*\"}]}]}"; tester.assertResponse(request("/application/v4/tenant/scoober/token", GET) .roles(Role.developer(tenantName)), - (response) -> Assertions.assertThat(new String(response.getBody(), UTF_8)).matches(Pattern.compile(regexListTokens)), + (response) -> assertTrue(new String(response.getBody(), UTF_8).matches(regexListTokens)), 200); // Rejects invalid tokenIds on create diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/dataplanetoken/DataplaneTokenServiceTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/dataplanetoken/DataplaneTokenServiceTest.java index e148eac7365..acfba03a700 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/dataplanetoken/DataplaneTokenServiceTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/dataplanetoken/DataplaneTokenServiceTest.java @@ -15,8 +15,9 @@ import java.security.Principal; import java.time.Duration; import java.util.Collection; import java.util.List; +import java.util.Set; -import static org.assertj.core.api.Assertions.assertThat; +import static java.util.stream.Collectors.toSet; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -43,13 +44,13 @@ public class DataplaneTokenServiceTest { assertNotEquals(dataplaneToken1.fingerPrint(), dataplaneToken2.fingerPrint()); List<DataplaneTokenVersions> dataplaneTokenVersions = dataplaneTokenService.listTokens(tenantName); - List<FingerPrint> tokenFingerprints = dataplaneTokenVersions.stream() + Set<FingerPrint> tokenFingerprints = dataplaneTokenVersions.stream() .filter(token -> token.tokenId().equals(tokenId)) .map(DataplaneTokenVersions::tokenVersions) .flatMap(Collection::stream) .map(DataplaneTokenVersions.Version::fingerPrint) - .toList(); - assertThat(tokenFingerprints).containsExactlyInAnyOrder(dataplaneToken1.fingerPrint(), dataplaneToken2.fingerPrint()); + .collect(toSet()); + assertEquals(tokenFingerprints, Set.of(dataplaneToken1.fingerPrint(), dataplaneToken2.fingerPrint())); } @Test diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployResultTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployResultTest.java index d0d362abcfc..8d643534e0c 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployResultTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployResultTest.java @@ -10,11 +10,12 @@ import com.yahoo.vespa.hosted.controller.integration.ZoneRegistryMock; import org.junit.jupiter.api.Test; import java.util.List; +import java.util.Set; import static com.yahoo.vespa.hosted.controller.restapi.systemflags.SystemFlagsDeployResult.FlagDataChange; import static com.yahoo.vespa.hosted.controller.restapi.systemflags.SystemFlagsDeployResult.OperationError; import static com.yahoo.vespa.hosted.controller.restapi.systemflags.SystemFlagsDeployResult.merge; -import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author bjorncs @@ -29,17 +30,15 @@ public class SystemFlagsDeployResultTest { FlagId flagOne = new FlagId("flagone"); FlagId flagTwo = new FlagId("flagtwo"); SystemFlagsDeployResult result = new SystemFlagsDeployResult( - List.of( - FlagDataChange.deleted(flagOne, controllerTarget)), - List.of( - OperationError.deleteFailed("delete failed", controllerTarget, flagTwo)), + List.of(FlagDataChange.deleted(flagOne, controllerTarget)), + List.of(OperationError.deleteFailed("delete failed", controllerTarget, flagTwo)), List.of()); WireSystemFlagsDeployResult wire = result.toWire(); - assertThat(wire.changes).hasSize(1); - assertThat(wire.changes.get(0).flagId).isEqualTo(flagOne.toString()); - assertThat(wire.errors).hasSize(1); - assertThat(wire.errors.get(0).flagId).isEqualTo(flagTwo.toString()); + assertEquals(1, wire.changes.size()); + assertEquals(wire.changes.get(0).flagId, flagOne.toString()); + assertEquals(1, wire.errors.size()); + assertEquals(wire.errors.get(0).flagId, flagTwo.toString()); } @Test @@ -65,13 +64,13 @@ public class SystemFlagsDeployResultTest { SystemFlagsDeployResult mergedResult = merge(results); List<FlagDataChange> changes = mergedResult.flagChanges(); - assertThat(changes).hasSize(1); + assertEquals(1, changes.size()); FlagDataChange change = changes.get(0); - assertThat(change.targets()).containsOnly(controllerTarget, prodUsWest1Target); + assertEquals(change.targets(), Set.of(controllerTarget, prodUsWest1Target)); List<OperationError> errors = mergedResult.errors(); - assertThat(errors).hasSize(1); + assertEquals(1, errors.size()); OperationError error = errors.get(0); - assertThat(error.targets()).containsOnly(controllerTarget, prodUsWest1Target); + assertEquals(error.targets(), Set.of(controllerTarget, prodUsWest1Target)); } }
\ No newline at end of file diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployerTest.java index 8ad64a08244..cb330d28d22 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/systemflags/SystemFlagsDeployerTest.java @@ -25,6 +25,7 @@ import static com.yahoo.vespa.hosted.controller.restapi.systemflags.SystemFlagsD import static com.yahoo.yolean.Exceptions.uncheck; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; @@ -174,7 +175,7 @@ public class SystemFlagsDeployerTest { assertThat(result.flagChanges()).containsOnly( FlagDataChange.created(FLAG_ID, controllerTarget, defaultData)); - assertThat(result.errors()).isEmpty(); + assertTrue(result.errors().isEmpty()); } @Test @@ -209,8 +210,7 @@ public class SystemFlagsDeployerTest { .build(); SystemFlagsDeployer deployer = new SystemFlagsDeployer(flagsClient, SYSTEM, Set.of(controllerTarget)); SystemFlagsDeployResult result = deployer.deployFlags(archive, false); - assertThat(result.flagChanges()) - .isEmpty(); + assertTrue(result.flagChanges().isEmpty()); assertThat(result.errors()) .containsOnly(OperationError.archiveValidationFailed("Unknown flag file: flags/my-flag/main.prod.unknown-region.json")); } diff --git a/dependency-versions/pom.xml b/dependency-versions/pom.xml index 5ff4513cdc6..5f46152036d 100644 --- a/dependency-versions/pom.xml +++ b/dependency-versions/pom.xml @@ -59,7 +59,8 @@ <apache.httpclient5.vespa.version>5.2.1</apache.httpclient5.vespa.version> <apache.httpcore5.vespa.version>5.2.2</apache.httpcore5.vespa.version> <apiguardian.vespa.version>1.1.2</apiguardian.vespa.version> - <asm.vespa.version>9.3</asm.vespa.version> + <asm.vespa.version>9.5</asm.vespa.version> + <assertj.vespa.version>3.24.2</assertj.vespa.version> <!-- Athenz dependencies. Make sure these dependencies match those in Vespa's internal repositories --> <athenz.vespa.version>1.11.34</athenz.vespa.version> @@ -73,7 +74,7 @@ xargs perl -pi -e 's/major = [0-9]+, minor = [0-9]+, micro = [0-9]+/major = 5, minor = 3, micro = 0/g' --> <bouncycastle.vespa.version>1.76</bouncycastle.vespa.version> - <curator.vespa.version>5.4.0</curator.vespa.version> + <checker-qual.vespa.version>3.37.0</checker-qual.vespa.version> <commons-codec.vespa.version>1.16.0</commons-codec.vespa.version> <commons-csv.vespa.version>1.10.0</commons-csv.vespa.version> <commons-exec.vespa.version>1.3</commons-exec.vespa.version> @@ -81,6 +82,8 @@ <commons-lang3.vespa.version>3.13.0</commons-lang3.vespa.version> <commons.math3.vespa.version>3.6.1</commons.math3.vespa.version> <commons-compress.vespa.version>1.23.0</commons-compress.vespa.version> + <curator.vespa.version>5.4.0</curator.vespa.version> + <dropwizard.metrics.vespa.version>3.2.6</dropwizard.metrics.vespa.version> <eclipse-collections.vespa.version>11.1.0</eclipse-collections.vespa.version> <felix.vespa.version>7.0.5</felix.vespa.version> <felix.log.vespa.version>1.0.1</felix.log.vespa.version> @@ -94,6 +97,7 @@ <jersey.vespa.version>2.25</jersey.vespa.version> <jetty.vespa.version>11.0.15</jetty.vespa.version> <jetty-servlet-api.vespa.version>5.0.2</jetty-servlet-api.vespa.version> + <jimfs.vespa.version>1.3.0</jimfs.vespa.version> <jna.vespa.version>5.13.0</jna.vespa.version> <joda-time.vespa.version>2.12.5</joda-time.vespa.version> <junit.vespa.version>5.8.1</junit.vespa.version> @@ -103,18 +107,19 @@ <lucene.vespa.version>9.7.0</lucene.vespa.version> <maven-archiver.vespa.version>3.6.1</maven-archiver.vespa.version> <maven-wagon.vespa.version>3.5.3</maven-wagon.vespa.version> - <mimepull.vespa.version>1.9.6</mimepull.vespa.version> - <mockito.vespa.version>4.0.0</mockito.vespa.version> + <mimepull.vespa.version>1.10.0</mimepull.vespa.version> + <mockito.vespa.version>5.5.0</mockito.vespa.version> <mojo-executor.vespa.version>2.4.0</mojo-executor.vespa.version> <netty.vespa.version>4.1.94.Final</netty.vespa.version> <netty-tcnative.vespa.version>2.0.61.Final</netty-tcnative.vespa.version> <onnxruntime.vespa.version>1.15.1</onnxruntime.vespa.version> - <opennlp.vespa.version>1.9.3</opennlp.vespa.version> + <opennlp.vespa.version>1.9.4</opennlp.vespa.version> <opentest4j.vespa.version>1.3.0</opentest4j.vespa.version> <org.json.vespa.version>20230618</org.json.vespa.version> <org.lz4.vespa.version>1.8.0</org.lz4.vespa.version> - <prometheus.client.vespa.version>0.6.0</prometheus.client.vespa.version> + <prometheus.client.vespa.version>0.16.0</prometheus.client.vespa.version> <protobuf.vespa.version>3.24.2</protobuf.vespa.version> + <questdb.vespa.version>6.2</questdb.vespa.version> <spifly.vespa.version>1.3.6</spifly.vespa.version> <snappy.vespa.version>1.1.10.3</snappy.vespa.version> <surefire.vespa.version>3.1.2</surefire.vespa.version> diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index 958b6dcb860..ae8a927acf8 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -361,12 +361,6 @@ public class Flags { "Whether to read config server session data from sesion data blob or from individual paths", "Takes effect immediately"); - public static final UnboundBooleanFlag USE_VESPA_USER_EVERYWHERE = defineFeatureFlag( - "use-vespa-user-everywhere", true, - List.of("aressem"), "2023-07-28", "2023-09-01", - "Use the vespa user for running Vespa everywhere", - "Takes effect immediately"); - public static final UnboundBooleanFlag MORE_WIREGUARD = defineFeatureFlag( "more-wireguard", false, List.of("andreer"), "2023-08-21", "2023-09-21", diff --git a/maven-plugins/allowed-maven-dependencies.txt b/maven-plugins/allowed-maven-dependencies.txt index 3cb617aea87..73be3699353 100644 --- a/maven-plugins/allowed-maven-dependencies.txt +++ b/maven-plugins/allowed-maven-dependencies.txt @@ -56,10 +56,9 @@ org.eclipse.sisu:org.eclipse.sisu.inject:0.3.5 org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.5 org.iq80.snappy:snappy:0.4 org.jdom:jdom2:2.0.6.1 -org.ow2.asm:asm:9.3 -org.ow2.asm:asm-analysis:9.3 -org.ow2.asm:asm-commons:9.3 -org.ow2.asm:asm-tree:9.3 +org.ow2.asm:asm:9.5 +org.ow2.asm:asm-commons:9.5 +org.ow2.asm:asm-tree:9.5 org.slf4j:slf4j-api:1.7.32 org.tukaani:xz:1.9 org.twdata.maven:mojo-executor:2.4.0 @@ -68,8 +67,8 @@ org.vafer:jdependency:2.8.0 #[test-only] # Contains dependencies that are used exclusively in 'test' scope junit:junit:4.13.2 -net.bytebuddy:byte-buddy:1.11.19 -net.bytebuddy:byte-buddy-agent:1.11.19 +net.bytebuddy:byte-buddy:1.14.6 +net.bytebuddy:byte-buddy-agent:1.14.6 org.apiguardian:apiguardian-api:1.1.2 org.hamcrest:hamcrest:2.2 org.hamcrest:hamcrest-core:2.2 @@ -79,6 +78,6 @@ org.junit.jupiter:junit-jupiter-engine:5.8.1 org.junit.jupiter:junit-jupiter-params:5.8.1 org.junit.platform:junit-platform-commons:1.8.1 org.junit.platform:junit-platform-engine:1.8.1 -org.mockito:mockito-core:4.0.0 -org.objenesis:objenesis:3.2 +org.mockito:mockito-core:5.5.0 +org.objenesis:objenesis:3.3 org.opentest4j:opentest4j:1.3.0 diff --git a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/prometheus/PrometheusUtil.java b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/prometheus/PrometheusUtil.java index c2d05a8636e..ecfdb978e29 100644 --- a/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/prometheus/PrometheusUtil.java +++ b/metrics-proxy/src/main/java/ai/vespa/metricsproxy/metric/model/prometheus/PrometheusUtil.java @@ -13,9 +13,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; - /** * @author yj-jtakagi * @author gjoranv @@ -52,7 +49,7 @@ public class PrometheusUtil { } else { sampleList = new ArrayList<>(); samples.put(metricName, sampleList); - metricFamilySamples.add(new MetricFamilySamples(metricName, Collector.Type.UNTYPED, "", sampleList)); + metricFamilySamples.add(new MetricFamilySamples(metricName, Collector.Type.UNKNOWN, "", sampleList)); } sampleList.add(new Sample(metricName, labels, labelValues, metric.getValue().doubleValue(), packet.timestamp * 1000)); } diff --git a/metrics/src/main/java/ai/vespa/metrics/set/Vespa9DefaultMetricSet.java b/metrics/src/main/java/ai/vespa/metrics/set/Vespa9DefaultMetricSet.java index 0c7f8deccbb..1ca1d5d28d5 100644 --- a/metrics/src/main/java/ai/vespa/metrics/set/Vespa9DefaultMetricSet.java +++ b/metrics/src/main/java/ai/vespa/metrics/set/Vespa9DefaultMetricSet.java @@ -73,7 +73,7 @@ public class Vespa9DefaultMetricSet { .metric(ContainerMetrics.JDISC_HTTP_SSL_HANDSHAKE_FAILURE_INCOMPATIBLE_CHIFERS.rate()) .metric(ContainerMetrics.JDISC_HTTP_SSL_HANDSHAKE_FAILURE_UNKNOWN.rate()) .metric(ContainerMetrics.JDISC_APPLICATION_FAILED_COMPONENT_GRAPHS.rate()) - .metric(ContainerMetrics.ATHENZ_TENANT_CERT_EXPIRY_SECONDS, EnumSet.of(max, last)) // TODO: Vespa 9: Remove last + .metric(ContainerMetrics.ATHENZ_TENANT_CERT_EXPIRY_SECONDS, EnumSet.of(min, max, last)) // TODO: Vespa 9: Remove max, last .build(); } diff --git a/metrics/src/main/java/ai/vespa/metrics/set/Vespa9VespaMetricSet.java b/metrics/src/main/java/ai/vespa/metrics/set/Vespa9VespaMetricSet.java index 5a495878bb6..702390c9c07 100644 --- a/metrics/src/main/java/ai/vespa/metrics/set/Vespa9VespaMetricSet.java +++ b/metrics/src/main/java/ai/vespa/metrics/set/Vespa9VespaMetricSet.java @@ -192,7 +192,7 @@ public class Vespa9VespaMetricSet { addMetric(metrics, ContainerMetrics.JDISC_SINGLETON_DEACTIVATION_FAILURE_COUNT.last()); addMetric(metrics, ContainerMetrics.JDISC_SINGLETON_DEACTIVATION_MILLIS.last()); - addMetric(metrics, ContainerMetrics.ATHENZ_TENANT_CERT_EXPIRY_SECONDS, EnumSet.of(max, last)); // TODO: Vespa 9: Remove last + addMetric(metrics, ContainerMetrics.ATHENZ_TENANT_CERT_EXPIRY_SECONDS, EnumSet.of(min, max, last)); // TODO: Vespa 9: Remove max, last addMetric(metrics, ContainerMetrics.CONTAINER_IAM_ROLE_EXPIRY_SECONDS.baseName()); addMetric(metrics, ContainerMetrics.JDISC_HTTP_REQUEST_PREMATURELY_CLOSED.rate()); diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java index 210bdf2fcb3..e6a1e68b12c 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java @@ -16,7 +16,6 @@ import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.Acl; import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeSpec; import com.yahoo.vespa.hosted.node.admin.container.ContainerName; import com.yahoo.vespa.hosted.node.admin.container.ContainerNetworkMode; -import com.yahoo.vespa.hosted.node.admin.task.util.file.UnixUser; import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerFileSystem; import java.nio.file.FileSystem; @@ -170,7 +169,6 @@ public class NodeAgentContextImpl implements NodeAgentContext { private ContainerNetworkMode containerNetworkMode; private ZoneApi zone; private UserNamespace userNamespace; - private UnixUser vespaUser; private Path containerStorage; private FlagSource flagSource; private double cpuSpeedUp = 1; @@ -211,12 +209,6 @@ public class NodeAgentContextImpl implements NodeAgentContext { return this; } - public Builder vespaUser(UnixUser vespaUser) { - this.vespaUser = vespaUser; - return this; - } - - /** Sets the file system to use for paths. */ public Builder fileSystem(FileSystem fileSystem) { return containerStorage(fileSystem.getPath(DEFAULT_CONTAINER_STORAGE.toString())); @@ -251,7 +243,6 @@ public class NodeAgentContextImpl implements NodeAgentContext { Objects.requireNonNull(containerStorage, "Must set one of containerStorage or fileSystem"); UserScope userScope = UserScope.create( - Optional.ofNullable(vespaUser).orElseGet(() -> new UnixUser("vespa", 1000, "vespa", 100)), Optional.ofNullable(userNamespace).orElseGet(() -> new UserNamespace(100000, 100000, 100000))); ContainerFileSystem containerFs = ContainerFileSystem.create(containerStorage .resolve(nodeSpecBuilder.hostname().split("\\.")[0]), userScope); diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/UserScope.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/UserScope.java index 0c4c79172e2..49f249dd2d7 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/UserScope.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/UserScope.java @@ -45,8 +45,8 @@ public class UserScope { return Objects.hash(root, vespa, namespace); } - /** Creates user scope with default root user */ - public static UserScope create(UnixUser vespaUser, UserNamespace namespace) { - return new UserScope(UnixUser.ROOT, vespaUser, namespace); + /** Creates user scope with default root and vespa user */ + public static UserScope create(UserNamespace namespace) { + return new UserScope(UnixUser.ROOT, UnixUser.VESPA, namespace); } } diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java index b0988bbf53e..d0ddd3755d3 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImplTest.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.yahoo.jdisc.test.TestTimer; +import com.yahoo.vespa.hosted.node.admin.component.TaskContext; import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeSpec; import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeState; import com.yahoo.vespa.hosted.node.admin.container.ContainerOperations; @@ -12,6 +13,7 @@ import com.yahoo.vespa.hosted.node.admin.integration.NodeRepoMock; import com.yahoo.vespa.hosted.node.admin.maintenance.sync.SyncClient; import com.yahoo.vespa.hosted.node.admin.maintenance.sync.SyncFileInfo; import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContextImpl; +import com.yahoo.vespa.hosted.node.admin.task.util.file.UnixUser; import com.yahoo.vespa.hosted.node.admin.task.util.process.CommandResult; import com.yahoo.vespa.test.file.TestFileSystem; import com.yahoo.yolean.concurrent.Sleeper; @@ -31,6 +33,7 @@ import static com.yahoo.vespa.hosted.node.admin.maintenance.servicedump.ServiceD import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -65,7 +68,7 @@ class VespaServiceDumperImplTest { void invokes_perf_commands_when_generating_perf_report() { // Setup mocks ContainerOperations operations = mock(ContainerOperations.class); - when(operations.executeCommandInContainer(any(), any(), any())) + when(operations.executeCommandInContainer(any(NodeAgentContextImpl.class), any(UnixUser.class), any(String[].class))) .thenReturn(new CommandResult(null, 0, "12345")) .thenReturn(new CommandResult(null, 0, "")) .thenReturn(new CommandResult(null, 0, "")); @@ -106,7 +109,7 @@ class VespaServiceDumperImplTest { void invokes_jcmd_commands_when_creating_jfr_recording() { // Setup mocks ContainerOperations operations = mock(ContainerOperations.class); - when(operations.executeCommandInContainer(any(), any(), any())) + when(operations.executeCommandInContainer(any(NodeAgentContextImpl.class), any(UnixUser.class), any(String[].class))) .thenReturn(new CommandResult(null, 0, "12345")) .thenReturn(new CommandResult(null, 0, "ok")) .thenReturn(new CommandResult(null, 0, "name=host-admin success")); @@ -144,7 +147,7 @@ class VespaServiceDumperImplTest { void invokes_zookeeper_backup_command_when_generating_snapshot() { // Setup mocks ContainerOperations operations = mock(ContainerOperations.class); - when(operations.executeCommandInContainer(any(), any(), any())) + when(operations.executeCommandInContainer(any(NodeAgentContextImpl.class), any(UnixUser.class), any(String[].class))) .thenReturn(new CommandResult(null, 0, "12345")); SyncClient syncClient = createSyncClientMock(); NodeRepoMock nodeRepository = new NodeRepoMock(); @@ -179,7 +182,7 @@ class VespaServiceDumperImplTest { void invokes_config_proxy_command_whn_invoking_config_dump() { // Setup mocks ContainerOperations operations = mock(ContainerOperations.class); - when(operations.executeCommandInContainer(any(), any(), any())) + when(operations.executeCommandInContainer(any(NodeAgentContextImpl.class), any(UnixUser.class), any(String[].class))) .thenReturn(new CommandResult(null, 0, "12345")); SyncClient syncClient = createSyncClientMock(); NodeRepoMock nodeRepository = new NodeRepoMock(); @@ -217,7 +220,8 @@ class VespaServiceDumperImplTest { void handles_multiple_artifact_types() { // Setup mocks ContainerOperations operations = mock(ContainerOperations.class); - when(operations.executeCommandInContainer(any(), any(), any())) + when(operations.executeCommandInContainer( + any(NodeAgentContextImpl.class), any(UnixUser.class), any(String[].class))) // For perf report: .thenReturn(new CommandResult(null, 0, "12345")) .thenReturn(new CommandResult(null, 0, "")) @@ -308,7 +312,7 @@ class VespaServiceDumperImplTest { private SyncClient createSyncClientMock() { SyncClient client = mock(SyncClient.class); - when(client.sync(any(), any(), anyInt())) + when(client.sync(any(TaskContext.class), anyList(), anyInt())) .thenReturn(true); return client; } diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemTest.java index 29a78519724..c456edbbd9a 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerFileSystemTest.java @@ -31,7 +31,7 @@ class ContainerFileSystemTest { private final FileSystem fileSystem = TestFileSystem.create(); private final UnixPath containerRootOnHost = new UnixPath(fileSystem.getPath("/data/storage/ctr1")); - private final UserScope userScope = UserScope.create(new UnixUser("vespa", 1000, "users", 100), new UserNamespace(10_000, 11_000, 10000)); + private final UserScope userScope = UserScope.create(new UserNamespace(10_000, 11_000, 10000)); private final ContainerFileSystem containerFs = ContainerFileSystem.create(containerRootOnHost.createDirectories().toPath(), userScope); @Test @@ -67,7 +67,7 @@ class ContainerFileSystemTest { unixPath.deleteIfExists(); new UnixPath(containerPath.withUser(userScope.vespa())).writeUtf8File("test123"); - assertOwnership(containerPath, 1000, 100, 11000, 11100); + assertOwnership(containerPath, 1000, 1000, 11000, 12000); } @Test diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerUserPrincipalLookupServiceTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerUserPrincipalLookupServiceTest.java index 72eec92cf53..41e1667874f 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerUserPrincipalLookupServiceTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/task/util/fs/ContainerUserPrincipalLookupServiceTest.java @@ -20,7 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; */ class ContainerUserPrincipalLookupServiceTest { - private final UserScope userScope = UserScope.create(new UnixUser("vespa", 1000, "users", 100), new UserNamespace(10_000, 11_000, 10000)); + private final UserScope userScope = UserScope.create(new UserNamespace(10_000, 11_000, 10000)); private final ContainerUserPrincipalLookupService userPrincipalLookupService = new ContainerUserPrincipalLookupService(TestFileSystem.create().getUserPrincipalLookupService(), userScope); @@ -31,10 +31,10 @@ class ContainerUserPrincipalLookupServiceTest { assertEquals("11000", user.baseFsPrincipal().getName()); assertEquals(user, userPrincipalLookupService.lookupPrincipalByName("vespa")); - ContainerGroupPrincipal group = userPrincipalLookupService.lookupPrincipalByGroupName("100"); - assertEquals("users", group.getName()); - assertEquals("11100", group.baseFsPrincipal().getName()); - assertEquals(group, userPrincipalLookupService.lookupPrincipalByGroupName("users")); + ContainerGroupPrincipal group = userPrincipalLookupService.lookupPrincipalByGroupName("1000"); + assertEquals("vespa", group.getName()); + assertEquals("12000", group.baseFsPrincipal().getName()); + assertEquals(group, userPrincipalLookupService.lookupPrincipalByGroupName("vespa")); assertThrows(UserPrincipalNotFoundException.class, () -> userPrincipalLookupService.lookupPrincipalByName("test")); } diff --git a/node-repository/pom.xml b/node-repository/pom.xml index 52be67024d0..ff2ad112628 100644 --- a/node-repository/pom.xml +++ b/node-repository/pom.xml @@ -81,7 +81,7 @@ <dependency> <groupId>org.questdb</groupId> <artifactId>questdb</artifactId> - <version>6.2</version> + <version>${questdb.vespa.version}</version> <scope>compile</scope> </dependency> <dependency> diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java index 28679b504aa..ba71bbf0d42 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainer.java @@ -16,7 +16,8 @@ import java.time.Duration; import java.time.Instant; import java.util.Map; import java.util.function.Function; -import java.util.stream.Collectors; + +import static java.util.stream.Collectors.toMap; /** * The application maintainer regularly redeploys all applications to make sure the node repo and application @@ -39,7 +40,7 @@ public class PeriodicApplicationMaintainer extends ApplicationMaintainer { @Override protected boolean canDeployNow(ApplicationId application) { - return deployer().activationTime(application) + return deployer().deployTime(application) // Don't deploy if a regular deploy just happened .map(lastDeployTime -> lastDeployTime.isBefore(nodeRepository().clock().instant().minus(minTimeBetweenRedeployments))) // We only know last deploy time for applications that were deployed on this config server, @@ -57,13 +58,17 @@ public class PeriodicApplicationMaintainer extends ApplicationMaintainer { .map(node -> node.allocation().get().owner()) .distinct() .filter(this::canDeployNow) - .collect(Collectors.toMap(Function.identity(), this::activationTime)); + .collect(toMap(Function.identity(), this::deployTime)); return deploymentTimes.entrySet().stream() .sorted(Map.Entry.comparingByValue()) .map(Map.Entry::getKey) .filter(this::shouldMaintain) - .collect(Collectors.toMap(applicationId -> applicationId, applicationId -> "current deployment being too old")); + .collect(toMap(applicationId -> applicationId, applicationId -> "current deployment being too old")); + } + + private Instant deployTime(ApplicationId applicationId) { + return deployer().deployTime(applicationId).orElse(Instant.EPOCH); } private boolean shouldMaintain(ApplicationId id) { diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockDeployer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockDeployer.java index 3ed01e00ee6..4b4e9121be4 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockDeployer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockDeployer.java @@ -40,10 +40,11 @@ public class MockDeployer implements Deployer { // For mock deploy anything, changing wantToRetire to retired only private final NodeRepository nodeRepository; - /** The number of redeployments done to this, which is also the config generation */ - public int redeployments = 0; + /** The number of activations done to this, which is also the config generation */ + public int activations = 0; - private final Map<ApplicationId, Instant> lastDeployTimes = new HashMap<>(); + private final Map<ApplicationId, Instant> lastPrepareTimes = new HashMap<>(); + private final Map<ApplicationId, Instant> lastActivationTimes = new HashMap<>(); private final Clock clock; private final ReentrantLock lock = new ReentrantLock(); @@ -121,7 +122,12 @@ public class MockDeployer implements Deployer { @Override public Optional<Instant> activationTime(ApplicationId application) { - return Optional.ofNullable(lastDeployTimes.get(application)); + return Optional.ofNullable(lastActivationTimes.get(application)); + } + + @Override + public Optional<Instant> deployTime(ApplicationId application) { + return Optional.ofNullable(lastPrepareTimes.get(application)); } @Override @@ -136,7 +142,8 @@ public class MockDeployer implements Deployer { new MockDeployment(provisioner, new ApplicationContext(applicationId, List.of())).activate(); applications.remove(applicationId); - lastDeployTimes.remove(applicationId); + lastPrepareTimes.remove(applicationId); + lastActivationTimes.remove(applicationId); } public class MockDeployment implements Deployment { @@ -155,6 +162,7 @@ public class MockDeployer implements Deployer { @Override public void prepare() { preparedHosts = application.prepare(provisioner); + lastPrepareTimes.put(application.id, clock.instant()); } @Override @@ -164,15 +172,15 @@ public class MockDeployer implements Deployer { if (failActivate) throw new IllegalStateException("failActivate is true"); - redeployments++; + activations++; try (var lock = provisioner.lock(application.id)) { try (NestedTransaction t = new NestedTransaction()) { - provisioner.activate(preparedHosts, new ActivationContext(redeployments), new ApplicationTransaction(lock, t)); + provisioner.activate(preparedHosts, new ActivationContext(activations), new ApplicationTransaction(lock, t)); t.commit(); - lastDeployTimes.put(application.id, clock.instant()); + lastActivationTimes.put(application.id, clock.instant()); } } - return redeployments; + return activations; } @Override @@ -191,18 +199,20 @@ public class MockDeployer implements Deployer { } @Override - public void prepare() { } + public void prepare() { + lastPrepareTimes.put(applicationId, clock.instant()); + } @Override public long activate() { - lastDeployTimes.put(applicationId, clock.instant()); + lastActivationTimes.put(applicationId, clock.instant()); for (Node node : nodeRepository.nodes().list().owner(applicationId).state(Node.State.active).retiring()) { try (NodeMutex lock = nodeRepository.nodes().lockAndGetRequired(node)) { nodeRepository.nodes().write(lock.node().retire(nodeRepository.clock().instant()), lock); } } - return redeployments++; + return activations++; } @Override diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ExpeditedChangeApplicationMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ExpeditedChangeApplicationMaintainerTest.java index e1e2ff3db15..d1eaac8258e 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ExpeditedChangeApplicationMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/ExpeditedChangeApplicationMaintainerTest.java @@ -43,7 +43,7 @@ public class ExpeditedChangeApplicationMaintainerTest { // Create applications fixture.activate(); - assertEquals("Initial applications are deployed", 3, fixture.deployer.redeployments); + assertEquals("Initial applications are deployed", 3, fixture.deployer.activations); ExpeditedChangeApplicationMaintainer maintainer = new ExpeditedChangeApplicationMaintainer(fixture.deployer, new TestMetric(), nodeRepository, @@ -51,34 +51,34 @@ public class ExpeditedChangeApplicationMaintainerTest { clock.advance(Duration.ofMinutes(2)); maintainer.maintain(); - assertEquals("No changes -> no redeployments", 3, fixture.deployer.redeployments); + assertEquals("No changes -> no redeployments", 3, fixture.deployer.activations); nodeRepository.nodes().fail(nodeRepository.nodes().list().owner(fixture.app1).asList().get(3).hostname(), Agent.system, "Failing to unit test"); clock.advance(Duration.ofMinutes(2)); maintainer.maintain(); - assertEquals("System change -> no redeployments", 3, fixture.deployer.redeployments); + assertEquals("System change -> no redeployments", 3, fixture.deployer.activations); clock.advance(Duration.ofSeconds(1)); nodeRepository.nodes().fail(nodeRepository.nodes().list().owner(fixture.app2).asList().get(4).hostname(), Agent.operator, "Manual node failing"); clock.advance(Duration.ofMinutes(2)); maintainer.maintain(); - assertEquals("Operator change -> redeployment", 4, fixture.deployer.redeployments); + assertEquals("Operator change -> redeployment", 4, fixture.deployer.activations); clock.advance(Duration.ofSeconds(1)); nodeRepository.nodes().fail(nodeRepository.nodes().list().owner(fixture.app3).asList().get(1).hostname(), Agent.operator, "Manual node failing"); clock.advance(Duration.ofMinutes(2)); maintainer.maintain(); - assertEquals("Operator change -> redeployment", 5, fixture.deployer.redeployments); + assertEquals("Operator change -> redeployment", 5, fixture.deployer.activations); clock.advance(Duration.ofSeconds(1)); fixture.tester.makeReadyNodes(1, fixture.nodeResources, NodeType.proxy); clock.advance(Duration.ofMinutes(2)); maintainer.maintain(); - assertEquals("Ready proxy node -> redeployment", 6, fixture.deployer.redeployments); + assertEquals("Ready proxy node -> redeployment", 6, fixture.deployer.activations); clock.advance(Duration.ofMinutes(2)); maintainer.maintain(); - assertEquals("No further operator changes -> no (new) redeployments", 6, fixture.deployer.redeployments); + assertEquals("No further operator changes -> no (new) redeployments", 6, fixture.deployer.activations); } private static class Fixture { diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailerTest.java index c63be6d5dc5..12f10e434e6 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailerTest.java @@ -211,7 +211,7 @@ public class NodeFailerTest { tester.runMaintainers(); tester.clock.advance(Duration.ofMinutes(5)); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(0, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertFalse(tester.nodeRepository.nodes().node(downHost1).get().isDown()); @@ -224,7 +224,7 @@ public class NodeFailerTest { for (int minutes = 0; minutes < 45; minutes +=5 ) { tester.runMaintainers(); tester.clock.advance(Duration.ofMinutes(5)); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(0, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertTrue(tester.nodeRepository.nodes().node(downHost1).get().isDown()); @@ -237,7 +237,7 @@ public class NodeFailerTest { tester.runMaintainers(); assertFalse(tester.nodeRepository.nodes().node(downHost1).get().isDown()); assertTrue(tester.nodeRepository.nodes().node(downHost1).get().isUp()); - assertEquals(1, tester.deployer.redeployments); + assertEquals(1, tester.deployer.activations); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(1, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertEquals(downHost2, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).asList().get(0).hostname()); @@ -253,7 +253,7 @@ public class NodeFailerTest { // the host is still down and fails tester.clock.advance(Duration.ofMinutes(5)); tester.runMaintainers(); - assertEquals(2, tester.deployer.redeployments); + assertEquals(2, tester.deployer.activations); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(2, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); @@ -264,7 +264,7 @@ public class NodeFailerTest { for (int minutes = 0; minutes < 75; minutes +=5 ) { tester.runMaintainers(); tester.clock.advance(Duration.ofMinutes(5)); - assertEquals(2, tester.deployer.redeployments); + assertEquals(2, tester.deployer.activations); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(2, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); } @@ -274,7 +274,7 @@ public class NodeFailerTest { tester.clock.advance(Duration.ofDays(1)); tester.runMaintainers(); // The node is now failed - assertEquals(3, tester.deployer.redeployments); + assertEquals(3, tester.deployer.activations); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(3, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertTrue("The index of the last failed node is not reused", @@ -330,7 +330,7 @@ public class NodeFailerTest { for (int minutes = 0; minutes < 45; minutes +=5 ) { tester.runMaintainers(); tester.clock.advance(Duration.ofMinutes(5)); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(3, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(0, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); } @@ -338,7 +338,7 @@ public class NodeFailerTest { // downHost should now be failed and replaced tester.clock.advance(Duration.ofDays(1)); tester.runMaintainers(); - assertEquals(1, tester.deployer.redeployments); + assertEquals(1, tester.deployer.activations); assertEquals(1, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertEquals(3, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(downHost, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).asList().get(0).hostname()); @@ -364,7 +364,7 @@ public class NodeFailerTest { // Node is failed and replaced tester.runMaintainers(); - assertEquals(1, tester.deployer.redeployments); + assertEquals(1, tester.deployer.activations); NodeList failedOrActive = tester.nodeRepository.nodes().list(Node.State.active, Node.State.failed); assertEquals(4, failedOrActive.state(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(Set.of(downNode.hostname()), failedOrActive.state(Node.State.failed).nodeType(NodeType.tenant).hostnames()); @@ -392,7 +392,7 @@ public class NodeFailerTest { for (int minutes = 0; minutes < 45; minutes += 5 ) { tester.runMaintainers(); tester.clock.advance(Duration.ofMinutes(5)); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(7, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.host).size()); } @@ -400,7 +400,7 @@ public class NodeFailerTest { tester.clock.advance(Duration.ofMinutes(30)); tester.runMaintainers(); - assertEquals(2, tester.deployer.redeployments); + assertEquals(2, tester.deployer.activations); assertEquals(2, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(7, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.host).size()); @@ -409,7 +409,7 @@ public class NodeFailerTest { // The failing of the host is deferred to the next maintain tester.runMaintainers(); - assertEquals(2 + 1, tester.deployer.redeployments); + assertEquals(2 + 1, tester.deployer.activations); assertEquals(2, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(6, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.host).size()); @@ -430,7 +430,7 @@ public class NodeFailerTest { tester.clock.advance(Duration.ofMinutes(30)); tester.runMaintainers(); - assertEquals(3 + 1, tester.deployer.redeployments); + assertEquals(3 + 1, tester.deployer.activations); assertEquals(3, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(6, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.host).size()); @@ -444,7 +444,7 @@ public class NodeFailerTest { tester.runMaintainers(); tester.runMaintainers(); // The host is failed in the 2. maintain() - assertEquals(5 + 2, tester.deployer.redeployments); + assertEquals(5 + 2, tester.deployer.activations); assertEquals(5, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(5, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.host).size()); @@ -458,7 +458,7 @@ public class NodeFailerTest { tester.clock.advance(Duration.ofDays(1)); tester.runMaintainers(); - assertEquals(6 + 2, tester.deployer.redeployments); + assertEquals(6 + 2, tester.deployer.activations); assertEquals(6, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(NodeType.tenant).size()); assertEquals(8, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.tenant).size()); assertEquals(5, tester.nodeRepository.nodes().list(Node.State.active).nodeType(NodeType.host).size()); @@ -493,7 +493,7 @@ public class NodeFailerTest { for (int minutes = 0; minutes < 45; minutes +=5 ) { tester.runMaintainers(); tester.clock.advance(Duration.ofMinutes(5)); - assertEquals( 0, tester.deployer.redeployments); + assertEquals( 0, tester.deployer.activations); assertEquals(count, tester.nodeRepository.nodes().list(Node.State.active).nodeType(nodeType).size()); } @@ -501,7 +501,7 @@ public class NodeFailerTest { tester.runMaintainers(); // one down host should now be failed, but not two as we are only allowed to fail one proxy - assertEquals(expectedFailCount, tester.deployer.redeployments); + assertEquals(expectedFailCount, tester.deployer.activations); assertEquals(count - expectedFailCount, tester.nodeRepository.nodes().list(Node.State.active).nodeType(nodeType).size()); assertEquals(expectedFailCount, tester.nodeRepository.nodes().list(Node.State.failed).nodeType(nodeType).size()); tester.nodeRepository.nodes().list(Node.State.failed).nodeType(nodeType) diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java index 900d77fcb26..9fea27a2cb0 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java @@ -124,40 +124,61 @@ public class PeriodicApplicationMaintainerTest { public void application_deploy_inhibits_redeploy_for_a_while() { fixture.activate(); - assertEquals("No deployment expected", 2, fixture.deployer.redeployments); + assertEquals("No deployment expected", 2, fixture.deployer.activations); // Holds off on deployments a while after starting fixture.runApplicationMaintainer(); - assertEquals("No deployment expected", 2, fixture.deployer.redeployments); + assertEquals("No deployment expected", 2, fixture.deployer.activations); // Exhaust initial wait period clock.advance(Duration.ofMinutes(30).plus(Duration.ofSeconds(1))); // Will not do any deployments, as bootstrapping is still in progress fixture.runApplicationMaintainer(); - assertEquals("No deployment expected", 2, fixture.deployer.redeployments); + assertEquals("No deployment expected", 2, fixture.deployer.activations); // First deployment of applications will happen now, as bootstrapping is done fixture.setBootstrapping(false); fixture.runApplicationMaintainer(); - assertEquals("No deployment expected", 4, fixture.deployer.redeployments); + assertEquals("No deployment expected", 4, fixture.deployer.activations); Instant firstDeployTime = clock.instant(); + assertEquals(firstDeployTime, fixture.deployer.deployTime(fixture.app1).get()); + assertEquals(firstDeployTime, fixture.deployer.deployTime(fixture.app2).get()); assertEquals(firstDeployTime, fixture.deployer.activationTime(fixture.app1).get()); assertEquals(firstDeployTime, fixture.deployer.activationTime(fixture.app2).get()); clock.advance(Duration.ofMinutes(5)); fixture.runApplicationMaintainer(); // Too soon: Not redeployed: - assertEquals("No deployment expected", 4, fixture.deployer.redeployments); + assertEquals("No deployment expected", 4, fixture.deployer.activations); + assertEquals(firstDeployTime, fixture.deployer.deployTime(fixture.app1).get()); + assertEquals(firstDeployTime, fixture.deployer.deployTime(fixture.app2).get()); assertEquals(firstDeployTime, fixture.deployer.activationTime(fixture.app1).get()); assertEquals(firstDeployTime, fixture.deployer.activationTime(fixture.app2).get()); clock.advance(Duration.ofMinutes(30)); + Instant instant1 = clock.instant(); fixture.runApplicationMaintainer(); // Redeployed: - assertEquals("No deployment expected", 6, fixture.deployer.redeployments); - assertEquals(clock.instant(), fixture.deployer.activationTime(fixture.app1).get()); - assertEquals(clock.instant(), fixture.deployer.activationTime(fixture.app2).get()); + assertEquals("No deployment expected", 6, fixture.deployer.activations); + assertEquals(instant1, fixture.deployer.deployTime(fixture.app1).get()); + assertEquals(instant1, fixture.deployer.deployTime(fixture.app2).get()); + assertEquals(instant1, fixture.deployer.activationTime(fixture.app1).get()); + assertEquals(instant1, fixture.deployer.activationTime(fixture.app2).get()); + + clock.advance(Duration.ofMinutes(30)); + // Prepare (simulate that activation failed) + fixture.prepare(); + Instant secondDeployTime = clock.instant(); + fixture.runApplicationMaintainer(); + // Too soon: Not redeployed, since a deployment (prepare) was done less than 30 minutes ago: + assertEquals("No deployment expected", 6, fixture.deployer.activations); + assertEquals(secondDeployTime, fixture.deployer.deployTime(fixture.app1).get()); + assertEquals(secondDeployTime, fixture.deployer.deployTime(fixture.app2).get()); + assertEquals(instant1, fixture.deployer.activationTime(fixture.app1).get()); + assertEquals(instant1, fixture.deployer.activationTime(fixture.app2).get()); + + clock.advance(Duration.ofMinutes(30)); } @Test(timeout = 60_000) @@ -188,8 +209,8 @@ public class PeriodicApplicationMaintainerTest { fixture.deployer.lock().unlock(); fixture.runApplicationMaintainer(); Instant deployTime = clock.instant(); - assertEquals(deployTime, fixture.deployer.activationTime(fixture.app1).get()); - assertEquals(deployTime, fixture.deployer.activationTime(fixture.app2).get()); + assertEquals(deployTime, fixture.deployer.deployTime(fixture.app1).get()); + assertEquals(deployTime, fixture.deployer.deployTime(fixture.app2).get()); // Too soon: Already deployed recently clock.advance(Duration.ofMinutes(5)); @@ -228,6 +249,11 @@ public class PeriodicApplicationMaintainerTest { Duration.ofMinutes(30)); } + void prepare() { + deployer.deployFromLocalActive(app1, false).get().prepare(); + deployer.deployFromLocalActive(app2, false).get().prepare(); + } + void activate() { deployer.deployFromLocalActive(app1, false).get().activate(); deployer.deployFromLocalActive(app2, false).get().activate(); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirerTest.java index f42044c2944..d0ac59b1e15 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/RetiredExpirerTest.java @@ -104,7 +104,7 @@ public class RetiredExpirerTest { createRetiredExpirer(deployer).run(); assertEquals(3, nodeRepository.nodes().list(Node.State.active).owner(applicationId).size()); assertEquals(4, nodeRepository.nodes().list(Node.State.inactive).owner(applicationId).size()); - assertEquals(1, deployer.redeployments); + assertEquals(1, deployer.activations); // inactivated nodes are not retired for (Node node : nodeRepository.nodes().list(Node.State.inactive).owner(applicationId)) @@ -147,14 +147,14 @@ public class RetiredExpirerTest { retiredExpirer.run(); assertEquals(5, nodeRepository.nodes().list(Node.State.active).owner(applicationId).size()); assertEquals(2, nodeRepository.nodes().list(Node.State.dirty).owner(applicationId).size()); - assertEquals(1, deployer.redeployments); + assertEquals(1, deployer.activations); verify(orchestrator, times(4)).acquirePermissionToRemove(any()); // Running it again has no effect retiredExpirer.run(); assertEquals(5, nodeRepository.nodes().list(Node.State.active).owner(applicationId).size()); assertEquals(2, nodeRepository.nodes().list(Node.State.dirty).owner(applicationId).size()); - assertEquals(1, deployer.redeployments); + assertEquals(1, deployer.activations); verify(orchestrator, times(6)).acquirePermissionToRemove(any()); // Running it again deactivates nodes that have exceeded max retirement period @@ -163,7 +163,7 @@ public class RetiredExpirerTest { assertEquals(3, nodeRepository.nodes().list(Node.State.active).owner(applicationId).size()); assertEquals(2, nodeRepository.nodes().list(Node.State.dirty).owner(applicationId).size()); assertEquals(2, nodeRepository.nodes().list(Node.State.inactive).owner(applicationId).size()); - assertEquals(2, deployer.redeployments); + assertEquals(2, deployer.activations); verify(orchestrator, times(6)).acquirePermissionToRemove(any()); // Removed nodes are not retired diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainerTest.java index 6d67f39d9bb..da64fa2fd64 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/SpareCapacityMaintainerTest.java @@ -51,7 +51,7 @@ public class SpareCapacityMaintainerTest { public void testEmpty() { var tester = new SpareCapacityMaintainerTester(); tester.maintainer.maintain(); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(0, tester.nodeRepository.nodes().list().retired().size()); } @@ -61,7 +61,7 @@ public class SpareCapacityMaintainerTest { tester.addHosts(2, new NodeResources(10, 100, 1000, 1)); tester.addNodes(0, 1, new NodeResources(10, 100, 1000, 1), 0); tester.maintainer.maintain(); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(0, tester.nodeRepository.nodes().list().retired().size()); assertEquals(1, tester.metric.values.get("spareHostCapacity")); } @@ -72,7 +72,7 @@ public class SpareCapacityMaintainerTest { tester.addHosts(3, new NodeResources(10, 100, 1000, 1)); tester.addNodes(0, 1, new NodeResources(10, 100, 1000, 1), 0); tester.maintainer.maintain(); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(0, tester.nodeRepository.nodes().list().retired().size()); assertEquals(2, tester.metric.values.get("spareHostCapacity")); } @@ -83,7 +83,7 @@ public class SpareCapacityMaintainerTest { tester.addHosts(2, new NodeResources(10, 100, 1000, 1)); tester.addNodes(0, 2, new NodeResources(10, 100, 1000, 1), 0); tester.maintainer.maintain(); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(0, tester.nodeRepository.nodes().list().retired().size()); assertEquals(0, tester.metric.values.get("spareHostCapacity")); } @@ -95,7 +95,7 @@ public class SpareCapacityMaintainerTest { tester.addNodes(0, 2, new NodeResources(5, 50, 500, 0.5), 0); tester.addNodes(1, 2, new NodeResources(5, 50, 500, 0.5), 2); tester.maintainer.maintain(); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(0, tester.nodeRepository.nodes().list().retired().size()); assertEquals(2, tester.metric.values.get("spareHostCapacity")); } @@ -109,13 +109,13 @@ public class SpareCapacityMaintainerTest { tester.addNodes(1, 2, new NodeResources(5, 50, 500, 0.5), 2); tester.addNodes(2, 2, new NodeResources(5, 50, 500, 0.5), 4); tester.maintainer.maintain(); - assertEquals(1, tester.deployer.redeployments); + assertEquals(1, tester.deployer.activations); assertEquals(1, tester.nodeRepository.nodes().list().retired().size()); assertEquals(1, tester.metric.values.get("spareHostCapacity")); // Maintaining again is a no-op since the node to move is already retired tester.maintainer.maintain(); - assertEquals(1, tester.deployer.redeployments); + assertEquals(1, tester.deployer.activations); assertEquals(1, tester.nodeRepository.nodes().list().retired().size()); assertEquals(1, tester.metric.values.get("spareHostCapacity")); } @@ -132,7 +132,7 @@ public class SpareCapacityMaintainerTest { tester.addNodes(2, 2, new NodeResources(5, 50, 500, 0.5), 4); tester.addNodes(3, 2, new NodeResources(5, 50, 500, 0.5), 6); tester.maintainer.maintain(); - assertEquals(1, tester.deployer.redeployments); + assertEquals(1, tester.deployer.activations); assertEquals(1, tester.nodeRepository.nodes().list().retired().size()); assertEquals(1, tester.metric.values.get("spareHostCapacity")); } @@ -145,7 +145,7 @@ public class SpareCapacityMaintainerTest { setupMultipleHosts(tester, 4); tester.maintainer.maintain(); - assertEquals(1, tester.deployer.redeployments); + assertEquals(1, tester.deployer.activations); assertEquals(1, tester.nodeRepository.nodes().list().retired().size()); assertEquals(1, tester.metric.values.get("spareHostCapacity")); } @@ -156,7 +156,7 @@ public class SpareCapacityMaintainerTest { setupMultipleHosts(tester, 3); tester.maintainer.maintain(); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(0, tester.nodeRepository.nodes().list().retired().size()); assertEquals(0, tester.metric.values.get("spareHostCapacity")); } @@ -199,7 +199,7 @@ public class SpareCapacityMaintainerTest { tester.addNodes(6, 1, new NodeResources( 4, 40, 400, 0.4), 6); tester.maintainer.maintain(); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(0, tester.nodeRepository.nodes().list().retired().size()); assertEquals(0, tester.metric.values.get("spareHostCapacity")); } @@ -216,7 +216,7 @@ public class SpareCapacityMaintainerTest { tester.maintainer.maintain(); assertEquals(2, tester.metric.values.get("overcommittedHosts")); - assertEquals(1, tester.deployer.redeployments); + assertEquals(1, tester.deployer.activations); assertEquals(List.of(new NodeResources( 1.1, 10, 100, 0.1)), tester.nodeRepository.nodes().list().retired().mapToList(Node::resources)); } @@ -239,7 +239,7 @@ public class SpareCapacityMaintainerTest { tester.maintainer.maintain(); long totalTime = System.currentTimeMillis() - startTime; System.out.println("Complete in " + ( totalTime / 1000) + " seconds"); - assertEquals(0, tester.deployer.redeployments); + assertEquals(0, tester.deployer.activations); assertEquals(0, tester.nodeRepository.nodes().list().retired().size()); assertEquals(0, tester.metric.values.get("spareHostCapacity")); } diff --git a/parent/pom.xml b/parent/pom.xml index a18cd4a6576..f6a2cba379c 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -548,7 +548,7 @@ <dependency> <groupId>com.google.jimfs</groupId> <artifactId>jimfs</artifactId> - <version>1.2</version> + <version>${jimfs.vespa.version}</version> <scope>test</scope> <!-- TODO: remove scope from parent pom --> </dependency> <dependency> @@ -899,7 +899,7 @@ <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> - <version>3.11.1</version> + <version>${assertj.vespa.version}</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> @@ -1114,7 +1114,7 @@ <dependency> <groupId>io.dropwizard.metrics</groupId> <artifactId>metrics-core</artifactId> - <version>3.2.5</version> + <version>${dropwizard.metrics.vespa.version}</version> </dependency> <dependency> <groupId>xerces</groupId> @@ -1134,7 +1134,7 @@ <dependency> <groupId>org.checkerframework</groupId> <artifactId>checker-qual</artifactId> - <version>3.30.0</version> + <version>${checker-qual.vespa.version}</version> </dependency> <dependency> <groupId>com.google.http-client</groupId> diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp index 9d86b2d28e1..7df116a5f0c 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp @@ -30,7 +30,6 @@ #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/transactionlog/translogserver.h> #include <vespa/searchsummary/config/config-juniperrc.h> -#include <vespa/storage/bucketdb/config-stor-bucket-init.h> #include <vespa/storage/common/i_storage_chain_builder.h> #include <vespa/storage/config/config-stor-bouncer.h> #include <vespa/storage/config/config-stor-communicationmanager.h> @@ -103,7 +102,6 @@ using vespa::config::content::UpgradingConfigBuilder; using vespa::config::content::core::BucketspacesConfig; using vespa::config::content::core::BucketspacesConfigBuilder; using vespa::config::content::core::StorBouncerConfigBuilder; -using vespa::config::content::core::StorBucketInitConfigBuilder; using vespa::config::content::core::StorCommunicationmanagerConfigBuilder; using vespa::config::content::core::StorDistributormanagerConfigBuilder; using vespa::config::content::core::StorOpsloggerConfigBuilder; @@ -355,7 +353,6 @@ struct ServiceLayerConfigSet : public StorageConfigSet { PersistenceConfigBuilder persistence; StorFilestorConfigBuilder stor_filestor; - StorBucketInitConfigBuilder stor_bucket_init; StorVisitorConfigBuilder stor_visitor; ServiceLayerConfigSet(const vespalib::string& base_dir, uint32_t node_idx, const vespalib::string& config_id_in, const IBmDistribution& distribution, const DocumenttypesConfig& documenttypes_in, @@ -363,7 +360,6 @@ struct ServiceLayerConfigSet : public StorageConfigSet : StorageConfigSet(base_dir, node_idx, false, config_id_in, distribution, documenttypes_in, slobrok_port, mbus_port, rpc_port, status_port, params), persistence(), stor_filestor(), - stor_bucket_init(), stor_visitor() { stor_filestor.numResponseThreads = params.get_response_threads(); @@ -377,7 +373,6 @@ struct ServiceLayerConfigSet : public StorageConfigSet StorageConfigSet::add_builders(set); set.addBuilder(config_id, &persistence); set.addBuilder(config_id, &stor_filestor); - set.addBuilder(config_id, &stor_bucket_init); set.addBuilder(config_id, &stor_visitor); } }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp index 4f7e0e66d9f..5e799898ccf 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.cpp @@ -27,16 +27,9 @@ MetricsEngine::start(const config::ConfigUri &) metrics::MetricLockGuard guard(_manager->getMetricLock()); _manager->registerMetric(guard, *_root); } - - // Storage doesnt snapshot unset metrics to save memory. Currently - // feature seems a bit bugged. Disabling this optimalization for search. - // Can enable it later when it is confirmed to be working well. _manager->snapshotUnsetMetrics(true); - - // Currently, when injecting a metric manager into the content layer, - // the content layer require to be the one initializing and starting it. - // Thus not calling init here, but further out in the application when - // one knows whether we are running in row/column mode or not + // Starting the metric manager worker thread (MetricManager::init()) is not done here, as the service + // layer code has not had the opportunity to create its metrics yet. Deferred to service layer init code. } void diff --git a/searchlib/CMakeLists.txt b/searchlib/CMakeLists.txt index e885f9bfba7..c0fdf03d262 100644 --- a/searchlib/CMakeLists.txt +++ b/searchlib/CMakeLists.txt @@ -173,7 +173,7 @@ vespa_define_module( src/tests/hitcollector src/tests/index/field_length_calculator src/tests/indexmetainfo - src/tests/ld-library-path + src/tests/ld_library_path src/tests/memoryindex/compact_words_store src/tests/memoryindex/datastore src/tests/memoryindex/document_inverter diff --git a/searchlib/src/tests/aggregator/CMakeLists.txt b/searchlib/src/tests/aggregator/CMakeLists.txt index 12c70cb69ff..b892637d685 100644 --- a/searchlib/src/tests/aggregator/CMakeLists.txt +++ b/searchlib/src/tests/aggregator/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_perdocexpr_test_app TEST SOURCES - perdocexpr.cpp + perdocexpr_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/aggregator/perdocexpr.cpp b/searchlib/src/tests/aggregator/perdocexpr_test.cpp index 1c07843d71e..1c07843d71e 100644 --- a/searchlib/src/tests/aggregator/perdocexpr.cpp +++ b/searchlib/src/tests/aggregator/perdocexpr_test.cpp diff --git a/searchlib/src/tests/alignment/CMakeLists.txt b/searchlib/src/tests/alignment/CMakeLists.txt index b3459d3afa5..965f35d6a28 100644 --- a/searchlib/src/tests/alignment/CMakeLists.txt +++ b/searchlib/src/tests/alignment/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_alignment_test_app TEST SOURCES - alignment.cpp + alignment_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/alignment/alignment.cpp b/searchlib/src/tests/alignment/alignment_test.cpp index 3c6906f45bf..3c6906f45bf 100644 --- a/searchlib/src/tests/alignment/alignment.cpp +++ b/searchlib/src/tests/alignment/alignment_test.cpp diff --git a/searchlib/src/tests/attribute/extendattributes/CMakeLists.txt b/searchlib/src/tests/attribute/extendattributes/CMakeLists.txt index f733f3d0091..70b7f40c8d9 100644 --- a/searchlib/src/tests/attribute/extendattributes/CMakeLists.txt +++ b/searchlib/src/tests/attribute/extendattributes/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_extendattribute_test_app TEST SOURCES - extendattribute.cpp + extendattribute_test.cpp DEPENDS searchlib GTest::GTest diff --git a/searchlib/src/tests/attribute/extendattributes/extendattribute.cpp b/searchlib/src/tests/attribute/extendattributes/extendattribute_test.cpp index 3f775e99891..3f775e99891 100644 --- a/searchlib/src/tests/attribute/extendattributes/extendattribute.cpp +++ b/searchlib/src/tests/attribute/extendattributes/extendattribute_test.cpp diff --git a/searchlib/src/tests/attribute/guard/CMakeLists.txt b/searchlib/src/tests/attribute/guard/CMakeLists.txt index 7a2dfe2f8cf..4605426740b 100644 --- a/searchlib/src/tests/attribute/guard/CMakeLists.txt +++ b/searchlib/src/tests/attribute/guard/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_attributeguard_test_app TEST SOURCES - attributeguard.cpp + attributeguard_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/attribute/guard/attributeguard.cpp b/searchlib/src/tests/attribute/guard/attributeguard_test.cpp index 709316cc6fd..709316cc6fd 100644 --- a/searchlib/src/tests/attribute/guard/attributeguard.cpp +++ b/searchlib/src/tests/attribute/guard/attributeguard_test.cpp diff --git a/searchlib/src/tests/attribute/postinglist/CMakeLists.txt b/searchlib/src/tests/attribute/postinglist/CMakeLists.txt index e0f2e7106cc..068bde766ed 100644 --- a/searchlib/src/tests/attribute/postinglist/CMakeLists.txt +++ b/searchlib/src/tests/attribute/postinglist/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_postinglist_test_app TEST SOURCES - postinglist.cpp + postinglist_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/attribute/postinglist/postinglist.cpp b/searchlib/src/tests/attribute/postinglist/postinglist_test.cpp index 39e31b23498..39e31b23498 100644 --- a/searchlib/src/tests/attribute/postinglist/postinglist.cpp +++ b/searchlib/src/tests/attribute/postinglist/postinglist_test.cpp diff --git a/searchlib/src/tests/common/summaryfeatures/CMakeLists.txt b/searchlib/src/tests/common/summaryfeatures/CMakeLists.txt index 7ad71a22c84..d0050c96c22 100644 --- a/searchlib/src/tests/common/summaryfeatures/CMakeLists.txt +++ b/searchlib/src/tests/common/summaryfeatures/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_summaryfeatures_test_app TEST SOURCES - summaryfeatures.cpp + summaryfeatures_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/common/summaryfeatures/summaryfeatures.cpp b/searchlib/src/tests/common/summaryfeatures/summaryfeatures_test.cpp index 73a81be9f90..73a81be9f90 100644 --- a/searchlib/src/tests/common/summaryfeatures/summaryfeatures.cpp +++ b/searchlib/src/tests/common/summaryfeatures/summaryfeatures_test.cpp diff --git a/searchlib/src/tests/diskindex/pagedict4/CMakeLists.txt b/searchlib/src/tests/diskindex/pagedict4/CMakeLists.txt index a0dca470f22..99183b13bc5 100644 --- a/searchlib/src/tests/diskindex/pagedict4/CMakeLists.txt +++ b/searchlib/src/tests/diskindex/pagedict4/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_pagedict4_test_app TEST SOURCES - pagedict4test.cpp + pagedict4_test.cpp DEPENDS searchlib_test searchlib diff --git a/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp b/searchlib/src/tests/diskindex/pagedict4/pagedict4_test.cpp index 408cf370c59..408cf370c59 100644 --- a/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp +++ b/searchlib/src/tests/diskindex/pagedict4/pagedict4_test.cpp diff --git a/searchlib/src/tests/features/CMakeLists.txt b/searchlib/src/tests/features/CMakeLists.txt index c5268e307ac..c9c05e565be 100644 --- a/searchlib/src/tests/features/CMakeLists.txt +++ b/searchlib/src/tests/features/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_prod_features_test_app TEST SOURCES - prod_features.cpp + prod_features_test.cpp prod_features_framework.cpp prod_features_attributematch.cpp prod_features_fieldmatch.cpp diff --git a/searchlib/src/tests/features/beta/CMakeLists.txt b/searchlib/src/tests/features/beta/CMakeLists.txt index 11b34d3dbdd..dfaee48efeb 100644 --- a/searchlib/src/tests/features/beta/CMakeLists.txt +++ b/searchlib/src/tests/features/beta/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_beta_features_test_app TEST SOURCES - beta_features.cpp + beta_features_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/features/beta/beta_features.cpp b/searchlib/src/tests/features/beta/beta_features_test.cpp index 622228ff168..622228ff168 100644 --- a/searchlib/src/tests/features/beta/beta_features.cpp +++ b/searchlib/src/tests/features/beta/beta_features_test.cpp diff --git a/searchlib/src/tests/features/prod_features_attributematch.cpp b/searchlib/src/tests/features/prod_features_attributematch.cpp index fd6fdca96fc..057d7a821d4 100644 --- a/searchlib/src/tests/features/prod_features_attributematch.cpp +++ b/searchlib/src/tests/features/prod_features_attributematch.cpp @@ -1,6 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "prod_features.h" +#include "prod_features_test.h" #include <vespa/searchlib/features/attributematchfeature.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributevector.h> diff --git a/searchlib/src/tests/features/prod_features_fieldmatch.cpp b/searchlib/src/tests/features/prod_features_fieldmatch.cpp index c6ff6232c23..61d9313bae6 100644 --- a/searchlib/src/tests/features/prod_features_fieldmatch.cpp +++ b/searchlib/src/tests/features/prod_features_fieldmatch.cpp @@ -1,6 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "prod_features.h" +#include "prod_features_test.h" #include <vespa/searchlib/features/fieldmatchfeature.h> #include <vespa/log/log.h> diff --git a/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp b/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp index be4711e1fec..efd4dc7eb4f 100644 --- a/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp +++ b/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp @@ -1,6 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "prod_features.h" +#include "prod_features_test.h" #include <vespa/searchlib/features/fieldtermmatchfeature.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> diff --git a/searchlib/src/tests/features/prod_features_framework.cpp b/searchlib/src/tests/features/prod_features_framework.cpp index 1a0c5014edb..6c89092e41d 100644 --- a/searchlib/src/tests/features/prod_features_framework.cpp +++ b/searchlib/src/tests/features/prod_features_framework.cpp @@ -2,7 +2,7 @@ #include <vespa/log/log.h> LOG_SETUP(".prod_features_framework"); -#include "prod_features.h" +#include "prod_features_test.h" #include <vespa/searchlib/features/valuefeature.h> using namespace search::features; diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features_test.cpp index c22d3b3abb8..10d1a9bdc8e 100644 --- a/searchlib/src/tests/features/prod_features.cpp +++ b/searchlib/src/tests/features/prod_features_test.cpp @@ -1,6 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "prod_features.h" +#include "prod_features_test.h" #include <vespa/searchcommon/attribute/config.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/attributeguard.h> diff --git a/searchlib/src/tests/features/prod_features.h b/searchlib/src/tests/features/prod_features_test.h index 28b564b341e..28b564b341e 100644 --- a/searchlib/src/tests/features/prod_features.h +++ b/searchlib/src/tests/features/prod_features_test.h diff --git a/searchlib/src/tests/fef/featureoverride/CMakeLists.txt b/searchlib/src/tests/fef/featureoverride/CMakeLists.txt index 2314f8ed03a..414b0c126d0 100644 --- a/searchlib/src/tests/fef/featureoverride/CMakeLists.txt +++ b/searchlib/src/tests/fef/featureoverride/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_featureoverride_test_app TEST SOURCES - featureoverride.cpp + featureoverride_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/fef/featureoverride/featureoverride.cpp b/searchlib/src/tests/fef/featureoverride/featureoverride_test.cpp index f5082871a3f..f5082871a3f 100644 --- a/searchlib/src/tests/fef/featureoverride/featureoverride.cpp +++ b/searchlib/src/tests/fef/featureoverride/featureoverride_test.cpp diff --git a/searchlib/src/tests/forcelink/CMakeLists.txt b/searchlib/src/tests/forcelink/CMakeLists.txt index a6af5a77b0c..4e303d6f3b3 100644 --- a/searchlib/src/tests/forcelink/CMakeLists.txt +++ b/searchlib/src/tests/forcelink/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_forcelink_test_app TEST SOURCES - forcelink.cpp + forcelink_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/forcelink/forcelink.cpp b/searchlib/src/tests/forcelink/forcelink_test.cpp index 189804c3975..189804c3975 100644 --- a/searchlib/src/tests/forcelink/forcelink.cpp +++ b/searchlib/src/tests/forcelink/forcelink_test.cpp diff --git a/searchlib/src/tests/ld-library-path/CMakeLists.txt b/searchlib/src/tests/ld-library-path/CMakeLists.txt deleted file mode 100644 index e064d98e42c..00000000000 --- a/searchlib/src/tests/ld-library-path/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(searchlib_ld-library-path_test_app TEST - SOURCES - ld-library-path.cpp - DEPENDS -) -vespa_add_test(NAME searchlib_ld-library-path_test_app COMMAND searchlib_ld-library-path_test_app) diff --git a/searchlib/src/tests/ld-library-path/.gitignore b/searchlib/src/tests/ld_library_path/.gitignore index 5f02ecfc8f8..5f02ecfc8f8 100644 --- a/searchlib/src/tests/ld-library-path/.gitignore +++ b/searchlib/src/tests/ld_library_path/.gitignore diff --git a/searchlib/src/tests/ld_library_path/CMakeLists.txt b/searchlib/src/tests/ld_library_path/CMakeLists.txt new file mode 100644 index 00000000000..388a498f517 --- /dev/null +++ b/searchlib/src/tests/ld_library_path/CMakeLists.txt @@ -0,0 +1,7 @@ +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +vespa_add_executable(searchlib_ld_library_path_test_app TEST + SOURCES + ld_library_path_test.cpp + DEPENDS +) +vespa_add_test(NAME searchlib_ld_library_path_test_app COMMAND searchlib_ld_library_path_test_app) diff --git a/searchlib/src/tests/ld-library-path/ld-library-path.cpp b/searchlib/src/tests/ld_library_path/ld_library_path_test.cpp index 2f19110c6fe..2f19110c6fe 100644 --- a/searchlib/src/tests/ld-library-path/ld-library-path.cpp +++ b/searchlib/src/tests/ld_library_path/ld_library_path_test.cpp diff --git a/searchlib/src/tests/nativerank/CMakeLists.txt b/searchlib/src/tests/nativerank/CMakeLists.txt index 549a7526745..a4984374a4b 100644 --- a/searchlib/src/tests/nativerank/CMakeLists.txt +++ b/searchlib/src/tests/nativerank/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_nativerank_test_app TEST SOURCES - nativerank.cpp + nativerank_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/nativerank/nativerank.cpp b/searchlib/src/tests/nativerank/nativerank_test.cpp index 90920a1f351..90920a1f351 100644 --- a/searchlib/src/tests/nativerank/nativerank.cpp +++ b/searchlib/src/tests/nativerank/nativerank_test.cpp diff --git a/searchlib/src/tests/queryeval/CMakeLists.txt b/searchlib/src/tests/queryeval/CMakeLists.txt index 65ae2dd8a6d..c24a661de22 100644 --- a/searchlib/src/tests/queryeval/CMakeLists.txt +++ b/searchlib/src/tests/queryeval/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_queryeval_test_app TEST SOURCES - queryeval.cpp + queryeval_test.cpp DEPENDS searchlib searchlib_test diff --git a/searchlib/src/tests/queryeval/queryeval.cpp b/searchlib/src/tests/queryeval/queryeval_test.cpp index 698bf7c08d5..698bf7c08d5 100644 --- a/searchlib/src/tests/queryeval/queryeval.cpp +++ b/searchlib/src/tests/queryeval/queryeval_test.cpp diff --git a/searchlib/src/tests/queryeval/sourceblender/CMakeLists.txt b/searchlib/src/tests/queryeval/sourceblender/CMakeLists.txt index 3962343060c..266e26c1651 100644 --- a/searchlib/src/tests/queryeval/sourceblender/CMakeLists.txt +++ b/searchlib/src/tests/queryeval/sourceblender/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_sourceblender_test_app TEST SOURCES - sourceblender.cpp + sourceblender_test.cpp DEPENDS searchlib searchlib_test diff --git a/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp b/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp index 15a277d51c6..15a277d51c6 100644 --- a/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp +++ b/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp diff --git a/searchlib/src/tests/sortresults/CMakeLists.txt b/searchlib/src/tests/sortresults/CMakeLists.txt index 345d2ccb186..04069bf7ca4 100644 --- a/searchlib/src/tests/sortresults/CMakeLists.txt +++ b/searchlib/src/tests/sortresults/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(searchlib_sortresults_app TEST +vespa_add_executable(searchlib_sortresults_test_app TEST SOURCES - sorttest.cpp + sortresults_test.cpp DEPENDS searchlib ) -vespa_add_test(NAME searchlib_sortresults_app COMMAND searchlib_sortresults_app) +vespa_add_test(NAME searchlib_sortresults_test_app COMMAND searchlib_sortresults_test_app) diff --git a/searchlib/src/tests/sortresults/sorttest.cpp b/searchlib/src/tests/sortresults/sortresults_test.cpp index bbd6d0b72ce..bbd6d0b72ce 100644 --- a/searchlib/src/tests/sortresults/sorttest.cpp +++ b/searchlib/src/tests/sortresults/sortresults_test.cpp diff --git a/searchlib/src/tests/sortspec/CMakeLists.txt b/searchlib/src/tests/sortspec/CMakeLists.txt index a9b3a906804..9da0def9c9e 100644 --- a/searchlib/src/tests/sortspec/CMakeLists.txt +++ b/searchlib/src/tests/sortspec/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_multilevelsort_test_app TEST SOURCES - multilevelsort.cpp + multilevelsort_test.cpp DEPENDS searchlib ) diff --git a/searchlib/src/tests/sortspec/multilevelsort.cpp b/searchlib/src/tests/sortspec/multilevelsort_test.cpp index 001903ff302..001903ff302 100644 --- a/searchlib/src/tests/sortspec/multilevelsort.cpp +++ b/searchlib/src/tests/sortspec/multilevelsort_test.cpp diff --git a/searchlib/src/tests/true/CMakeLists.txt b/searchlib/src/tests/true/CMakeLists.txt index a2856f3391e..b119d0a25e4 100644 --- a/searchlib/src/tests/true/CMakeLists.txt +++ b/searchlib/src/tests/true/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchlib_true_test_app TEST SOURCES - true.cpp + true_test.cpp DEPENDS ) vespa_add_test(NAME searchlib_true_test_app COMMAND searchlib_true_test_app) diff --git a/searchlib/src/tests/true/true.cpp b/searchlib/src/tests/true/true_test.cpp index 8dee60ddd40..8dee60ddd40 100644 --- a/searchlib/src/tests/true/true.cpp +++ b/searchlib/src/tests/true/true_test.cpp diff --git a/searchlib/src/tests/url/CMakeLists.txt b/searchlib/src/tests/url/CMakeLists.txt index 5352a04fea1..d6400d5b651 100644 --- a/searchlib/src/tests/url/CMakeLists.txt +++ b/searchlib/src/tests/url/CMakeLists.txt @@ -1,9 +1,9 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(searchlib_testurl_app TEST +vespa_add_executable(searchlib_url_test_app TEST SOURCES - testurl.cpp + url_test.cpp DEPENDS searchlib ) -vespa_add_test(NAME searchlib_testurl_app COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dotest.sh - DEPENDS searchlib_testurl_app) +vespa_add_test(NAME searchlib_url_test_app COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dotest.sh + DEPENDS searchlib_url_test_app) diff --git a/searchlib/src/tests/url/dotest.sh b/searchlib/src/tests/url/dotest.sh index ce97b427a2d..ee9baf9bf2f 100755 --- a/searchlib/src/tests/url/dotest.sh +++ b/searchlib/src/tests/url/dotest.sh @@ -4,7 +4,7 @@ set -e # Run test echo "Testing the FastS_URL class..." -$VALGRIND ./searchlib_testurl_app +$VALGRIND ./searchlib_url_test_app if [ $? -eq 0 ]; then echo "SUCCESS: Test on FastS_URL passed!" else diff --git a/searchlib/src/tests/url/testurl.cpp b/searchlib/src/tests/url/url_test.cpp index 64a3827495a..64a3827495a 100644 --- a/searchlib/src/tests/url/testurl.cpp +++ b/searchlib/src/tests/url/url_test.cpp diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp index e9a9520e8c0..ca3aae78270 100644 --- a/storage/src/tests/bucketdb/bucketmanagertest.cpp +++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp @@ -45,8 +45,7 @@ struct TestBucketInfo { uint32_t count; uint32_t partition; - api::BucketInfo getInfo() const - { return api::BucketInfo(crc, count, size); } + api::BucketInfo getInfo() const { return {crc, count, size}; } }; std::ostream& operator<<(std::ostream& out, const TestBucketInfo& info) { @@ -68,19 +67,15 @@ public: uint32_t _emptyBuckets; document::Document::SP _document; - ~BucketManagerTest(); + ~BucketManagerTest() override; void setupTestEnvironment(bool fakePersistenceLayer = true, bool noDelete = false); void addBucketsToDB(uint32_t count); - bool wasBlockedDueToLastModified(api::StorageMessage* msg, - uint64_t lastModified); - void insertSingleBucket(const document::BucketId& bucket, - const api::BucketInfo& info); + bool wasBlockedDueToLastModified(api::StorageMessage* msg, uint64_t lastModified); + void insertSingleBucket(const document::BucketId& bucket, const api::BucketInfo& info); void waitUntilRequestsAreProcessing(size_t nRequests = 1); - void doTestMutationOrdering( - ConcurrentOperationFixture& fixture, - const TestParams& params); + void doTestMutationOrdering( ConcurrentOperationFixture& fixture, const TestParams& params); void doTestConflictingReplyIsEnqueued( const document::BucketId& bucket, const api::StorageCommand::SP& treeMutationCmd, @@ -92,14 +87,13 @@ public: const document::BucketId& bucketForSplit, api::Timestamp mutationTimestamp); void sendSingleBucketInfoRequest(const document::BucketId& id); - void assertRequestWithBadHashIsRejected( - ConcurrentOperationFixture& fixture); + void assertRequestWithBadHashIsRejected(ConcurrentOperationFixture& fixture); protected: - void update_min_used_bits() { + void update_min_used_bits() const { _manager->updateMinUsedBits(); } - void trigger_metric_manager_update() { + void trigger_metric_manager_update() const { std::mutex l; _manager->updateMetrics(BucketManager::MetricLockGuard(l)); } @@ -137,8 +131,7 @@ std::string getMkDirDisk(const std::string & rootFolder, int disk) { return os.str(); } -void BucketManagerTest::setupTestEnvironment(bool fakePersistenceLayer, - bool noDelete) +void BucketManagerTest::setupTestEnvironment(bool fakePersistenceLayer, bool noDelete) { vdstestlib::DirConfig config(getStandardConfig(true, "bucketmanagertest")); std::string rootFolder = getRootFolder(config); @@ -149,8 +142,7 @@ void BucketManagerTest::setupTestEnvironment(bool fakePersistenceLayer, assert(system(getMkDirDisk(rootFolder, 1).c_str()) == 0); auto repo = std::make_shared<const DocumentTypeRepo>( - *ConfigGetter<DocumenttypesConfig>::getConfig( - "config-doctypes", FileSpec("../config-doctypes.cfg"))); + *ConfigGetter<DocumenttypesConfig>::getConfig("config-doctypes", FileSpec("../config-doctypes.cfg"))); _top = std::make_unique<DummyStorageLink>(); _node = std::make_unique<TestServiceLayerApp>(NodeIndex(0), config.getConfigId()); _node->setTypeRepo(repo); @@ -164,9 +156,9 @@ void BucketManagerTest::setupTestEnvironment(bool fakePersistenceLayer, _bottom = bottom.get(); _top->push_back(std::move(bottom)); } else { - auto bottom = std::make_unique<FileStorManager>( - config::ConfigUri(config.getConfigId()), - _node->getPersistenceProvider(), _node->getComponentRegister(), *_node, _node->get_host_info()); + auto bottom = std::make_unique<FileStorManager>(config::ConfigUri(config.getConfigId()), + _node->getPersistenceProvider(), _node->getComponentRegister(), + *_node, _node->get_host_info()); _top->push_back(std::move(bottom)); } // Generate a doc to use for testing.. @@ -183,8 +175,7 @@ void BucketManagerTest::addBucketsToDB(uint32_t count) document::BucketId id(16, randomizer.nextUint32()); id = id.stripUnused(); if (_bucketInfo.empty()) { - id = _node->getBucketIdFactory().getBucketId( - _document->getId()).stripUnused(); + id = _node->getBucketIdFactory().getBucketId(_document->getId()).stripUnused(); } TestBucketInfo info; info.crc = randomizer.nextUint32(); @@ -204,16 +195,13 @@ void BucketManagerTest::addBucketsToDB(uint32_t count) ++_emptyBuckets; for (const auto& bi : _bucketInfo) { bucketdb::StorageBucketInfo entry; - entry.setBucketInfo(api::BucketInfo(bi.second.crc, - bi.second.count, - bi.second.size)); + entry.setBucketInfo(api::BucketInfo(bi.second.crc, bi.second.count, bi.second.size)); _node->getStorageBucketDatabase().insert(bi.first, entry, "foo"); } } bool -BucketManagerTest::wasBlockedDueToLastModified(api::StorageMessage* msg, - uint64_t lastModified) +BucketManagerTest::wasBlockedDueToLastModified(api::StorageMessage* msg, uint64_t lastModified) { setupTestEnvironment(); document::BucketId id(16, 1); @@ -238,8 +226,7 @@ BucketManagerTest::wasBlockedDueToLastModified(api::StorageMessage* msg, // Check that bucket database now has the operation's timestamp as last modified. { - StorBucketDatabase::WrappedEntry entry( - _node->getStorageBucketDatabase().get(id, "foo")); + StorBucketDatabase::WrappedEntry entry(_node->getStorageBucketDatabase().get(id, "foo")); assert(entry->info.getLastModified() == lastModified); } @@ -280,8 +267,7 @@ TEST_F(BucketManagerTest, distribution_bit_change_on_create_bucket){ update_min_used_bits(); EXPECT_EQ(16u, _node->getStateUpdater().getReportedNodeState()->getMinUsedBits()); - std::shared_ptr<api::CreateBucketCommand> cmd( - new api::CreateBucketCommand(makeDocumentBucket(document::BucketId(4, 5678)))); + auto cmd = std::make_shared<api::CreateBucketCommand>(makeDocumentBucket(document::BucketId(4, 5678))); _top->sendDown(cmd); EXPECT_EQ(4u, _node->getStateUpdater().getReportedNodeState()->getMinUsedBits()); } @@ -290,8 +276,7 @@ TEST_F(BucketManagerTest, min_used_bits_from_component_is_honored) { setupTestEnvironment(); // Let these differ in order to test state update behavior. _node->getComponentRegister().getMinUsedBitsTracker().setMinUsedBits(10); - lib::NodeState ns( - *_node->getStateUpdater().getReportedNodeState()); + lib::NodeState ns(*_node->getStateUpdater().getReportedNodeState()); ns.setMinUsedBits(13); _node->getStateUpdater().setReportedNodeState(ns); addBucketsToDB(30); @@ -301,8 +286,7 @@ TEST_F(BucketManagerTest, min_used_bits_from_component_is_honored) { // 12 >= 10, so no update of reported state (left at 13; this should of // course not happen in practice, but used for faking in the test) - std::shared_ptr<api::CreateBucketCommand> cmd( - new api::CreateBucketCommand(makeDocumentBucket(document::BucketId(12, 5678)))); + auto cmd = std::make_shared<api::CreateBucketCommand>(makeDocumentBucket(document::BucketId(12, 5678))); _top->sendDown(cmd); EXPECT_EQ(13u, _node->getStateUpdater().getReportedNodeState()->getMinUsedBits()); } @@ -322,20 +306,15 @@ TEST_F(BucketManagerTest, DISABLED_request_bucket_info_with_state) { _node->setClusterState(states.back()); for (uint32_t i=0; i<states.size(); ++i) { - api::SetSystemStateCommand::SP cmd( - new api::SetSystemStateCommand(states[i])); - _manager->onDown(cmd); + _manager->onDown(std::make_shared<api::SetSystemStateCommand>(states[i])); } // Send a request bucket info command that will be outdated and failed. - std::shared_ptr<api::RequestBucketInfoCommand> cmd1( - new api::RequestBucketInfoCommand(makeBucketSpace(), 0, states[1])); + auto cmd1 = std::make_shared<api::RequestBucketInfoCommand>(makeBucketSpace(), 0, states[1]); // Send two request bucket info commands that will be processed together // when the bucket manager is idle, as states are equivalent - std::shared_ptr<api::RequestBucketInfoCommand> cmd2( - new api::RequestBucketInfoCommand(makeBucketSpace(), 0, states[2])); - std::shared_ptr<api::RequestBucketInfoCommand> cmd3( - new api::RequestBucketInfoCommand(makeBucketSpace(), 0, states[3])); + auto cmd2 = std::make_shared<api::RequestBucketInfoCommand>(makeBucketSpace(), 0, states[2]); + auto cmd3 = std::make_shared<api::RequestBucketInfoCommand>(makeBucketSpace(), 0, states[3]); // Tag server initialized before starting _top->open(); @@ -355,34 +334,28 @@ TEST_F(BucketManagerTest, DISABLED_request_bucket_info_with_state) { std::map<uint64_t, api::RequestBucketInfoReply::SP> replies; for (uint32_t i=0; i<3; ++i) { replies[_top->getReply(i)->getMsgId()] - = std::dynamic_pointer_cast<api::RequestBucketInfoReply>( - _top->getReply(i)); + = std::dynamic_pointer_cast<api::RequestBucketInfoReply>(_top->getReply(i)); } - std::shared_ptr<api::RequestBucketInfoReply> reply1( - replies[cmd1->getMsgId()]); - std::shared_ptr<api::RequestBucketInfoReply> reply2( - replies[cmd2->getMsgId()]); - std::shared_ptr<api::RequestBucketInfoReply> reply3( - replies[cmd3->getMsgId()]); + auto reply1 = replies[cmd1->getMsgId()]; + auto reply2 = replies[cmd2->getMsgId()]; + auto reply3 = replies[cmd3->getMsgId()]; _top->reset(); ASSERT_TRUE(reply1.get()); ASSERT_TRUE(reply2.get()); ASSERT_TRUE(reply3.get()); EXPECT_EQ(api::ReturnCode(api::ReturnCode::REJECTED, - "Ignoring bucket info request for cluster state version 1 as " - "versions from version 2 differs from this state."), - reply1->getResult()); + "Ignoring bucket info request for cluster state version 1 as " + "versions from version 2 differs from this state."), + reply1->getResult()); EXPECT_EQ(api::ReturnCode(api::ReturnCode::REJECTED, - "There is already a newer bucket info request for " - "this node from distributor 0"), - reply2->getResult()); + "There is already a newer bucket info request for this node from distributor 0"), + reply2->getResult()); EXPECT_EQ(api::ReturnCode(api::ReturnCode::OK), - reply3->getResult()); + reply3->getResult()); api::RequestBucketInfoReply::Entry entry; ASSERT_EQ(18u, reply3->getBucketInfo().size()); - entry = api::RequestBucketInfoReply::Entry( - document::BucketId(16, 0xe8c8), api::BucketInfo(0x79d04f78, 11153, 1851385240u)); + entry = api::RequestBucketInfoReply::Entry( document::BucketId(16, 0xe8c8), api::BucketInfo(0x79d04f78, 11153, 1851385240u)); EXPECT_EQ(entry, reply3->getBucketInfo()[0]); } } @@ -407,9 +380,8 @@ TEST_F(BucketManagerTest, request_bucket_info_with_list) { ASSERT_TRUE(reply.get()); EXPECT_EQ(api::ReturnCode(api::ReturnCode::OK), reply->getResult()); ASSERT_EQ(1u, reply->getBucketInfo().size()); - api::RequestBucketInfoReply::Entry entry( - document::BucketId(16, 0xe8c8), - api::BucketInfo(0x79d04f78, 11153, 1851385240u)); + api::RequestBucketInfoReply::Entry entry(document::BucketId(16, 0xe8c8), + api::BucketInfo(0x79d04f78, 11153, 1851385240u)); EXPECT_EQ(entry, reply->getBucketInfo()[0]); } } @@ -421,8 +393,7 @@ TEST_F(BucketManagerTest, swallow_notify_bucket_change_reply) { _node->getDoneInitializeHandler().notifyDoneInitializing(); _top->doneInit(); - api::NotifyBucketChangeCommand cmd(makeDocumentBucket(document::BucketId(1, 16)), - api::BucketInfo()); + api::NotifyBucketChangeCommand cmd(makeDocumentBucket(document::BucketId(1, 16)), api::BucketInfo()); auto reply = std::make_shared<api::NotifyBucketChangeReply>(cmd); _top->sendDown(reply); @@ -444,8 +415,7 @@ TEST_F(BucketManagerTest, metrics_generation) { } } entry.setBucketInfo(info); - _node->getStorageBucketDatabase().insert(document::BucketId(16, i), - entry, "foo"); + _node->getStorageBucketDatabase().insert(document::BucketId(16, i), entry, "foo"); } _node->getDoneInitializeHandler().notifyDoneInitializing(); _top->doneInit(); @@ -535,8 +505,7 @@ TEST_F(BucketManagerTest, metrics_are_tracked_per_bucket_space) { } void -BucketManagerTest::insertSingleBucket(const document::BucketId& bucket, - const api::BucketInfo& info) +BucketManagerTest::insertSingleBucket(const document::BucketId& bucket, const api::BucketInfo& info) { bucketdb::StorageBucketInfo entry; entry.setBucketInfo(info); @@ -556,9 +525,7 @@ namespace { struct WithBuckets { std::map<document::BucketId, api::BucketInfo> _bucketsAndInfo; - WithBuckets& add(const document::BucketId& id, - const api::BucketInfo& info) - { + WithBuckets& add(const document::BucketId& id, const api::BucketInfo& info) { _bucketsAndInfo[id] = info; return *this; } @@ -613,22 +580,18 @@ public: return _self._node->getStorageBucketDatabase().get(bucket, "foo"); } - auto createRemoveCommand(const document::BucketId& bucket, - api::Timestamp timestamp = 123456) const + auto createRemoveCommand(const document::BucketId& bucket, api::Timestamp timestamp = 123456) const { // Note: this is a dummy message; its contained document ID will not // map to the provided bucket ID (at least it's extremely unlikely..) - return std::make_shared<api::RemoveCommand>( - makeDocumentBucket(bucket), - document::DocumentId("id:foo:testdoctype1::bar"), - timestamp); + return std::make_shared<api::RemoveCommand>(makeDocumentBucket(bucket), + document::DocumentId("id:foo:testdoctype1::bar"), timestamp); } auto createPutCommand(const document::BucketId& bucket) const { auto doc = _self._node->getTestDocMan().createDocument( "a foo walks into a bar", "id:foo:testdoctype1::bar1"); - return std::make_shared<api::PutCommand>( - makeDocumentBucket(bucket), std::move(doc), api::Timestamp(123456)); + return std::make_shared<api::PutCommand>(makeDocumentBucket(bucket), std::move(doc), api::Timestamp(123456)); } auto createUpdateCommand(const document::BucketId& bucket) const { @@ -637,8 +600,7 @@ public: *_self._node->getTestDocMan().getTypeRepo() .getDocumentType("testdoctype1"), document::DocumentId("id:foo:testdoctype1::bar2")); - return std::make_shared<api::UpdateCommand>( - makeDocumentBucket(bucket), update, api::Timestamp(123456)); + return std::make_shared<api::UpdateCommand>(makeDocumentBucket(bucket), update, api::Timestamp(123456)); } auto createFullFetchCommand() const { @@ -653,10 +615,6 @@ public: return std::make_shared<api::RequestBucketInfoCommand>(makeBucketSpace(), 0, *_state, hash); } - auto createFullFetchCommandWithHash(document::BucketSpace space, vespalib::stringref hash) const { - return std::make_shared<api::RequestBucketInfoCommand>(space, 0, *_state, hash); - } - auto acquireBucketLockAndSendInfoRequest(const document::BucketId& bucket) { auto guard = acquireBucketLock(bucket); // Send down processing command which will block. @@ -690,13 +648,11 @@ public: } auto awaitAndGetReplies(size_t nReplies) { - _self._top->waitForMessages( - nReplies, BucketManagerTest::MESSAGE_WAIT_TIME); + _self._top->waitForMessages(nReplies, BucketManagerTest::MESSAGE_WAIT_TIME); return _self._top->getReplies(); } - void assertOrderedAfterBucketReply(size_t nBucketReplies, - const api::MessageType& msgType) + void assertOrderedAfterBucketReply(size_t nBucketReplies, const api::MessageType& msgType) { const size_t nTotal = nBucketReplies + 1; auto replies = awaitAndGetReplies(nTotal); @@ -750,15 +706,6 @@ group[2].nodes[2].index 5 return GlobalBucketSpaceDistributionConverter::convert_to_global(*default_distr); } - void set_grouped_distribution_configs() { - auto default_distr = default_grouped_distribution(); - _self._node->getComponentRegister().getBucketSpaceRepo() - .get(document::FixedBucketSpaces::default_space()).setDistribution(std::move(default_distr)); - auto global_distr = derived_global_grouped_distribution(); - _self._node->getComponentRegister().getBucketSpaceRepo() - .get(document::FixedBucketSpaces::global_space()).setDistribution(std::move(global_distr)); - } - private: BucketManagerTest& _self; std::shared_ptr<lib::ClusterState> _state; @@ -781,8 +728,7 @@ TEST_F(BucketManagerTest, split_reply_ordered_after_bucket_reply) { // Let bucket manager breathe again. guard.unlock(); - fixture.assertOrderedAfterBucketReply( - 1, api::MessageType::SPLITBUCKET_REPLY); + fixture.assertOrderedAfterBucketReply(1, api::MessageType::SPLITBUCKET_REPLY); } TEST_F(BucketManagerTest, join_reply_ordered_after_bucket_reply) { @@ -801,8 +747,7 @@ TEST_F(BucketManagerTest, join_reply_ordered_after_bucket_reply) { fixture.bounceWithReply(*joinCmd); guard.unlock(); - fixture.assertOrderedAfterBucketReply( - 1, api::MessageType::JOINBUCKETS_REPLY); + fixture.assertOrderedAfterBucketReply(1, api::MessageType::JOINBUCKETS_REPLY); } // Technically, deletes being ordered after bucket info replies won't help @@ -823,8 +768,7 @@ TEST_F(BucketManagerTest, delete_reply_ordered_after_bucket_reply) { guard.unlock(); - fixture.assertOrderedAfterBucketReply( - 1, api::MessageType::DELETEBUCKET_REPLY); + fixture.assertOrderedAfterBucketReply(1, api::MessageType::DELETEBUCKET_REPLY); } TEST_F(BucketManagerTest, only_enqueue_when_processing_request) { @@ -874,8 +818,7 @@ TEST_F(BucketManagerTest, order_replies_after_bucket_specific_request) { infoRoundtrip.get(); // At this point, we know 2 messages are in the top queue since the // async future guarantees this for completion. - fixture.assertOrderedAfterBucketReply( - 1, api::MessageType::SPLITBUCKET_REPLY); + fixture.assertOrderedAfterBucketReply(1, api::MessageType::SPLITBUCKET_REPLY); } // Test is similar to order_replies_after_bucket_specific_request, but has @@ -911,8 +854,7 @@ TEST_F(BucketManagerTest, queued_replies_only_dispatched_when_all_processing_don singleBucketInfo.get(); fullFetch.get(); - fixture.assertOrderedAfterBucketReply( - 2, api::MessageType::SPLITBUCKET_REPLY); + fixture.assertOrderedAfterBucketReply(2, api::MessageType::SPLITBUCKET_REPLY); } // Hide boring, repetetive code to allow for chaining of setters (and auto- @@ -941,9 +883,7 @@ TestParams::TestParams(const TestParams &) = default; TestParams::~TestParams() = default; void -BucketManagerTest::doTestMutationOrdering( - ConcurrentOperationFixture& fixture, - const TestParams& params) +BucketManagerTest::doTestMutationOrdering(ConcurrentOperationFixture& fixture, const TestParams& params) { fixture.setUp(WithBuckets() .add(params.bucket(), api::BucketInfo(50, 100, 200))); @@ -962,9 +902,7 @@ BucketManagerTest::doTestMutationOrdering( // to avoid test deadlocks, and priorities may alter the execution order // anyway. The important thing is that reply orders are not altered. fixture.bounceWithReply(*params.treeMutation()); - fixture.bounceWithReply(*params.documentMutation(), - api::ReturnCode::OK, - params.remappedTo()); + fixture.bounceWithReply(*params.documentMutation(), api::ReturnCode::OK, params.remappedTo()); guard.unlock(); fixture.assertReplyOrdering(params.expectedOrdering()); @@ -993,18 +931,16 @@ BucketManagerTest::doTestConflictingReplyIsEnqueued( TEST_F(BucketManagerTest, mutation_replies_for_split_bucket_are_enqueued) { document::BucketId bucket(17, 0); - doTestConflictingReplyIsEnqueued( - bucket, - std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucket)), - api::MessageType::SPLITBUCKET_REPLY); + doTestConflictingReplyIsEnqueued(bucket, + std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucket)), + api::MessageType::SPLITBUCKET_REPLY); } TEST_F(BucketManagerTest, mutation_replies_for_deleted_bucket_are_enqueued) { document::BucketId bucket(17, 0); - doTestConflictingReplyIsEnqueued( - bucket, - std::make_shared<api::DeleteBucketCommand>(makeDocumentBucket(bucket)), - api::MessageType::DELETEBUCKET_REPLY); + doTestConflictingReplyIsEnqueued(bucket, + std::make_shared<api::DeleteBucketCommand>(makeDocumentBucket(bucket)), + api::MessageType::DELETEBUCKET_REPLY); } TEST_F(BucketManagerTest, mutation_replies_for_joined_bucket_are_enqueued) { @@ -1088,14 +1024,11 @@ BucketManagerTest::scheduleBucketInfoRequestWithConcurrentOps( const document::BucketId& bucketForSplit, api::Timestamp mutationTimestamp) { - auto mutation( - fixture.createRemoveCommand(bucketForRemove, mutationTimestamp)); + auto mutation(fixture.createRemoveCommand(bucketForRemove, mutationTimestamp)); _top->sendDown(mutation); - auto guard = fixture.acquireBucketLockAndSendInfoRequest( - bucketForRemove); + auto guard = fixture.acquireBucketLockAndSendInfoRequest(bucketForRemove); - auto conflictingOp( - std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucketForSplit))); + auto conflictingOp = std::make_shared<api::SplitBucketCommand>(makeDocumentBucket(bucketForSplit)); _top->sendDown(conflictingOp); fixture.bounceWithReply(*conflictingOp); fixture.bounceWithReply(*mutation); @@ -1114,9 +1047,7 @@ TEST_F(BucketManagerTest, bucket_conflict_set_is_cleared_between_blocking_reques // Do a single round of starting and completing a request bucket info // command with queueing and adding of `firstConflictBucket` to the set // of conflicting buckets. - scheduleBucketInfoRequestWithConcurrentOps( - fixture, firstConflictBucket, - firstConflictBucket, api::Timestamp(1000)); + scheduleBucketInfoRequestWithConcurrentOps( fixture, firstConflictBucket, firstConflictBucket, api::Timestamp(1000)); // Barrier for completion of first round of replies. Subsequently remove // all replies to get a clean slate. @@ -1126,9 +1057,7 @@ TEST_F(BucketManagerTest, bucket_conflict_set_is_cleared_between_blocking_reques // Do a second round with a different bucket as the conflict. The // mutation towards the first conflict bucket should now _not_ be queued // as it was for an entirely different request bucket round. - scheduleBucketInfoRequestWithConcurrentOps( - fixture, firstConflictBucket, - secondConflictBucket, api::Timestamp(1001)); + scheduleBucketInfoRequestWithConcurrentOps(fixture, firstConflictBucket, secondConflictBucket, api::Timestamp(1001)); // Remove is not ordered after the split here since it should not be // queued. @@ -1198,8 +1127,7 @@ TEST_F(BucketManagerTest, conflict_set_only_cleared_after_all_bucket_requests_do } void -BucketManagerTest::assertRequestWithBadHashIsRejected( - ConcurrentOperationFixture& fixture) +BucketManagerTest::assertRequestWithBadHashIsRejected(ConcurrentOperationFixture& fixture) { // Test by default sets up 10 nodes in config. Pretend we only know of 3. auto infoCmd = fixture.createFullFetchCommandWithHash("(0;0;1;2)"); diff --git a/storage/src/tests/common/testhelper.cpp b/storage/src/tests/common/testhelper.cpp index 8580ba8a8d2..1aecd72172a 100644 --- a/storage/src/tests/common/testhelper.cpp +++ b/storage/src/tests/common/testhelper.cpp @@ -48,7 +48,6 @@ vdstestlib::DirConfig getStandardConfig(bool storagenode, const std::string & ro config = &dc.addConfig("messagebus"); config = &dc.addConfig("stor-prioritymapping"); config = &dc.addConfig("stor-bucketdbupdater"); - config = &dc.addConfig("stor-bucket-init"); config = &dc.addConfig("metricsmanager"); config->set("consumer[2]"); config->set("consumer[0].name", "\"status\""); @@ -81,9 +80,6 @@ vdstestlib::DirConfig getStandardConfig(bool storagenode, const std::string & ro // Don't want test to call exit() config->set("fail_disk_after_error_count", "0"); config = &dc.addConfig("stor-bouncer"); - config = &dc.addConfig("stor-integritychecker"); - config = &dc.addConfig("stor-bucketmover"); - config = &dc.addConfig("stor-messageforwarder"); config = &dc.addConfig("stor-server"); config->set("cluster_name", clusterName); config->set("enable_dead_lock_detector", "false"); diff --git a/storage/src/vespa/storage/bucketdb/.gitignore b/storage/src/vespa/storage/bucketdb/.gitignore index 54d8faa8201..3df72b601a2 100644 --- a/storage/src/vespa/storage/bucketdb/.gitignore +++ b/storage/src/vespa/storage/bucketdb/.gitignore @@ -7,5 +7,3 @@ .libs Makefile config-stor-bucketdb.* -/config-stor-bucket-init.h -/config-stor-bucket-init.cpp diff --git a/storage/src/vespa/storage/bucketdb/CMakeLists.txt b/storage/src/vespa/storage/bucketdb/CMakeLists.txt index fe60426325c..b16795a90ba 100644 --- a/storage/src/vespa/storage/bucketdb/CMakeLists.txt +++ b/storage/src/vespa/storage/bucketdb/CMakeLists.txt @@ -15,5 +15,3 @@ vespa_add_library(storage_bucketdb OBJECT ) vespa_generate_config(storage_bucketdb stor-bucketdb.def) install_config_definition(stor-bucketdb.def vespa.config.content.core.stor-bucketdb.def) -vespa_generate_config(storage_bucketdb stor-bucket-init.def) -install_config_definition(stor-bucket-init.def vespa.config.content.core.stor-bucket-init.def) diff --git a/storage/src/vespa/storage/bucketdb/stor-bucket-init.def b/storage/src/vespa/storage/bucketdb/stor-bucket-init.def deleted file mode 100644 index c3344e324a5..00000000000 --- a/storage/src/vespa/storage/bucketdb/stor-bucket-init.def +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -namespace=vespa.config.content.core - -# The maximum number of alien files found during init that should be stored in -# memory so they can be viewed on status page. -max_alien_files_logged int default=10 restart - -# The maximum number of pending info reads to each disk during initialization. -max_pending_info_reads_per_disk int default=20 restart - -# The minimum number of pending info reads to each disk during initialization. -# When pending falls below this, we will resume database scan to add more -# pending up to the maximum setting. -min_pending_info_reads_per_disk int default=4 restart - -# The priority of the read bucket info requests the initializer sends to the -# persistence layer. Currently chosen so that such operations will not pre- -# empt any regular external load or ideal state operations, but they will block -# very low priority background operations such as periodic GC (default pri of -# 200). A tradeoff must be made between fast initialization and the availability -# of data on the initializing node. -info_read_priority int default=185 restart - -# The priority of the list bucket requests the initializer sends to the -# persistence layer. Should always be lower than the read priority to ensure -# starting to read wont make listing wait. However, listing is currently pretty -# much required to be done before starting anyhow, so this option does little -# unless your directories are not hardware independent. -list_priority int default=100 restart - -# Whether the initializer should complete listing before starting to read -# bucket information. Shouldnt matter much performance wise so always set to -# true as it is now. Setting it false, disks done listing first will start -# to process info requests a bit earlier than otherwise. -complete_list_before_starting_read bool default=false restart diff --git a/storage/src/vespa/storage/config/CMakeLists.txt b/storage/src/vespa/storage/config/CMakeLists.txt index 58996592677..cd3d99d0ccc 100644 --- a/storage/src/vespa/storage/config/CMakeLists.txt +++ b/storage/src/vespa/storage/config/CMakeLists.txt @@ -12,16 +12,10 @@ vespa_generate_config(storage_storageconfig stor-server.def) install_config_definition(stor-server.def vespa.config.content.core.stor-server.def) vespa_generate_config(storage_storageconfig stor-status.def) install_config_definition(stor-status.def vespa.config.content.core.stor-status.def) -vespa_generate_config(storage_storageconfig stor-messageforwarder.def) -install_config_definition(stor-messageforwarder.def vespa.config.content.core.stor-messageforwarder.def) vespa_generate_config(storage_storageconfig stor-opslogger.def) install_config_definition(stor-opslogger.def vespa.config.content.core.stor-opslogger.def) vespa_generate_config(storage_storageconfig stor-visitordispatcher.def) install_config_definition(stor-visitordispatcher.def vespa.config.content.core.stor-visitordispatcher.def) -vespa_generate_config(storage_storageconfig stor-integritychecker.def) -install_config_definition(stor-integritychecker.def vespa.config.content.core.stor-integritychecker.def) -vespa_generate_config(storage_storageconfig stor-bucketmover.def) -install_config_definition(stor-bucketmover.def vespa.config.content.core.stor-bucketmover.def) vespa_generate_config(storage_storageconfig stor-bouncer.def) install_config_definition(stor-bouncer.def vespa.config.content.core.stor-bouncer.def) vespa_generate_config(storage_storageconfig stor-prioritymapping.def) diff --git a/storage/src/vespa/storage/config/stor-bucketmover.def b/storage/src/vespa/storage/config/stor-bucketmover.def deleted file mode 100644 index 80192c37ed7..00000000000 --- a/storage/src/vespa/storage/config/stor-bucketmover.def +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -namespace=vespa.config.content.core - -## Minimum time between bucket database iterations in the bucket mover. The -## minumum time is used when disks starts to get pretty full and we have plenty -## stuff we can move. -## restart flag was added automatically and needs to be verified. -minimum_recheck_interval_in_seconds int default=60 restart - -## Maximum time between bucket database iterations in the bucket mover. The -## maximum time is used when disks have plenty free space, so moving data is -## not critical. -## restart flag was added automatically and needs to be verified. -maximum_recheck_interval_in_seconds int default=3600 restart - -## Number of buckets to cache at a time when reading the bucket database -## restart flag was added automatically and needs to be verified. -bucket_iteration_chunk int default=1000 restart - -## Maximum fill rate above average fill rate for a target disk to be eligible -## as a target for a bucket move operation. -## restart flag was added automatically and needs to be verified. -max_target_fill_rate_above_average double default=0.01 restart - -## Number of bucket mover runs to keep in history vector -## restart flag was added automatically and needs to be verified. -max_history_size int default=10 restart - -## Max concurrent pending bucket move operations scheduled in total. -## restart flag was added automatically and needs to be verified. -max_pending int default=5 restart - -## Operation delay. If set, the bucket mover will wait for this amount of -## milliseconds between each operation. Useful in testing to make move run go -## slow enough to view without that much data. -## restart flag was added automatically and needs to be verified. -operation_delay int default=0 restart diff --git a/storage/src/vespa/storage/config/stor-integritychecker.def b/storage/src/vespa/storage/config/stor-integritychecker.def deleted file mode 100644 index 80685cbb58f..00000000000 --- a/storage/src/vespa/storage/config/stor-integritychecker.def +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -namespace=vespa.config.content.core - -## Minutes after midnight when integrity checker is allowed to start running. -## 0 means it will start/continue run at midnight. -dailycyclestart int default=0 - -## Minutes after midnight when integrity checker is not allowed to run anymore. -## If this equals dailycyclestart it is allowed to run all day. dailycyclestop -## is allowed to be less than dailycyclestart. -dailycyclestop int default=0 - -## Status of what is allowed done on what weekdays. Should be a string with -## seven characters, where the first represent sunday, the seventh saturday. -## The possible options are RrCc- which means: -## R - If state becomes R, and current cycle does not verify file content, -## abort current cycle, otherwise continue it. Start new cycle verifying -## all content of all files. -## r - Continue current cycle. Start new cycle using cheap partial file -## verification. -## c - Continue current cycle. Dont start a new cycle. -weeklycycle string default="Rrrrrrr" - -## Max concurrent pending bucket verifications. For max speed, each disk thread -## should have one to work with all the time. Default is 1, to ensure little -## resources are consumed by this process by default. Once request priority -## has been introduced, this default may become higher. -maxpending int default=2 - -## Minimum time since last cycle before starting a new one in minutes. -## Defaults to 24 hours. -mincycletime int default=1440 - -## Minimum time in seconds between each request. To throttle the system even -## slower if continuous one pending puts on more load on the system than you -## want. Works with multiple pending messages, though it doesnt make much sense -## unless maxpending equals 1. -requestdelay int default=0 diff --git a/storage/src/vespa/storage/config/stor-messageforwarder.def b/storage/src/vespa/storage/config/stor-messageforwarder.def deleted file mode 100644 index b17e6ddae3b..00000000000 --- a/storage/src/vespa/storage/config/stor-messageforwarder.def +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -namespace=vespa.config.content.core - -route string default="" restart diff --git a/storage/src/vespa/storage/storageserver/servicelayernode.cpp b/storage/src/vespa/storage/storageserver/servicelayernode.cpp index b5bed68259a..65615bea2dd 100644 --- a/storage/src/vespa/storage/storageserver/servicelayernode.cpp +++ b/storage/src/vespa/storage/storageserver/servicelayernode.cpp @@ -40,10 +40,13 @@ ServiceLayerNode::ServiceLayerNode(const config::ConfigUri & configUri, ServiceL } void -ServiceLayerNode::report(vespalib::JsonStream &writer) const +ServiceLayerNode::report(vespalib::JsonStream &stream) const { + using namespace vespalib::jsonstream; if (_bucket_manager) { - _bucket_manager->report(writer); + stream << "metrics" << Object() << "values" << Array(); + _bucket_manager->report(stream); + stream << End() << End(); } } diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp index 49957d1d321..742f994cb2d 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.cpp +++ b/storage/src/vespa/storage/storageserver/statemanager.cpp @@ -573,9 +573,7 @@ StateManager::getNodeInfo() const stream << Object(); { // Print metrics try { - stream << "metrics" << Object() << "values" << Array(); _nodeStateReporter.report(stream); - stream << End() << End(); } catch (vespalib::Exception& e) { stream << Object() << "error" << e.getMessage() << End(); } diff --git a/storageserver/src/tests/testhelper.cpp b/storageserver/src/tests/testhelper.cpp index f36253ce9d3..73a9938e4c5 100644 --- a/storageserver/src/tests/testhelper.cpp +++ b/storageserver/src/tests/testhelper.cpp @@ -33,7 +33,6 @@ vdstestlib::DirConfig getStandardConfig(bool storagenode) { config = &dc.addConfig("messagebus"); config = &dc.addConfig("stor-prioritymapping"); config = &dc.addConfig("stor-bucketdbupdater"); - config = &dc.addConfig("stor-bucket-init"); config = &dc.addConfig("metricsmanager"); config->set("consumer[1]"); config->set("consumer[0].name", "\"status\""); @@ -62,8 +61,6 @@ vdstestlib::DirConfig getStandardConfig(bool storagenode) { config->set("revert_time_period", "2000000000"); config = &dc.addConfig("stor-bouncer"); config = &dc.addConfig("stor-integritychecker"); - config = &dc.addConfig("stor-bucketmover"); - config = &dc.addConfig("stor-messageforwarder"); config = &dc.addConfig("stor-server"); config->set("enable_dead_lock_detector", "false"); config->set("enable_dead_lock_detector_warnings", "false"); diff --git a/streamingvisitors/src/tests/charbuffer/CMakeLists.txt b/streamingvisitors/src/tests/charbuffer/CMakeLists.txt index 5d0c0068d37..0cefae9d4c1 100644 --- a/streamingvisitors/src/tests/charbuffer/CMakeLists.txt +++ b/streamingvisitors/src/tests/charbuffer/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(vsm_charbuffer_test_app TEST SOURCES - charbuffer.cpp + charbuffer_test.cpp DEPENDS streamingvisitors ) diff --git a/streamingvisitors/src/tests/charbuffer/charbuffer.cpp b/streamingvisitors/src/tests/charbuffer/charbuffer_test.cpp index 736d35459cb..736d35459cb 100644 --- a/streamingvisitors/src/tests/charbuffer/charbuffer.cpp +++ b/streamingvisitors/src/tests/charbuffer/charbuffer_test.cpp diff --git a/streamingvisitors/src/tests/docsum/CMakeLists.txt b/streamingvisitors/src/tests/docsum/CMakeLists.txt index 87c46409053..f8ff09d8063 100644 --- a/streamingvisitors/src/tests/docsum/CMakeLists.txt +++ b/streamingvisitors/src/tests/docsum/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(vsm_docsum_test_app TEST SOURCES - docsum.cpp + docsum_test.cpp DEPENDS streamingvisitors ) diff --git a/streamingvisitors/src/tests/docsum/docsum.cpp b/streamingvisitors/src/tests/docsum/docsum_test.cpp index b99ee360bee..b99ee360bee 100644 --- a/streamingvisitors/src/tests/docsum/docsum.cpp +++ b/streamingvisitors/src/tests/docsum/docsum_test.cpp diff --git a/streamingvisitors/src/tests/document/CMakeLists.txt b/streamingvisitors/src/tests/document/CMakeLists.txt index 5ea12dc5e2d..279226e5d90 100644 --- a/streamingvisitors/src/tests/document/CMakeLists.txt +++ b/streamingvisitors/src/tests/document/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(vsm_document_test_app TEST SOURCES - document.cpp + document_test.cpp DEPENDS streamingvisitors ) diff --git a/streamingvisitors/src/tests/document/document.cpp b/streamingvisitors/src/tests/document/document_test.cpp index acebd9ed4a4..acebd9ed4a4 100644 --- a/streamingvisitors/src/tests/document/document.cpp +++ b/streamingvisitors/src/tests/document/document_test.cpp diff --git a/streamingvisitors/src/tests/textutil/CMakeLists.txt b/streamingvisitors/src/tests/textutil/CMakeLists.txt index 59817d01137..56bf2ede996 100644 --- a/streamingvisitors/src/tests/textutil/CMakeLists.txt +++ b/streamingvisitors/src/tests/textutil/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(vsm_textutil_test_app TEST SOURCES - textutil.cpp + textutil_test.cpp DEPENDS streamingvisitors ) diff --git a/streamingvisitors/src/tests/textutil/textutil.cpp b/streamingvisitors/src/tests/textutil/textutil_test.cpp index aeff4600781..aeff4600781 100644 --- a/streamingvisitors/src/tests/textutil/textutil.cpp +++ b/streamingvisitors/src/tests/textutil/textutil_test.cpp diff --git a/testutil/src/main/java/com/yahoo/vespa/test/file/UnixUidGidAttributeProvider.java b/testutil/src/main/java/com/yahoo/vespa/test/file/UnixUidGidAttributeProvider.java index 903706a503d..25f66bf5cb0 100644 --- a/testutil/src/main/java/com/yahoo/vespa/test/file/UnixUidGidAttributeProvider.java +++ b/testutil/src/main/java/com/yahoo/vespa/test/file/UnixUidGidAttributeProvider.java @@ -22,7 +22,6 @@ import com.google.common.jimfs.File; import com.google.common.jimfs.FileLookup; import java.nio.file.attribute.FileAttributeView; -import java.nio.file.attribute.FileTime; import java.nio.file.attribute.GroupPrincipal; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.UserPrincipal; @@ -79,41 +78,39 @@ public class UnixUidGidAttributeProvider extends AttributeProvider { @SuppressWarnings("unchecked") @Override public Object get(File file, String attribute) { - switch (attribute) { - case "uid": - UserPrincipal user = (UserPrincipal) file.getAttribute("owner", "owner"); - return getUniqueId(user); - case "gid": - GroupPrincipal group = (GroupPrincipal) file.getAttribute("posix", "group"); - return getUniqueId(group); - case "mode": - Set<PosixFilePermission> permissions = - (Set<PosixFilePermission>) file.getAttribute("posix", "permissions"); - return toMode(permissions); - case "ctime": - return FileTime.fromMillis(file.getCreationTime()); - case "rdev": - return 0L; - case "dev": - return 1L; - case "ino": - return file.id(); - case "nlink": - return file.links(); - default: - return null; - } + return switch (attribute) { + case "uid" -> { + var user = (UserPrincipal) file.getAttribute("owner", "owner"); + yield getUniqueId(user); + } + case "gid" -> { + var group = (GroupPrincipal) file.getAttribute("posix", "group"); + yield getUniqueId(group); + } + case "mode" -> { + var permissions = (Set<PosixFilePermission>) file.getAttribute("posix", "permissions"); + yield toMode(permissions); + } + case "ctime" -> file.getCreationTime(); + case "rdev" -> 0L; + case "dev" -> 1L; + case "ino" -> file.id(); + case "nlink" -> file.links(); + default -> null; + }; } @Override public void set(File file, String view, String attribute, Object value, boolean create) { switch (attribute) { - case "uid": + case "uid" -> { file.setAttribute("owner", "owner", new BasicUserPrincipal(String.valueOf(value))); return; - case "gid": + } + case "gid" -> { file.setAttribute("posix", "group", new BasicGroupPrincipal(String.valueOf(value))); return; + } } throw unsettable(view, attribute, create); } @@ -124,35 +121,16 @@ public class UnixUidGidAttributeProvider extends AttributeProvider { for (PosixFilePermission permission : permissions) { checkNotNull(permission); switch (permission) { - case OWNER_READ: - result |= 0400; - break; - case OWNER_WRITE: - result |= 0200; - break; - case OWNER_EXECUTE: - result |= 0100; - break; - case GROUP_READ: - result |= 0040; - break; - case GROUP_WRITE: - result |= 0020; - break; - case GROUP_EXECUTE: - result |= 0010; - break; - case OTHERS_READ: - result |= 0004; - break; - case OTHERS_WRITE: - result |= 0002; - break; - case OTHERS_EXECUTE: - result |= 0001; - break; - default: - throw new AssertionError(); // no other possible values + case OWNER_READ -> result |= 0400; + case OWNER_WRITE -> result |= 0200; + case OWNER_EXECUTE -> result |= 0100; + case GROUP_READ -> result |= 0040; + case GROUP_WRITE -> result |= 0020; + case GROUP_EXECUTE -> result |= 0010; + case OTHERS_READ -> result |= 0004; + case OTHERS_WRITE -> result |= 0002; + case OTHERS_EXECUTE -> result |= 0001; + default -> throw new AssertionError(); // no other possible values } } return result; diff --git a/vespa-dependencies-enforcer/allowed-maven-dependencies.txt b/vespa-dependencies-enforcer/allowed-maven-dependencies.txt index 9dc1b0d2fda..c7c1d82c7cd 100644 --- a/vespa-dependencies-enforcer/allowed-maven-dependencies.txt +++ b/vespa-dependencies-enforcer/allowed-maven-dependencies.txt @@ -59,7 +59,7 @@ commons-fileupload:commons-fileupload:1.5 commons-io:commons-io:2.13.0 commons-logging:commons-logging:1.2 io.airlift:airline:0.9 -io.dropwizard.metrics:metrics-core:3.2.5 +io.dropwizard.metrics:metrics-core:3.2.6 io.grpc:grpc-context:1.27.2 io.jsonwebtoken:jjwt-api:0.11.5 io.jsonwebtoken:jjwt-impl:0.11.5 @@ -77,8 +77,11 @@ io.netty:netty-transport-native-epoll:4.1.94.Final io.netty:netty-transport-native-unix-common:4.1.94.Final io.opencensus:opencensus-api:0.31.1 io.opencensus:opencensus-contrib-http-util:0.31.1 -io.prometheus:simpleclient:0.6.0 -io.prometheus:simpleclient_common:0.6.0 +io.prometheus:simpleclient:0.16.0 +io.prometheus:simpleclient_common:0.16.0 +io.prometheus:simpleclient_tracer_common:0.16.0 +io.prometheus:simpleclient_tracer_otel:0.16.0 +io.prometheus:simpleclient_tracer_otel_agent:0.16.0 javax.annotation:javax.annotation-api:1.2 javax.inject:javax.inject:1 javax.servlet:javax.servlet-api:3.1.0 @@ -124,7 +127,7 @@ org.apache.maven.plugin-tools:maven-plugin-annotations:3.9.0 org.apache.maven.plugins:maven-jar-plugin:3.3.0 org.apache.maven.shared:file-management:3.1.0 org.apache.maven.wagon:wagon-provider-api:3.5.3 -org.apache.opennlp:opennlp-tools:1.9.3 +org.apache.opennlp:opennlp-tools:1.9.4 org.apache.velocity:velocity-engine-core:2.3 org.apache.yetus:audience-annotations:0.12.0 org.apache.zookeeper:zookeeper:3.8.0 @@ -192,17 +195,17 @@ org.junit.jupiter:junit-jupiter-engine:5.8.1 org.junit.platform:junit-platform-commons:1.8.1 org.junit.platform:junit-platform-engine:1.8.1 org.junit.platform:junit-platform-launcher:1.8.1 -org.jvnet.mimepull:mimepull:1.9.6 +org.jvnet.mimepull:mimepull:1.10.0 org.kohsuke:libpam4j:1.11 org.lz4:lz4-java:1.8.0 org.opentest4j:opentest4j:1.3.0 org.osgi:org.osgi.compendium:4.1.0 org.osgi:org.osgi.core:4.1.0 -org.ow2.asm:asm:9.3 -org.ow2.asm:asm-analysis:9.3 -org.ow2.asm:asm-commons:9.3 -org.ow2.asm:asm-tree:9.3 -org.ow2.asm:asm-util:9.3 +org.ow2.asm:asm:9.5 +org.ow2.asm:asm-analysis:9.5 +org.ow2.asm:asm-commons:9.5 +org.ow2.asm:asm-tree:9.5 +org.ow2.asm:asm-util:9.5 org.questdb:questdb:6.2 org.slf4j:jcl-over-slf4j:1.7.32 org.slf4j:log4j-over-slf4j:1.7.32 @@ -220,15 +223,16 @@ xml-apis:xml-apis:1.4.01 com.github.tomakehurst:wiremock-jre8-standalone:2.35.0 com.google.guava:guava-testlib:32.1.1-jre com.google.inject:guice:4.2.3 -com.google.jimfs:jimfs:1.2 -net.bytebuddy:byte-buddy:1.11.19 -net.bytebuddy:byte-buddy-agent:1.11.19 +com.google.jimfs:jimfs:1.3.0 +net.bytebuddy:byte-buddy:1.12.21 +net.bytebuddy:byte-buddy:1.14.6 +net.bytebuddy:byte-buddy-agent:1.14.6 org.apache.curator:curator-test:5.4.0 -org.assertj:assertj-core:3.11.1 -org.checkerframework:checker-qual:3.30.0 +org.assertj:assertj-core:3.24.2 +org.checkerframework:checker-qual:3.37.0 org.junit.jupiter:junit-jupiter:5.8.1 org.junit.jupiter:junit-jupiter-params:5.8.1 org.junit.vintage:junit-vintage-engine:5.8.1 -org.mockito:mockito-core:4.0.0 -org.mockito:mockito-junit-jupiter:4.0.0 -org.objenesis:objenesis:3.2 +org.mockito:mockito-core:5.5.0 +org.mockito:mockito-junit-jupiter:5.5.0 +org.objenesis:objenesis:3.3 |