aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/test/resources
diff options
context:
space:
mode:
authorfreva <valerijf@yahoo-inc.com>2016-12-21 12:41:07 +0100
committerfreva <valerijf@yahoo-inc.com>2016-12-21 12:41:07 +0100
commit5c173c381845f84e21d0f0550945e0be680b0dd6 (patch)
tree62ea9366b6d26216289295ab5fbc644ea11ab3a1 /node-admin/src/test/resources
parent7f80e9910e1df82caa770c3284ab8dba62818ea3 (diff)
Moved basic-search-for-docker to node-admin test/resources
Diffstat (limited to 'node-admin/src/test/resources')
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/music-data-1.json9
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/music-data-2.json9
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/pom.xml85
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/main/application/deployment.xml5
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/main/application/searchdefinitions/music.sd40
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/main/application/services.xml81
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/main/java/com/yahoo/example/ExampleDocumentProcessor.java120
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/main/java/com/yahoo/example/ExampleSearcher.java30
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/main/resources/configdefinitions/message.def3
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/test/application/services.xml20
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchConditionalStagingTest.java16
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchStagingTest.java27
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchSystemTest.java50
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/test/java/com/yahoo/example/ExampleSearcherTest.java38
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/test/java/com/yahoo/example/ExampleSystemTest.java39
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/test/resources/minifeed.json12
-rw-r--r--node-admin/src/test/resources/basic-search-for-docker/src/test/resources/sd-change-requiring-restart.patch13
17 files changed, 597 insertions, 0 deletions
diff --git a/node-admin/src/test/resources/basic-search-for-docker/music-data-1.json b/node-admin/src/test/resources/basic-search-for-docker/music-data-1.json
new file mode 100644
index 00000000000..44ce547370e
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/music-data-1.json
@@ -0,0 +1,9 @@
+{
+ "fields": {
+ "album": "Bad",
+ "artist": "Michael Jackson",
+ "title": "Bad",
+ "year": 1987,
+ "duration": 247
+ }
+}
diff --git a/node-admin/src/test/resources/basic-search-for-docker/music-data-2.json b/node-admin/src/test/resources/basic-search-for-docker/music-data-2.json
new file mode 100644
index 00000000000..c8e2d3c017c
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/music-data-2.json
@@ -0,0 +1,9 @@
+{
+ "fields": {
+ "album": "Recovery",
+ "artist": "Eminem",
+ "title": "So Bad",
+ "year": 2010
+ }
+}
+
diff --git a/node-admin/src/test/resources/basic-search-for-docker/pom.xml b/node-admin/src/test/resources/basic-search-for-docker/pom.xml
new file mode 100644
index 00000000000..749640b5a34
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/pom.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.yahoo.example</groupId>
+ <artifactId>basic-application</artifactId>
+ <packaging>container-plugin</packaging>
+ <version>1.0.1</version>
+ <name>application</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <test.hide>true</test.hide>
+ <application>docker</application>
+ <instance>default</instance>
+ </properties>
+
+ <parent>
+ <groupId>com.yahoo.vespa.tenant</groupId>
+ <artifactId>base</artifactId>
+ <version>RELEASE</version>
+ </parent>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>ymaven</id>
+ <url>http://ymaven.corp.yahoo.com:9999/proximity/repository/public</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>maven2-repository.dev.java.net</id>
+ <url>http://download.java.net/maven/2</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>vespa-maven-release</id>
+ <name>vespa-maven-release</name>
+ <url>http://edge.artifactory.yahoo.com:8000/artifactory/vespa-maven-libs-release-local</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ <repositories>
+ <repository>
+ <id>ymaven</id>
+ <url>http://ymaven.corp.yahoo.com:9999/proximity/repository/public</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>vespa-maven-release</id>
+ <name>vespa-maven-release</name>
+ <url>http://edge.artifactory.yahoo.com:8000/artifactory/vespa-maven-libs-release-local</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgs>
+ <arg>-Xlint:all</arg>
+ <arg>-Werror</arg>
+ </compilerArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/main/application/deployment.xml b/node-admin/src/test/resources/basic-search-for-docker/src/main/application/deployment.xml
new file mode 100644
index 00000000000..0a2397bbca9
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/main/application/deployment.xml
@@ -0,0 +1,5 @@
+<deployment version='1.0'>
+ <test />
+ <staging />
+ <prod/>
+</deployment>
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/main/application/searchdefinitions/music.sd b/node-admin/src/test/resources/basic-search-for-docker/src/main/application/searchdefinitions/music.sd
new file mode 100644
index 00000000000..d6bcaac8ae0
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/main/application/searchdefinitions/music.sd
@@ -0,0 +1,40 @@
+search music {
+ document music {
+ field artist type string {
+ indexing: summary | index
+ }
+ field artistId type string {
+ indexing: summary | attribute
+ }
+
+ field title type string {
+ indexing: summary | index
+ }
+
+ field album type string {
+ indexing: index
+ }
+
+ field duration type int {
+ indexing: summary
+ }
+
+ field year type int {
+ indexing: summary | attribute
+ }
+
+ field popularity type int {
+ indexing: summary | attribute
+ }
+ }
+
+ fieldset default {
+ fields: artist, title, album
+ }
+
+ rank-profile song inherits default {
+ first-phase {
+ expression:nativeRank(artist,title,album) + if(isNan(attribute(popularity)) == 1, 0,attribute(popularity))
+ }
+ }
+}
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/main/application/services.xml b/node-admin/src/test/resources/basic-search-for-docker/src/main/application/services.xml
new file mode 100644
index 00000000000..cea6861ca91
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/main/application/services.xml
@@ -0,0 +1,81 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<services version='1.0' xmlns:deploy="vespa" xmlns:preprocess="properties">
+
+ <jdisc id='default' version='1.0'>
+ <!-- See Vespa tutorial
+ <document-processing>
+ <chain id="default">
+ <documentprocessor id="com.yahoo.example.ExampleDocumentProcessor" bundle="basic-application"/>
+ </chain>
+ </document-processing>
+ -->
+
+ <!-- YCA Access Control
+
+ Enable this to limit access to your application using YCA; we will support http://yo/athens later.
+ deploy:environment="prod" is needed if you want to enable easier access to other environments. You will not
+ be able to use YCA access control from an openhouse instance to the hosted Vespa Dev instance.
+
+ The nonyca-request-chain is needed to allow e.g. health checks to bypass YCA
+
+ In <yca.appid.allow> list the igor roles that includes the hosts that should be allowed to access this application
+
+ See http://vespa.corp.yahoo.com/5/documentation/vespa-security.html
+
+ To test this you can use curl, and add the Yahoo-App-Auth header:
+ -H "Yahoo-App-Auth: `yca-cert-util -show yahoo.namespace.role|cut -d" " -f2`"
+
+ -->
+ <!--
+ <http deploy:environment="prod">
+ <filtering>
+ <request-chain id="yca-request-chain" excludes="com.yahoo.jdisc.http.filter.security.InputValidationFilter" inherits="standard-request-filters">
+ <filter bundle="jdisc_http_filters" class="com.yahoo.jdisc.http.filter.security.YCAFilter" id="access-filter">
+ <filter-config>
+ <yca.appid.allow>yahoo.namespace.role</yca.appid.allow>
+ <yca.allowAny>false</yca.allowAny>
+ <yca.optional>false</yca.optional>
+ </filter-config>
+ </filter>
+ <binding>http://*/*</binding>
+ <binding>https://*/*</binding>
+ </request-chain>
+ <request-chain excludes="access-filter" id="nonyca-request-chain" inherits="yca-request-chain">
+ <binding>http://*/state/*</binding>
+ <binding>http://*/status.html</binding>
+ <binding>http://*/ApplicationStatus</binding>
+ <binding>https://*/state/*</binding>
+ <binding>https://*/status.html</binding>
+ <binding>https://*/ApplicationStatus</binding>
+ </request-chain>
+ </filtering>
+ <server id="main-server" port="4080" />
+ </http>
+ -->
+
+ <search>
+ <chain id='default' inherits='vespa'>
+ <searcher bundle='basic-application' id='com.yahoo.example.ExampleSearcher'>
+ <config name='example.message'>
+ <message>Hello, Vespa! (test build iteration 90)</message>
+ </config>
+ </searcher>
+ </chain>
+ </search>
+ <document-api/>
+ <nodes count='1' flavor='docker' docker-image='vespa-local:latest'/>
+ </jdisc>
+
+ <content id='music' version='1.0'>
+ <redundancy>2</redundancy>
+ <documents>
+ <document mode='index' type='music'/>
+ </documents>
+ <nodes count='1' flavor='docker' docker-image='vespa-local:latest'/>
+ <engine>
+ <proton>
+ <searchable-copies>1</searchable-copies>
+ </proton>
+ </engine>
+ </content>
+</services>
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/main/java/com/yahoo/example/ExampleDocumentProcessor.java b/node-admin/src/test/resources/basic-search-for-docker/src/main/java/com/yahoo/example/ExampleDocumentProcessor.java
new file mode 100644
index 00000000000..907ab355288
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/main/java/com/yahoo/example/ExampleDocumentProcessor.java
@@ -0,0 +1,120 @@
+package com.yahoo.example;
+
+import com.yahoo.docproc.DocumentProcessor;
+import com.yahoo.docproc.Processing;
+import com.yahoo.document.Document;
+import com.yahoo.document.DocumentOperation;
+import com.yahoo.document.DocumentPut;
+import com.yahoo.document.DocumentRemove;
+import com.yahoo.document.DocumentUpdate;
+
+import java.net.*;
+import java.io.*;
+
+import com.yahoo.document.datatypes.StringFieldValue;
+import org.json.*;
+import java.util.logging.Logger;
+
+/**
+ * A document processor
+ *
+ * @author Joe Developer
+ */
+
+
+public class ExampleDocumentProcessor extends DocumentProcessor {
+
+ private static final String artistField = "artist";
+ private static final String artistIdField = "artistId";
+ private static final String spotifyUrl = "https://api.spotify.com/v1/search?type=artist&limit=1&q=";
+ private static final Logger log = Logger.getLogger(ExampleDocumentProcessor.class.getName());
+
+ public Progress process(Processing processing) {
+ for (DocumentOperation op : processing.getDocumentOperations()) {
+ if (op instanceof DocumentPut) {
+ Document document = ((DocumentPut) op).getDocument();
+ addArtistId(document);
+ } else if (op instanceof DocumentUpdate) {
+ DocumentUpdate update = (DocumentUpdate) op;
+ //TODO do something to 'update' here
+ } else if (op instanceof DocumentRemove) {
+ DocumentRemove remove = (DocumentRemove) op;
+ //TODO do something to 'remove' here
+ }
+ }
+ return Progress.DONE;
+ }
+
+ /**
+ * Query Spotify API, parse JSON and set Artist ID
+ *
+ * @param document a Vespa Document
+ */
+ public void addArtistId(Document document) {
+ StringFieldValue artistString = (StringFieldValue) document.getFieldValue(artistField);
+ HttpURLConnection conn = null;
+ try {
+ String url = spotifyUrl + java.net.URLEncoder.encode(artistString.getString(), "UTF-8");
+ conn = getConnection(url);
+ String artistId = parseSpotifyResponse(new InputStreamReader(conn.getInputStream(), "UTF-8"));
+ if (artistId == null) {
+ return;
+ }
+ document.setFieldValue(artistIdField, new StringFieldValue(artistId));
+
+ } catch (Exception e) {
+ log.warning("Error: " );
+ } finally {
+ if (conn != null) {
+ conn.disconnect();
+ }
+ }
+ }
+
+ /**
+ * @param streamReader the response to read from
+ * @return artist id from spotify or null if not found
+ * @throws IOException
+ */
+
+ private String parseSpotifyResponse(InputStreamReader streamReader) throws IOException {
+ // Read JSON data from API
+ BufferedReader reader = new BufferedReader(streamReader);
+ StringBuilder builder = new StringBuilder();
+ for (String line; (line = reader.readLine()) != null; ) {
+ builder.append(line).append("\n");
+ }
+
+ // Parse the JSON to find the first artist item returned or null if not found
+ try {
+ JSONObject json = new JSONObject(builder.toString());
+ JSONObject artists = json.getJSONObject("artists");
+ JSONArray items = artists.getJSONArray("items");
+ JSONObject artist = items.getJSONObject(0);
+ return artist.getString("id");
+ } catch (JSONException e) {
+ return null;
+ }
+
+ }
+
+ /**
+ * Establishes an HTTP Connection
+ *
+ * @param inputUrl a String giving the URL to connect to
+ * @return an HttpURLConnection
+ * @throws java.io.IOException when connection to inputUrl failed
+ */
+ private HttpURLConnection getConnection(String inputUrl) throws IOException {
+ URL url = new URL(inputUrl);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+
+ conn.setRequestProperty("User-Agent", "Vespa Tutorial DocProc");
+ conn.setReadTimeout(10000);
+ conn.setConnectTimeout(5000);
+ conn.connect();
+
+ return conn;
+ }
+}
+
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/main/java/com/yahoo/example/ExampleSearcher.java b/node-admin/src/test/resources/basic-search-for-docker/src/main/java/com/yahoo/example/ExampleSearcher.java
new file mode 100644
index 00000000000..cf4c1fc8e34
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/main/java/com/yahoo/example/ExampleSearcher.java
@@ -0,0 +1,30 @@
+package com.yahoo.example;
+
+import com.yahoo.search.Query;
+import com.yahoo.search.Result;
+import com.yahoo.search.Searcher;
+import com.yahoo.search.result.Hit;
+import com.yahoo.search.searchchain.Execution;
+
+/**
+ * A searcher adding a new hit.
+ *
+ * @author Joe Developer
+ */
+public class ExampleSearcher extends Searcher {
+ public static final String hitId = "ExampleHit";
+ private final String message;
+
+ public ExampleSearcher(MessageConfig config) {
+ message = config.message();
+ }
+
+ public Result search(Query query, Execution execution) {
+ Hit hit = new Hit(hitId);
+ hit.setField("message", message);
+
+ Result result = execution.search(query);
+ result.hits().add(hit);
+ return result;
+ }
+}
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/main/resources/configdefinitions/message.def b/node-admin/src/test/resources/basic-search-for-docker/src/main/resources/configdefinitions/message.def
new file mode 100644
index 00000000000..d2a2bc5407a
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/main/resources/configdefinitions/message.def
@@ -0,0 +1,3 @@
+version=1
+namespace=example
+message string default="Hello, World!" \ No newline at end of file
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/test/application/services.xml b/node-admin/src/test/resources/basic-search-for-docker/src/test/application/services.xml
new file mode 100644
index 00000000000..388ab448f9c
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/test/application/services.xml
@@ -0,0 +1,20 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<services version='1.0'>
+ <admin version='3.0'>
+ <nodes count="1" />
+ </admin>
+
+ <!-- duplication of src/main/application due to Ticket 6904654 -->
+ <jdisc version='1.0' id='default'>
+ <search>
+ <chain id="default" inherits="vespa">
+ <searcher id="com.yahoo.example.ExampleSearcher" bundle="basic-application">
+ <config name="example.message">
+ <message>Hello, Vespa!</message>
+ </config>
+ </searcher>
+ </chain>
+ </search>
+ <nodes count="1" />
+ </jdisc>
+</services>
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchConditionalStagingTest.java b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchConditionalStagingTest.java
new file mode 100644
index 00000000000..4a6c48073c1
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchConditionalStagingTest.java
@@ -0,0 +1,16 @@
+import com.yahoo.vespa.tenant.systemtest.base.StagingAutoTestConfigBuilder;
+import com.yahoo.vespa.tenant.systemtest.base.StagingTest;
+import org.junit.Test;
+
+import java.io.IOException;
+
+/**
+ * This test is only run if there is a production instance to get queries and documents from, otherwise the tests
+ * are marked as ignored automatically.
+ */
+public class BasicSearchConditionalStagingTest extends StagingTest {
+ @Test
+ public void testProdQueriesAndDocuments() throws IOException {
+ testAutomatically(new StagingAutoTestConfigBuilder().withRoute("music-index").withDocumentType("music").build());
+ }
+}
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchStagingTest.java b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchStagingTest.java
new file mode 100644
index 00000000000..89bf52a9870
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchStagingTest.java
@@ -0,0 +1,27 @@
+import com.yahoo.vespa.tenant.systemtest.base.StagingTest;
+import com.yahoo.vespa.tenant.systemtest.blackbox.BlackBoxTester;
+import com.yahoo.vespa.tenant.systemtest.blackbox.Report;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class BasicSearchStagingTest extends StagingTest {
+ @Test
+ public void testSearchAndFeeding() throws Exception {
+
+ /**
+ * Generates 100 documents and test recall while feeding.
+ */
+ Report report = new BlackBoxTester.BlackBoxTesterBuilder().documentFormat(
+ " {\n" +
+ " \"put\": \"id:sampleapp:music::::$1\",\n" +
+ " \"fields\": {\n" +
+ " \"title\": \"$2\"\n" +
+ " }\n" +
+ " }")
+ .numberOfDocumentsToFeed(100).build(getStagingTestInstance().getDefaultVespaEndpoint().getUri())
+ .testFeedingAndRecall();
+ assertThat(report.allSuccess(), is(true));
+ }
+}
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchSystemTest.java b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchSystemTest.java
new file mode 100644
index 00000000000..e9e72ca4d8c
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/BasicSearchSystemTest.java
@@ -0,0 +1,50 @@
+import com.yahoo.vespa.tenant.systemtest.Endpoint;
+import com.yahoo.vespa.tenant.systemtest.VespaEndpoints;
+import com.yahoo.vespa.tenant.systemtest.base.SystemTest;
+import com.yahoo.vespa.tenant.systemtest.blackbox.BlackBoxTester;
+import com.yahoo.vespa.tenant.systemtest.blackbox.Report;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.net.URI;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Tests running in CI-pipeline. In a regular vespa system this will be triggered whenever a commit is made and
+ * run before code is pushed to production.
+ *
+ * @author dybdahl
+ */
+public class BasicSearchSystemTest extends SystemTest {
+ @Override
+ /**
+ * In order to develop and test the system tests, you can create a dev instance and push this
+ * (e.g. mvn deploy:vespa) to your personal vespa dev instance. You will need to change this
+ * function to point to this instance. This is only for testing and debugging the test.
+ */
+ protected VespaEndpoints createVespaSystemTestInstanceEndpointsWhenNotOnScrewdriver() {
+ return new VespaEndpoints.Builder().fromPom().inDevCluster()
+ .withRegion("corp-us-east-1").withTenant("ENTER TENANT USER FOR USED FOR LOCAL DEVELOPMENT HERE").build();
+ }
+
+
+ @Test
+ public void testSearchAndFeeding() throws Exception {
+
+ /**
+ * Generates 100 documents and test recall while feeding.
+ */
+ Report report = new BlackBoxTester.BlackBoxTesterBuilder().documentFormat(
+ " {\n" +
+ " \"put\": \"id:sampleapp:music::::$1\",\n" +
+ " \"fields\": {\n" +
+ " \"title\": \"$2\"\n" +
+ " }\n" +
+ " }")
+ .numberOfDocumentsToFeed(100).build(getSystemTestsInstance().getDefaultVespaEndpoint().getUri())
+ .testFeedingAndRecall();
+ assertThat(report.allSuccess(), is(true));
+ }
+}
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/test/java/com/yahoo/example/ExampleSearcherTest.java b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/com/yahoo/example/ExampleSearcherTest.java
new file mode 100644
index 00000000000..87592f2a2ba
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/com/yahoo/example/ExampleSearcherTest.java
@@ -0,0 +1,38 @@
+package com.yahoo.example;
+
+import com.yahoo.application.Application;
+import com.yahoo.application.Networking;
+import com.yahoo.application.container.Search;
+import com.yahoo.component.ComponentSpecification;
+import com.yahoo.search.Query;
+import com.yahoo.search.Result;
+import com.yahoo.search.result.Hit;
+import org.junit.Test;
+
+import java.nio.file.Paths;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author tonyv
+ */
+public class ExampleSearcherTest {
+ @Test
+ public void hit_is_added() throws Exception {
+ try (Application app = Application.fromApplicationPackage(
+ Paths.get("src/test/application"),
+ Networking.disable))
+ {
+ Search search = app.getJDisc("jdisc").search();
+ Result result = search.process(ComponentSpecification.fromString("default"), new Query("?query=ignored"));
+
+ Hit hit = result.hits().get(ExampleSearcher.hitId);
+ assertNotNull("Hit was not added by ExampleSearcher", hit);
+
+ Object messageFromConfig = "Hello, Vespa!";
+ assertThat(hit.getField("message"), is(messageFromConfig));
+ }
+ }
+}
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/test/java/com/yahoo/example/ExampleSystemTest.java b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/com/yahoo/example/ExampleSystemTest.java
new file mode 100644
index 00000000000..2bed440868e
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/test/java/com/yahoo/example/ExampleSystemTest.java
@@ -0,0 +1,39 @@
+package com.yahoo.example;
+
+import com.yahoo.vespa.tenant.systemtest.Feed;
+import com.yahoo.vespa.tenant.systemtest.FeedResult;
+import com.yahoo.vespa.tenant.systemtest.Query;
+import com.yahoo.vespa.tenant.systemtest.QueryResult;
+import com.yahoo.vespa.tenant.systemtest.VespaEndpoints;
+import com.yahoo.vespa.tenant.systemtest.base.MutableVespaEndpoint;
+import com.yahoo.vespa.tenant.systemtest.base.SystemTest;
+import com.yahoo.vespa.tenant.systemtest.hitchecker.HitChecker;
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+public class ExampleSystemTest extends SystemTest {
+ @Override
+ /**
+ * In order to develop and test the system tests, you can create a dev instance and push this
+ * (e.g. mvn deploy:vespa) to your personal vespa dev instance. You will need to change this
+ * function to point to this instance. This is only for testing and debugging the test.
+ */
+ protected VespaEndpoints createVespaSystemTestInstanceEndpointsWhenNotOnScrewdriver() {
+ return new VespaEndpoints.Builder().fromPom().inDevCluster()
+ .withRegion("corp-us-east-1").withTenant("ENTER TENANT USER FOR USED FOR LOCAL DEVELOPMENT HERE").build();
+ }
+ @Test
+ public void testWithOneDocument() throws Exception {
+ MutableVespaEndpoint endpoint = getSystemTestsInstance().getDefaultVespaEndpoint();
+ FeedResult feedResult = endpoint.feed(Feed.createFromResource("/minifeed.json"));
+ assertThat(feedResult.numOk(), is(1l));
+ QueryResult result = endpoint.search(new Query("bad"));
+ assertThat(result.totalHitCount(), is(1l));
+ result.expectHit(1, new HitChecker()
+ .fieldRegex("title", ".*Bad")
+ .relevance(0.254, 0.2)
+ .fieldNull("nosuchfield"));
+ }
+}
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/test/resources/minifeed.json b/node-admin/src/test/resources/basic-search-for-docker/src/test/resources/minifeed.json
new file mode 100644
index 00000000000..2fd5d9e2053
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/test/resources/minifeed.json
@@ -0,0 +1,12 @@
+[
+ {
+ "fields": {
+ "album": "Bad",
+ "artist": "Michael Jackson",
+ "title": "Bad",
+ "year": 1987
+ },
+ "put": "id:tutorial:music::1"
+ }
+]
+
diff --git a/node-admin/src/test/resources/basic-search-for-docker/src/test/resources/sd-change-requiring-restart.patch b/node-admin/src/test/resources/basic-search-for-docker/src/test/resources/sd-change-requiring-restart.patch
new file mode 100644
index 00000000000..b4e0745fcc2
--- /dev/null
+++ b/node-admin/src/test/resources/basic-search-for-docker/src/test/resources/sd-change-requiring-restart.patch
@@ -0,0 +1,13 @@
+diff --git a/src/main/application/searchdefinitions/music.sd b/src/main/application/searchdefinitions/music.sd
+index d6bcaac..158c217 100644
+--- a/src/main/application/searchdefinitions/music.sd
++++ b/src/main/application/searchdefinitions/music.sd
+@@ -16,7 +16,7 @@ search music {
+ }
+
+ field duration type int {
+- indexing: summary
++ indexing: summary | attribute
+ }
+
+ field year type int {