Commit Graph

15329 Commits

Author SHA1 Message Date
Ryan Ernst 425e4c3492 Tests: Remove stress tests
These are not actually tests, but command line applications that must be
run manually. This change removes the entire stresstest package. We can
add back individual tests that we find necessary, and make them real
tests (whether integ or not).
2015-09-02 13:07:15 -07:00
Ryan Ernst fabadc6a67 Fix naming for plugins abstract test cases
See #13282
2015-09-02 12:33:53 -07:00
Ivannikov Kirill 92a6968f2a Catch exception in callback of exception 2015-09-02 23:56:37 +05:00
David Pilato 4d05832a0b [qa] Add smoke test client module
As we log a lot, we hit a default limit:

```
The test or suite printed 9450 bytes to stdout and stderr, even though the limit was set to 8192 bytes. Increase the limit with @Limit, ignore it completely with @SuppressSysoutChecks or run with -Dtests.verbose=true
```

(cherry picked from commit 0cb325d)
2015-09-02 20:40:07 +02:00
Ryan Ernst e3304a19af Merge pull request #13282 from rjernst/no_test_exclusions
Remove test class exclusion for Abstract prefix and rename classes accordingly
2015-09-02 11:13:30 -07:00
Ryan Ernst 205675ad19 Addressed PR comments 2015-09-02 11:13:05 -07:00
Ryan Ernst 51db6cc358 Tests: Remove test class exclusion for Abstract prefix and rename classes accordingly
While the list of having exclusions is small, it shouldn't be necessary
at all. Base test cases should be suffixed with TestCase so they are not
picked up by the test class name pattern. This same rule works for
abstract classes as well.

This change renames abstract tests to use the TestCase suffix, adds a
check in naming convention tests, and removes the exclusion from our
test runner configuration. It also excludes inner classes (the only
exclude we should have IMO), so that we have no need to @Ignore the
inner test classes for naming convention tests.
2015-09-02 11:00:17 -07:00
Britta Weber 3d5128db07 Merge pull request #13268 from brwe/test-start-end
[test] print test start and end of test setup and cleanup
2015-09-02 19:44:40 +02:00
David Pilato 1ffc6cd6a7 [qa] Add smoke test client module
Fix previous commit. A `pom` project does not run any test...
And the cluster name is set externally so we can't assert that it's `elasticsearch`.
2015-09-02 19:28:04 +02:00
Britta Weber d47857b66f [test] don't call optimize while shard is relocating
In this test we assume that after waitForRelocation() has returned shards
are no more relocated and optimize will therefore succeed always.
However, because the test does not wait for green status, relocations can
still start after waitForRelocation() has returned successfully.

see #13266 for a detailed explanation
2015-09-02 19:15:46 +02:00
David Pilato 1a8a2c9bc2 [qa] Add smoke test client module
This commit adds a new smoke test for testing client as a end Java user.

It starts a cluster in `pre-integration-test` phase, then execute the client operations defined as JUnit tests within `integration-test` phase and then stop the external cluster in `post-integration-test` phase.

You can also run test classes from your IDE.

* Start an external node on your machine with `bin/elasticsearch` (note that you can test Java API regressions if you run an older or newer node version)
* Run the JUnit test. By default, it will run tests on `localhost:9300` but you can change this setting using system property `tests.cluster`. It also expects the default `cluster.name` (`elasticsearch`).

