Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QA: System property to override distribution #30591

Merged
merged 12 commits into from
May 15, 2018

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented May 14, 2018

This configures all qa projects to use the distribution contained in
the tests.distribution system property if it is set. The goal is to
create a simple way to run tests against the default distribution which
has x-pack basic features enabled while not forcing these tests on all
contributors. You run these tests by doing something like:

./gradlew -p qa -Dtests.distribution=zip check

or

./gradlew -p qa -Dtests.distribution=zip bwcTest

x-pack basic shouldn't get in the way of any of these tests but
nothing is ever perfect so this also adds support for skipping tests
based on the distribution. For the yaml tests this looks like:

    - skip:
        distribution: zip
        reason: x-pack includes templates which breaks the output here

For java tests it looks something like:

assumeFalse("zip".equals(System.getProperty("tests.distribution")),
        "some reason");

Gradle makes sure to set the tests.distribution environment variable
when running tests whether or not you override the distribution on the
command line. This allows us to remove some tests.rest.blacklist
settings in x-pack/qa because those tests skip themselves based on the
distribution. I think this sort of thing substantially reduces the
"surprise factor" while working on x-pack.

This configures all `qa` projects to use the distribution contained in
the `tests.distribution` system property if it is set. The goal is to
create a simple way to run tests against the default distribution which
has x-pack basic features enabled while not forcing these tests on all
contributors. You run these tests by doing something like:

```
./gradlew -p qa -Dtests.distribution=zip check
```

or

```
./gradlew -p qa -Dtests.distribution=zip bwcTest
```

x-pack basic *shouldn't* get in the way of any of these tests but
nothing is ever perfect so this also adds support for skipping tests
based on the distribution. For the yaml tests this looks like:

```
    - skip:
        distribution: zip
        reason: x-pack includes templates which breaks the output here
```

For java tests it looks something like:

```
assumeFalse("zip".equals(System.getProperty("tests.distribution")),
        "some reason");
```

