@@ -23,14 +23,14 @@ See the section in [TESTING.asciidoc](../../TESTING.asciidoc#testing-packaging)
23
23
24
24
When gradle runs the packaging tests on a VM, it runs the full suite by
25
25
default. To add a test class to the suite, add its ` class ` to the
26
- ` @SuiteClasses ` annotation in [ PackagingTests .java] ( src/main /java/org/elasticsearch/packaging/PackagingTests .java ) .
26
+ ` @SuiteClasses ` annotation in [ PackagingTestCase .java] ( src/test /java/org/elasticsearch/packaging/test/PackagingTestCase .java ) .
27
27
If a test class is added to the project but not to this annotation, it will not
28
28
run in CI jobs. The test classes are run in the order they are listed in the
29
29
annotation.
30
30
31
31
## Choosing which distributions to test
32
32
33
- Distributions are represented by [ enum values] ( src/main /java/org/elasticsearch/packaging/util/Distribution.java )
33
+ Distributions are represented by [ enum values] ( src/test /java/org/elasticsearch/packaging/util/Distribution.java )
34
34
which know if they are compatible with the platform the tests are currently
35
35
running on. To skip a test if the distribution it's using isn't compatible with
36
36
the current platform, put this [ assumption] ( https://github.com/junit-team/junit4/wiki/assumptions-with-assume )
@@ -41,7 +41,7 @@ assumeTrue(distribution.packaging.compatible);
41
41
```
42
42
43
43
Similarly if you write a test that is intended only for particular platforms,
44
- you can make an assumption using the constants and methods in [ Platforms.java] ( src/main /java/org/elasticsearch/packaging/util/Platforms.java )
44
+ you can make an assumption using the constants and methods in [ Platforms.java] ( src/test /java/org/elasticsearch/packaging/util/Platforms.java )
45
45
46
46
``` java
47
47
assumeTrue(" only run on windows" , Platforms . WINDOWS );
@@ -73,14 +73,14 @@ public class MyTestDefaultTar extends MyTestCase {
73
73
```
74
74
75
75
That way when a test fails the user gets told explicitly that ` MyTestDefaultTar `
76
- failed, and to reproduce it they should run that class. See [ ArchiveTestCase] ( src/main /java/org/elasticsearch/packaging/test/ArchiveTestCase .java )
76
+ failed, and to reproduce it they should run that class. See [ ArchiveTestCase] ( src/test /java/org/elasticsearch/packaging/test/ArchiveTests .java )
77
77
and its children for an example of this.
78
78
79
79
## Running external commands
80
80
81
81
In general it's probably best to avoid running external commands when a good
82
82
Java alternative exists. For example most filesystem operations can be done with
83
- the java.nio.file APIs. For those that aren't, use an instance of [ Shell] ( src/main /java/org/elasticsearch/packaging/util/Shell.java )
83
+ the java.nio.file APIs. For those that aren't, use an instance of [ Shell] ( src/test /java/org/elasticsearch/packaging/util/Shell.java )
84
84
85
85
This class runs scripts in either bash with the ` bash -c <script> ` syntax,
86
86
or in powershell with the ` powershell.exe -Command <script> ` syntax.
0 commit comments