This commit also starts adding [snippets as defined by Maven](https://maven.apache.org/guides/mini/guide-snippet-macro.html) to help keeping automatically synchronized the Java reference guide with the current code.

Our documentation builder tool does not support snippets though but we will most likely support it at some point.
2015-09-02 17:34:54 +02:00
Lee Hinman 118eab5462 Merge pull request #13257 from elastic/docsfix
Fixed non-valid JSON (though ES would accept it)
2015-09-02 07:51:13 -06:00
Ivannikov Kirill 0d2675e80b fix typo 2015-09-02 18:22:15 +05:00
Ivannikov Kirill cddf198c83 postCreateUnderLock try catch listeners 2015-09-02 18:21:17 +05:00
Ivannikov Kirill 39fad8c374 try catch in post listeners 2015-09-02 18:18:49 +05:00
Ivannikov Kirill 30b6a29e0b remove try in posIndex 2015-09-02 18:04:26 +05:00
Ivannikov Kirill 32b304b43c fix skipped variable setting 2015-09-02 18:02:26 +05:00
Ivannikov Kirill a097375a6f strict listeners 2015-09-02 17:59:41 +05:00
Colin Goodheart-Smithe 821021f0e4 Scripting: Propagate Headers and Context through to ScriptService
At the moment if an index script is used in a request, the spawned request to get the indexed script from the `.scripts` index does not get the headers and context copied to it from the original request. This change makes the calls to the `ScriptService` pass in a `HasContextAndHeaders` object that can provide the headers and context. For the `search()` method the context and headers are retrieved from `SearchContext.current()`.

Closes #12891
2015-09-02 13:49:20 +01:00
Ivannikov Kirill fd8476dbd7 make more strict 2015-09-02 17:48:37 +05:00
Nik Everett 467a459f95 Merge pull request #13083 from nik9000/bats_less_skip
Clean up more bats tests
2015-09-02 08:45:15 -04:00
Ivannikov Kirill d33f7dba61 assertNotNull 2015-09-02 16:59:49 +05:00
Colin Goodheart-Smithe 1d9905a798 [DOCS] Added note about valid return types for scripts in the scripted_metric aggregation 2015-09-02 12:13:15 +01:00
Ivannikov Kirill d6bae589c8 Fail if ex null 2015-09-02 15:09:18 +05:00
Britta Weber f11bec071b [test] print test start and end of test setup, execution and cleanup 2015-09-02 11:57:33 +02:00
David Pilato 34ee4c2d66 [build] remove shaded elasticsearch version
The shaded version of elasticsearch was built at the very beginning to avoid dependency conflicts in a specific case where:

* People use elasticsearch from Java
* People needs to embed elasticsearch jar within their own application (as it's today the only way to get a `TransportClient`)
* People also embed in their application another (most of the time older) version of dependency we are using for elasticsearch, such as: Guava, Joda, Jackson...

This conflict issue can be solved within the projects themselves by either upgrade the dependency version and use the one provided by elasticsearch or by shading elasticsearch project and relocating some conflicting packages.

Example
-------

As an example, let's say you want to use within your project `Joda 2.1` but elasticsearch `2.0.0-beta1` provides `Joda 2.8`.
Let's say you also want to run all that with shield plugin.

Create a new maven project or module with:

```xml
<groupId>fr.pilato.elasticsearch.test</groupId>
<artifactId>es-shaded</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <elasticsearch.version>2.0.0-beta1</elasticsearch.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.elasticsearch</groupId>
        <artifactId>elasticsearch</artifactId>
        <version>${elasticsearch.version}</version>
    </dependency>
    <dependency>
        <groupId>org.elasticsearch.plugin</groupId>
        <artifactId>shield</artifactId>
        <version>${elasticsearch.version}</version>
    </dependency>
</dependencies>
```

And now shade and relocate all packages which conflicts with your own application:

```xml
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.1</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <relocations>
                            <relocation>
                                <pattern>org.joda</pattern>
                                <shadedPattern>fr.pilato.thirdparty.joda</shadedPattern>
                            </relocation>
                        </relocations>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
```

You can create now a shaded version of elasticsearch + shield by running `mvn clean install`.

In your project, you can now depend on:

```xml
<dependency>
    <groupId>fr.pilato.elasticsearch.test</groupId>
    <artifactId>es-shaded</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.1</version>
</dependency>
```

Build then your TransportClient as usual:

```java
TransportClient client = TransportClient.builder()
        .settings(Settings.builder()
                        .put("path.home", ".")
                        .put("shield.user", "username:password")
                        .put("plugin.types", "org.elasticsearch.shield.ShieldPlugin")
        )
        .build();
client.addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("localhost", 9300)));

// Index some data
client.prepareIndex("test", "doc", "1").setSource("foo", "bar").setRefresh(true).get();
SearchResponse searchResponse = client.prepareSearch("test").get();
```

If you want to use your own version of Joda, then import for example `org.joda.time.DateTime`. If you want to access to the shaded version (not recommended though), import `fr.pilato.thirdparty.joda.time.DateTime`.

You can run a simple test to make sure that both classes can live together within the same JVM:

```java
CodeSource codeSource = new org.joda.time.DateTime().getClass().getProtectionDomain().getCodeSource();
System.out.println("unshaded = " + codeSource);

codeSource = new fr.pilato.thirdparty.joda.time.DateTime().getClass().getProtectionDomain().getCodeSource();
System.out.println("shaded = " + codeSource);
```

It will print:

```
unshaded = (file:/path/to/joda-time-2.1.jar <no signer certificates>)
shaded = (file:/path/to/es-shaded-1.0-SNAPSHOT.jar <no signer certificates>)
```

This PR also removes fully-loaded module.

By the way, the project can now build with Maven 3.3.3 so we can relax a bit our maven policy.
2015-09-02 11:57:10 +02:00
Ivannikov Kirill dbf42ba297 AtomicBoolean 2015-09-02 14:46:39 +05:00
Ivannikov Kirill 17089992e2 testPostIndexWithException listener test 2015-09-02 13:57:57 +05:00
Isabel Drost-Fromm 17959871ff Merge pull request #12414 from MaineC/feature/10885
Adds template support to _msearch resource

Much like we already do with search this adds templating support to the _msearch resource.

Closes #10885
2015-09-02 10:21:36 +02:00
Ivannikov Kirill 8f0ae51939 preIndex and postIndex listener test 2015-09-02 13:05:26 +05:00
Britta Weber 9f49e0e7c1 Merge pull request #13246 from brwe/read-post-recovery
Allow reads on shards that are in POST_RECOVERY
2015-09-02 09:46:01 +02:00
Britta Weber 89ac6a83f1 Allow reads on shards that are in POST_RECOVERY
Currently, we do not allow reads on shards which are in POST_RECOVERY which
unfortunately can cause search failures on shards which just recovered if there no replicas (#9421).
The reason why we did not allow reads on shards that are in POST_RECOVERY is
that after relocating a shard might miss a refresh if the node that executed the
refresh is behind with cluster state processing. If that happens, a user might execute
index/refresh/search but still not find the document that was indexed.

We changed how refresh works now in #13068 to make sure that shards cannot miss a refresh this
way by sending refresh requests the same way that we send write requests.

This commit changes IndexShard to allow reads on POST_RECOVERY now.
In addition it adds two test:

- test for issue #9421 (After relocation shards might temporarily not be searchable if still in POST_RECOVERY)
- test for visibility issue with relocation and refresh if reads allowed when shard is in POST_RECOVERY

closes #9421
2015-09-02 09:42:36 +02:00
Robert Muir 2a129f1868 Merge pull request #13263 from rmuir/improve_jacoco
Improve jacoco coverage
2015-09-01 22:39:59 -04:00
Robert Muir abec2679f0 Improve jacoco coverage
Upgrade jacoco version and allow it to run with security manager enabled.
2015-09-01 22:14:49 -04:00
Robert Muir 517f00b048 doc how to get code coverage for unit,integ,combined 2015-09-01 20:57:48 -04:00
Robert Muir e5a02b1d96 Remove unused goal to allow for integ test coverage analysis 2015-09-01 20:56:23 -04:00
Shane Connelly 5e385d5bf2 Fixed non-valid JSON (though ES would accept it) 2015-09-01 13:17:07 -07:00
Robert Muir 930a5ee170 Merge pull request #13244 from rmuir/lt
Lithuanian analysis
2015-09-01 15:42:58 -04:00
Nik Everett 38147da43e [tests] Fix exit code check for systemctl 2015-09-01 15:24:04 -04:00
Nik Everett 99d2f0463e [packaging] clean up more bats tests
This cleans up deb, rpm, systemd, and sysvinit tests:
1. Move skip_not_rpm, skip_not_dpkg, etc to the setup() methods for faster
runtime and cleaner code.
2. Removed lots of needless invocations of `run`
3. Created install_package for use in the systemd and sysvinit tests.
4. Removed lots of needless stderr to stdout redirects.

Closes #13075
Related to #13074
2015-09-01 14:57:47 -04:00
Ryan Ernst 768bfb7d1d Merge pull request #13206 from rjernst/mappings_broken
Fix numerous checks for equality and compatibility in mapper field types
2015-09-01 11:44:18 -07:00
Simon Willnauer 90c2b3a384 Add simple comparator tests Relates to #13249 2015-09-01 20:11:10 +02:00
Nik Everett 69b7feeb78 Merge pull request #13076 from nik9000/bats_plugins
Packaging: Install all plugins during bats tests
2015-09-01 13:44:15 -04:00
Nik Everett e4410482fe Packaging: Install all plugins during bats tests
Related to #12717
2015-09-01 13:43:56 -04:00
Britta Weber 7cbd0a1bf5 [test] delete index after test for repetition
DateHistogramIT has suite scope and therefore must take care of cleaning up after
each test. Otherwise we cannot run tests in several times with tests.iters.
2015-09-01 17:58:34 +02:00
Adrien Grand c6d282f9f6 Remove extra licenses 2015-09-01 17:44:57 +02:00
Adrien Grand 3619cce53b Update licenses for analysis plugins. 2015-09-01 15:21:49 +02:00
Nik Everett af394443e0 Merge pull request #13226 from nik9000/docs_position_increment_gap
[docs] Fix docs for position_increment_gap
2015-09-01 09:11:28 -04:00
Adrien Grand 656fa69f2d Merge pull request #13243 from llasram/hll-estimate-bias-nn-k-6
Estimate HyperLogLog bias via k-NN regression
2015-09-01 14:59:17 +02:00
Robert Muir 0d3e3f81fc Lithuanian analysis 2015-09-01 08:52:10 -04:00