Gradle makes sure to set the `tests.distribution` environment variable
when running tests whether or not you override the distribution on the
command line. This allows us to remove some `tests.rest.blacklist`
settings in `x-pack/qa` because those tests skip themselves based on the
distribution. I think this sort of thing substantially reduces the
"surprise factor" while working on x-pack.
@nik9000 nik9000 added >test Issues or PRs that are addressing/adding tests blocker :Delivery/Build Build or test infrastructure v7.0.0 v6.3.0 v6.4.0 labels May 14, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@@ -4,7 +4,7 @@ import org.elasticsearch.gradle.test.RestIntegTestTask
subprojects { Project subproj ->
subproj.tasks.withType(RestIntegTestTask) {
subproj.extensions.configure("${it.name}Cluster") { cluster ->
cluster.distribution = 'oss-zip'
cluster.distribution = System.getProperty('tests.distribution', 'oss-zip')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I thought this PR would be just this line. If only things were that simple....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And now that I've reverted most of the rest, it is almost the only line!

@@ -149,6 +149,7 @@ public ReproduceErrorMessageBuilder appendESProperties() {
}
appendOpt("tests.locale", Locale.getDefault().toLanguageTag());
appendOpt("tests.timezone", TimeZone.getDefault().getID());
appendOpt("tests.distribution", System.getProperty("tests.distribution"));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you override the distribution on the command line then it is important to override it again. If you don't override it on the command line then setting this environment variable does nothing which is fine.

@@ -15,9 +15,6 @@ integTestRunner {
['cat.aliases/10_basic/Empty cluster',
'index/10_with_id/Index with ID',
'indices.get_alias/10_basic/Get alias against closed indices',
'cat.templates/10_basic/No templates',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are skipped by the skip section in the test now which I find much easier to read.

@nik9000
Copy link
Member Author

nik9000 commented May 14, 2018

This is a WIP because I'm still experimenting with it locally.

@nik9000
Copy link
Member Author

nik9000 commented May 14, 2018

I think I could drop the skip section changes in favor of more blacklists but I prefer I think they make the tests more readable. If we feel like it is too big to backport to 6.3 then I'm happy to go the blacklist route and do the skip in a followup.

@nik9000
Copy link
Member Author

nik9000 commented May 14, 2018

I think I could drop the skip section changes in favor of more blacklists but I prefer I think they make the tests more readable. If we feel like it is too big to backport to 6.3 then I'm happy to go the blacklist route and do the skip in a followup.

On second thought I think I will drop the skip enhancement. Those yml files are shared between Elasticsearch and its language clients are they aren't likely to like the change.

@nik9000 nik9000 changed the title WIP: QA: System property to override distribution QA: System property to override distribution May 14, 2018
@@ -57,6 +57,11 @@ for (Version version : bwcVersions.wireCompatible) {
/* To support taking index snapshots, we have to set path.repo setting */
tasks.getByName("${baseName}#mixedClusterTestRunner").configure {
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
systemProperty 'tests.rest.blacklist', [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, no, this isn't right.

@nik9000
Copy link
Member Author

nik9000 commented May 15, 2018

not quite...

@nik9000
Copy link
Member Author

nik9000 commented May 15, 2018

I'm still working through getting a clean run of ./gradlew -p qa check -Dtests.distribution=zip. Most things are working but it not everything. So far the only failing things are to do with the tests, not Elasticsearch.

@nik9000
Copy link
Member Author

nik9000 commented May 15, 2018

OK! I've got ./gradlew -p qa check -Dtests.distribution=zip passing locally. I'm running ./gradlew -p qa bwcTest -Dtests.distribution=zip to make sure that that passes as well but I suspect it will.

@nik9000 nik9000 added the review label May 15, 2018
@nik9000
Copy link
Member Author

nik9000 commented May 15, 2018

OK! I got a successful run of ./gradlew -p qa bwcTest -Dtests.distribution=zip!

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -26,3 +26,10 @@ dependencies {
testCompile project(path: ':modules:lang-mustache', configuration: 'runtime')
}

/*
* One of the integration tests doesn't work with the zip distribution
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open an issue for this so it is tracked and link it in this code comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely.

@nik9000 nik9000 merged commit 869b639 into elastic:master May 15, 2018
nik9000 added a commit that referenced this pull request May 16, 2018
This configures all `qa` projects to use the distribution contained in
the `tests.distribution` system property if it is set. The goal is to
create a simple way to run tests against the default distribution which
has x-pack basic features enabled while not forcing these tests on all
contributors. You run these tests by doing something like:

```
./gradlew -p qa -Dtests.distribution=zip check
```

or

```
./gradlew -p qa -Dtests.distribution=zip bwcTest
```

x-pack basic *shouldn't* get in the way of any of these tests but
nothing is ever perfect so this we have to disable a few when running
with the zip distribution.
nik9000 added a commit that referenced this pull request May 16, 2018
This configures all `qa` projects to use the distribution contained in
the `tests.distribution` system property if it is set. The goal is to
create a simple way to run tests against the default distribution which
has x-pack basic features enabled while not forcing these tests on all
contributors. You run these tests by doing something like:

```
./gradlew -p qa -Dtests.distribution=zip check
```

or

```
./gradlew -p qa -Dtests.distribution=zip bwcTest
```

x-pack basic *shouldn't* get in the way of any of these tests but
nothing is ever perfect so this we have to disable a few when running
with the zip distribution.
@bleskes
Copy link
Contributor

bleskes commented May 16, 2018

It looks like this was backported. I removed the label.

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request May 16, 2018
…bad-mkay

* elastic/6.x:
  [ML] Wait for ML indices in rolling upgrade tests (elastic#30615)
  Watcher: Ensure secrets integration tests also run triggered watch (elastic#30478)
  Move allocation awareness attributes to list setting (elastic#30626)
  [Docs] Update code snippet in has-child-query.asciidoc (elastic#30510)
  Allow date math for naming newly-created snapshots (elastic#7939) (elastic#30479)
  Awaits fix a failing test
  Switch many QA projects to use new style requests (elastic#30574)
  QA: System property to override distribution (elastic#30591)
@nik9000
Copy link
Member Author

nik9000 commented May 16, 2018

It looks like this was backported. I removed the label.

Thanks!

@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team >test Issues or PRs that are addressing/adding tests v6.3.0 v6.4.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants