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: Create xpack yaml features #31403

Merged
merged 4 commits into from
Jun 26, 2018
Merged

QA: Create xpack yaml features #31403

merged 4 commits into from
Jun 26, 2018

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Jun 18, 2018

This creates a YAML test "features" that indices if the cluster being
tested has xpack installed (xpack) or if it does not have xpack
installed (no_xpack). It uses those features to centralize skipping
a few tests that fail if xpack is installed.

The plan is to use this in a followup to skip docs tests that require
xpack when xpack is not installed. We plan to use the declaration
of required license level on the docs page to generate the required
skip.

Closes #30933.

@nik9000 nik9000 added review :Delivery/Build Build or test infrastructure v7.0.0 v6.4.0 labels Jun 18, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

/**
* Does the cluster being tested have xpack installed?
*/
public static boolean hasXPack() throws IOException {
Copy link
Member Author

Choose a reason for hiding this comment

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

I made this static so that we could use it easily from feature. I feel like if client() is static then this can be.

@@ -91,13 +94,38 @@
/**
* Convert the entity from a {@link Response} into a map of maps.
*/
public Map<String, Object> entityAsMap(Response response) throws IOException {
public static Map<String, Object> entityAsMap(Response response) throws IOException {
Copy link
Member Author

Choose a reason for hiding this comment

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

I made this static so I could make hasXPack static. There was no need for it to use the fancy registries provided by createParser.

@@ -41,7 +39,7 @@ private void deleteAllDatafeeds() throws IOException {
final Response datafeedsResponse = adminClient.performRequest(datafeedsRequest);
@SuppressWarnings("unchecked")
final List<Map<String, Object>> datafeeds =
(List<Map<String, Object>>) XContentMapValues.extractValue("datafeeds", testCase.entityAsMap(datafeedsResponse));
(List<Map<String, Object>>) XContentMapValues.extractValue("datafeeds", ESRestTestCase.entityAsMap(datafeedsResponse));
Copy link
Member Author

Choose a reason for hiding this comment

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

Checkstyle forced me to change this and the rest of the changes to this file come about because of the change here.

@@ -75,7 +73,7 @@ private void waitForPendingTasks() throws Exception {
@SuppressWarnings("unchecked")
private void deleteAllJobs() throws Exception {
Response response = adminClient.performRequest("GET", "/_xpack/rollup/job/_all");
Map<String, Object> jobs = testCase.entityAsMap(response);
Map<String, Object> jobs = ESRestTestCase.entityAsMap(response);
Copy link
Member Author

Choose a reason for hiding this comment

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

Checkstyle forced me to change this and the rest of the changes to this file come about because of the change here.

@lcawl lcawl mentioned this pull request Jun 18, 2018
5 tasks
@nik9000 nik9000 requested a review from hub-cap June 22, 2018 20:31
Copy link
Contributor

@hub-cap hub-cap left a comment

Choose a reason for hiding this comment

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

LGTM, nits.

throw new IllegalStateException("must be called inside of a rest test case test");
}
Map<?, ?> response = entityAsMap(client.performRequest(new Request("GET", "_nodes/plugins")));
Map<?, ?> nodes = (Map<?, ?>) response.get("nodes");
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to do any null checks here? Im a-ok not doing it given we always know it will come back w/ the data we want/need. I know its just a call to _nodes/plugins so I assume this is legit.

Copy link
Member Author

Choose a reason for hiding this comment

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

I figure we change the format of _nodes/plugins rarely enough that we're probably safe without them. If we change the format a NullPointException is the least of our problems, I think.

if (ESRestTestCase.hasXPack()) {
return false;
}
} else if (false == SUPPORTED.contains(feature)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason we just dont return SUPPORTED.contains(feature) for the last if branch?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to keep looping to check for the next feature.

@nik9000 nik9000 merged commit 232c71b into elastic:master Jun 26, 2018
nik9000 added a commit that referenced this pull request Jun 26, 2018
This creates a YAML test "features" that indices if the cluster being
tested has xpack installed (`xpack`) or if it does *not* have xpack
installed (`no_xpack`). It uses those features to centralize skipping
a few tests that fail if xpack is installed.

The plan is to use this in a followup to skip docs tests that require
xpack when xpack is not installed. We *plan* to use the declaration
of required license level on the docs page to generate the required
`skip`.

Closes #30933.
@nik9000
Copy link
Member Author

nik9000 commented Jun 26, 2018

Backported to 6.x. I do not plan to backport to 6.3.

dnhatn added a commit that referenced this pull request Jun 26, 2018
* master:
  ingest: Add ignore_missing property to foreach filter (#22147) (#31578)
  Fix a formatting issue in the docvalue_fields documentation. (#31563)
  reduce log level at gradle configuration time
  [TEST] Close additional clients created while running yaml tests (#31575)
  Docs: Clarify sensitive fields watcher encryption (#31551)
  Watcher: Remove never executed code (#31135)
  Add support for switching distribution for all integration tests (#30874)
  Improve robustness of geo shape parser for malformed shapes (#31449)
  QA: Create xpack yaml features (#31403)
  Improve test times for tests using `RandomObjects::addFields` (#31556)
  [Test] Add full cluster restart test for Rollup (#31533)
  Enhance thread context uniqueness assertion
  [DOCS] Fix heading format errors (#31483)
  fix writeIndex evaluation for aliases (#31562)
  Add x-opaque-id to search slow logs (#31539)
  Watcher: Fix put watch action (#31524)
  Add package pre-install check for java binary (#31343)
  Reduce number of raw types warnings (#31523)
  Migrate scripted metric aggregation scripts to ScriptContext design (#30111)
  turn GetFieldMappingsResponse to ToXContentObject (#31544)
  Close xcontent parsers (partial) (#31513)
  Ingest Attachment: Upgrade Tika to 1.18 (#31252)
  TEST: Correct the assertion arguments order (#31540)
jasontedor added a commit to majormoses/elasticsearch that referenced this pull request Jun 27, 2018
* elastic/master: (57 commits)
  HLRest: Fix test for explain API
  [TEST] Fix RemoteClusterConnectionTests
  Add Create Snapshot to High-Level Rest Client (elastic#31215)
  Remove legacy MetaDataStateFormat (elastic#31603)
  Add explain API to high-level REST client (elastic#31387)
  Preserve thread context when connecting to remote cluster (elastic#31574)
  Unify headers for full text queries
  Remove redundant 'minimum_should_match'
  JDBC driver prepared statement set* methods  (elastic#31494)
  [TEST] call yaml client close method from test suite (elastic#31591)
  ingest: Add ignore_missing property to foreach filter (elastic#22147) (elastic#31578)
  Fix a formatting issue in the docvalue_fields documentation. (elastic#31563)
  reduce log level at gradle configuration time
  [TEST] Close additional clients created while running yaml tests (elastic#31575)
  Docs: Clarify sensitive fields watcher encryption (elastic#31551)
  Watcher: Remove never executed code (elastic#31135)
  Add support for switching distribution for all integration tests (elastic#30874)
  Improve robustness of geo shape parser for malformed shapes (elastic#31449)
  QA: Create xpack yaml features (elastic#31403)
  Improve test times for tests using `RandomObjects::addFields` (elastic#31556)
  ...
dnhatn added a commit that referenced this pull request Jun 28, 2018
* 6.x:
  Docs: Remove duplicate test setup
  Docs: Fix description of percentile ranks example example (#31652)
  Remove deprecation warnings to prepare for Gradle 5 (sourceSets.main.output.classesDirs) (#30389)
  Do not check for Azure container existence (#31617)
  Merge AwsS3Service and InternalAwsS3Service in a S3Service class (#31580)
  Remove item listed in 6.3 notes that's not in 6.3 (#31623)
  remove unused import
  Upgrade gradle wrapper to 4.8 (#31525)
  Only set vm.max_map_count if greater than default (#31512)
  QA: Merge query-builder-bwc to restart test (#30979)
  Docs: Skip xpack snippet tests if no xpack (#31619)
  [TEST] Fix RemoteClusterConnectionTests
  Remove legacy MetaDataStateFormat (#31603)
  [TEST] call yaml client close method from test suite (#31591)
  [TEST] Close additional clients created while running yaml tests (#31575)
  Node selector per client rather than per request (#31471)
  Preserve thread context when connecting to remote cluster (#31574)
  Remove redundant 'minimum_should_match'
  Unify headers for full text queries
  JDBC driver prepared statement set* methods  (#31494)
  add logging breaking changes from 5.3 to 6.0 (#31583)
  Fix a formatting issue in the docvalue_fields documentation. (#31563)
  Improve robustness of geo shape parser for malformed shapes
  QA: Create xpack yaml features (#31403)
@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
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v6.4.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

YML Testing: Add distribution support to skip
5 participants