diff options
Diffstat (limited to 'config-model/src/test/java/com/yahoo')
8 files changed, 60 insertions, 26 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java b/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java index 798252c9a34..c959634019d 100644 --- a/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java @@ -143,10 +143,10 @@ public class SchemaTestCase { " file: models/my_model.onnx" + " }" + " document-summary parent_summary1 {" + - " summary pf1 type string {}" + + " summary pf1 {}" + " }" + " document-summary parent_summary2 {" + - " summary pf2 type string {}" + + " summary pf2 {}" + " }" + " import field parentschema_ref.name as parent_imported {}" + " raw-as-base64-in-summary" + @@ -177,7 +177,7 @@ public class SchemaTestCase { " file: models/my_model.onnx" + " }" + " document-summary child1_summary inherits parent_summary1 {" + - " summary c1f1 type string {}" + + " summary c1f1 {}" + " }" + " import field parentschema_ref.name as child1_imported {}" + "}"); @@ -208,7 +208,7 @@ public class SchemaTestCase { " file: models/my_model.onnx" + " }" + " document-summary child2_summary inherits parent_summary1, parent_summary2 {" + - " summary c2f1 type string {}" + + " summary c2f1 {}" + " }" + " import field parentschema_ref.name as child2_imported {}" + "}"); @@ -340,7 +340,7 @@ public class SchemaTestCase { " file: models/my_model.onnx" + " }" + " document-summary parent_summary {" + - " summary pf1 type string {}" + + " summary pf1 {}" + " }" + " import field parentschema_ref.name as parent_imported {}" + " raw-as-base64-in-summary" + diff --git a/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java index c9fa3ce145a..3c83e79157a 100644 --- a/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java @@ -48,8 +48,8 @@ public class SummaryTestCase { String sd = joinLines( "schema disksummary {", " document-summary foobar {", - " summary foo1 type string { source: inmemory }", - " summary foo2 type string { source: ondisk }", + " summary foo1 { source: inmemory }", + " summary foo2 { source: ondisk }", " }", " document disksummary {", " field inmemory type string {", @@ -84,8 +84,8 @@ public class SummaryTestCase { " }", " }", " document-summary foobar {", - " summary foo1 type string { source: inmemory }", - " summary foo2 type string { source: ondisk }", + " summary foo1 { source: inmemory }", + " summary foo2 { source: ondisk }", " from-disk", " }", "}"); @@ -114,7 +114,7 @@ public class SummaryTestCase { " }", " }", " document-summary filtered {", - " summary elem_array_filtered type array<elem> {", + " summary elem_array_filtered {", " source: elem_array", " matched-elements-only", " }", @@ -141,17 +141,17 @@ public class SummaryTestCase { " }", " }", " document-summary title {", - " summary title type string {", + " summary title {", " source: title", " }", " }", " document-summary title_artist inherits title {", - " summary artist type string {", + " summary artist {", " source: artist", " }", " }", " document-summary everything inherits title_artist {", - " summary album type string {", + " summary album {", " source: album", " }", " }", @@ -201,12 +201,12 @@ public class SummaryTestCase { " }", " }", " document-summary title {", - " summary title type string {", + " summary title {", " source: title", " }", " }", " document-summary title2 inherits title {", - " summary title type string {", + " summary title {", " source: title_short", " }", " }", @@ -297,12 +297,12 @@ public class SummaryTestCase { } } document-summary parent1 { - summary s1 type string { + summary s1 { source: field1 } } document-summary parent2 { - summary field1 type string { + summary field1 { source: field1 } } @@ -326,7 +326,7 @@ public class SummaryTestCase { " }" + " }" + " document-summary parent_summary {" + - " summary pf1 type string {}" + + " summary pf1 {}" + " }" + "}"); String child = joinLines( @@ -337,7 +337,7 @@ public class SummaryTestCase { " }" + " }" + " document-summary child_summary inherits parent_summary {" + - " summary cf1 type string {}" + + " summary cf1 {}" + " }" + "}"); DeployLoggerStub logger = new DeployLoggerStub(); diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java index a1d726473be..2fb7955546c 100644 --- a/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java @@ -131,7 +131,7 @@ public class SummaryTestCase extends AbstractSchemaTestCase { " }", " }", " document-summary my_summary {", - " summary other_campaign_ref type reference<campaign> {}", + " summary other_campaign_ref {}", " }", "}")); builder.build(true); @@ -146,11 +146,11 @@ public class SummaryTestCase extends AbstractSchemaTestCase { " field foo type string { indexing: summary }", " }", " document-summary bar {", - " summary foo type string {}", + " summary foo {}", " omit-summary-features", " }", " document-summary baz {", - " summary foo type string {}", + " summary foo {}", " }", "}"); var search = ApplicationBuilder.createFromString(sd).getSchema(); diff --git a/config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java index e8f8ba4193f..91cd2418eef 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/MatchedElementsOnlyResolverTestCase.java @@ -72,7 +72,7 @@ public class MatchedElementsOnlyResolverTestCase { @Test void explicit_complex_summary_field_can_use_filter_transform_with_reference_to_source_field() throws ParseException { String documentSummary = joinLines("document-summary my_summary {", - " summary my_filter_field type map<string, string> {", + " summary my_filter_field {", " source: my_field", " matched-elements-only", " }", @@ -123,7 +123,7 @@ public class MatchedElementsOnlyResolverTestCase { @Test void explicit_summary_field_can_use_filter_transform_with_reference_to_attribute_source_field() throws ParseException { String documentSummary = joinLines("document-summary my_summary {", - " summary my_filter_field type array<string> {", + " summary my_filter_field {", " source: my_field", " matched-elements-only", " }", diff --git a/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java index d2938371c5b..9eca2106c5e 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java @@ -32,7 +32,7 @@ public class SummaryConsistencyTestCase { " }", " }", " document-summary unfiltered {", - " summary elem_array_unfiltered type array<elem> {", + " summary elem_array_unfiltered {", " source: elem_array", " }", " }", diff --git a/config-model/src/test/java/com/yahoo/schema/processing/SummaryDiskAccessValidatorTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/SummaryDiskAccessValidatorTestCase.java index ab376e539ec..a5145588136 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/SummaryDiskAccessValidatorTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/SummaryDiskAccessValidatorTestCase.java @@ -25,7 +25,7 @@ public class SummaryDiskAccessValidatorTestCase { " }", " }", " document-summary my_sum {", - " summary str_map type map<string, string> { source: str_map }", + " summary str_map { source: str_map }", " }", "}"); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/CloudDataPlaneFilterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/CloudDataPlaneFilterTest.java index 937052df122..49ed1972afe 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/CloudDataPlaneFilterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/CloudDataPlaneFilterTest.java @@ -1,6 +1,8 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.container.xml; +import com.yahoo.config.model.api.ApplicationClusterEndpoint; +import com.yahoo.config.model.api.ContainerEndpoint; import com.yahoo.config.model.api.EndpointCertificateSecrets; import com.yahoo.config.model.builder.xml.test.DomBuilderTest; import com.yahoo.config.model.deploy.DeployState; @@ -38,6 +40,7 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.List; import java.util.Optional; +import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -91,6 +94,7 @@ public class CloudDataPlaneFilterTest extends ContainerModelBuilderTestBase { var caCerts = X509CertificateUtils.certificateListFromPem(connectorConfig.ssl().caCertificate()); assertEquals(1, caCerts.size()); assertEquals(List.of(certificate), caCerts); + assertEquals(List.of("foo.bar"), connectorConfig.serverName().known()); var srvCfg = root.getConfig(ServerConfig.class, "container/http"); assertEquals("cloud-data-plane-insecure", srvCfg.defaultFilters().get(0).filterId()); assertEquals(8080, srvCfg.defaultFilters().get(0).localPort()); @@ -191,6 +195,7 @@ public class CloudDataPlaneFilterTest extends ContainerModelBuilderTestBase { .setEndpointCertificateSecrets(Optional.of(new EndpointCertificateSecrets("CERT", "KEY"))) .setHostedVespa(true)) .zone(new Zone(SystemName.PublicCd, Environment.dev, RegionName.defaultName())) + .endpoints(Set.of(new ContainerEndpoint("foo", ApplicationClusterEndpoint.Scope.zone, List.of("foo.bar")))) .build(); return createModel(root, state, null, clusterElem); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/CloudTokenDataPlaneFilterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/CloudTokenDataPlaneFilterTest.java index 1642e0ff8f2..c89ea421b39 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/CloudTokenDataPlaneFilterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/CloudTokenDataPlaneFilterTest.java @@ -14,9 +14,12 @@ import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.Zone; +import com.yahoo.jdisc.http.ConnectorConfig; import com.yahoo.jdisc.http.filter.security.cloud.config.CloudTokenDataPlaneFilterConfig; import com.yahoo.processing.response.Data; +import com.yahoo.vespa.model.container.ApplicationContainer; import com.yahoo.vespa.model.container.ContainerModel; +import com.yahoo.vespa.model.container.http.ConnectorFactory; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -127,6 +130,21 @@ public class CloudTokenDataPlaneFilterTest extends ContainerModelBuilderTestBase assertFalse(root.getConfigIds().stream().anyMatch(id -> id.contains("DataplaneProxyConfigurator"))); } + @Test + void configuresCorrectConnectors() throws IOException { + var certFile = securityFolder.resolve("foo.pem"); + var clusterElem = DomBuilderTest.parse(servicesXmlTemplate.formatted(applicationFolder.toPath().relativize(certFile).toString())); + createCertificate(certFile); + buildModel(Set.of(tokenEndpoint, mtlsEndpoint), defaultTokens, clusterElem); + + ConnectorConfig connectorConfig8443 = connectorConfig(8443); + assertEquals(List.of("mtls"),connectorConfig8443.serverName().known()); + + ConnectorConfig connectorConfig8444 = connectorConfig(8444); + assertEquals(List.of("token"),connectorConfig8444.serverName().known()); + + } + private static CloudTokenDataPlaneFilterConfig.Clients.Tokens tokenConfig( String id, Collection<String> fingerprints, Collection<String> accessCheckHashes, Collection<String> expirations) { return new CloudTokenDataPlaneFilterConfig.Clients.Tokens.Builder() @@ -150,4 +168,15 @@ public class CloudTokenDataPlaneFilterTest extends ContainerModelBuilderTestBase .build(); return createModel(root, state, null, clusterElem); } + + private ConnectorConfig connectorConfig(int port) { + ApplicationContainer container = (ApplicationContainer) root.getProducer("container/container.0"); + List<ConnectorFactory> connectorFactories = container.getHttp().getHttpServer().get().getConnectorFactories(); + ConnectorFactory tlsPort = connectorFactories.stream().filter(connectorFactory -> connectorFactory.getListenPort() == port).findFirst().orElseThrow(); + + ConnectorConfig.Builder builder = new ConnectorConfig.Builder(); + tlsPort.getConfig(builder); + + return new ConnectorConfig(builder); + } } |