Skip to content

Update test suite names & fix tests #162

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

Merged
merged 4 commits into from
Feb 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ COPY elasticsearch/src ./elasticsearch/src
COPY elasticsearch/build.rs ./elasticsearch/build.rs
COPY yaml_test_runner ./yaml_test_runner

RUN cargo build --tests
RUN cargo build --tests
5 changes: 2 additions & 3 deletions .ci/functions/imports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require_stack_version
if [[ -z $es_node_name ]]; then
# only set these once
set -euo pipefail
export TEST_SUITE=${TEST_SUITE-oss}
export TEST_SUITE=${TEST_SUITE-free}
export RUNSCRIPTS=${RUNSCRIPTS-}
export DETACH=${DETACH-false}
export CLEANUP=${CLEANUP-false}
Expand All @@ -27,8 +27,7 @@ if [[ -z $es_node_name ]]; then
export elastic_password=changeme
export elasticsearch_image=elasticsearch
export elasticsearch_url=https://elastic:${elastic_password}@${es_node_name}:9200
if [[ $TEST_SUITE != "xpack" ]]; then
export elasticsearch_image=elasticsearch-${TEST_SUITE}
if [[ $TEST_SUITE != "platinum" ]]; then
export elasticsearch_url=http://${es_node_name}:9200
fi
export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost}
Expand Down
6 changes: 3 additions & 3 deletions .ci/run-elasticsearch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# to form a cluster suitable for running the REST API tests.
#
# Export the STACK_VERSION variable, eg. '8.0.0-SNAPSHOT'.
# Export the TEST_SUITE variable, eg. 'oss' or 'xpack' defaults to 'oss'.
# Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'.
# Export the NUMBER_OF_NODES variable to start more than 1 node

# Version 1.1.0
Expand Down Expand Up @@ -38,7 +38,7 @@ environment=($(cat <<-END
--env repositories.url.allowed_urls=http://snapshot.test*
END
))
if [[ "$TEST_SUITE" == "xpack" ]]; then
if [[ "$TEST_SUITE" == "platinum" ]]; then
environment+=($(cat <<-END
--env ELASTIC_PASSWORD=$elastic_password
--env xpack.license.self_generated.type=trial
Expand All @@ -63,7 +63,7 @@ END
fi

cert_validation_flags=""
if [[ "$TEST_SUITE" == "xpack" ]]; then
if [[ "$TEST_SUITE" == "platinum" ]]; then
cert_validation_flags="--insecure --cacert /usr/share/elasticsearch/config/certs/ca.crt --resolve ${es_node_name}:443:127.0.0.1"
fi

Expand Down
2 changes: 1 addition & 1 deletion .ci/run-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


# STACK_VERSION -- version e.g Major.Minor.Patch(-Prelease)
# TEST_SUITE -- which test suite to run: oss or xpack
# TEST_SUITE -- which test suite to run: free or platinum
# ELASTICSEARCH_URL -- The url at which elasticsearch is reachable, a default is composed based on STACK_VERSION and TEST_SUITE
# RUST_TOOLCHAIN -- Rust toolchain version to compile and run tests
script_path=$(dirname $(realpath -s $0))
Expand Down
4 changes: 2 additions & 2 deletions .ci/test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ STACK_VERSION:
- 8.0.0-SNAPSHOT

TEST_SUITE:
- oss
- xpack
- free
- platinum

RUST_TOOLCHAIN:
- latest
Expand Down
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ target
docs
.vscode
.idea
*.iml

api_generator/src/bin

yaml_test_runner/tests
!yaml_test_runner/tests/common
!yaml_test_runner/tests/common
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ The `Elasticsearch` category of steps are specifically defined for this project

- `STACK_VERSION`: Elasticsearch version like `7.9.0` or can be
a snapshot release like `7.x-SNAPSHOT`
- `TEST_SUITE`: Elasticsearch distribution of `oss` or `xpack`
- `TEST_SUITE`: Elasticsearch distribution of `free` or `platinum`

```sh
cargo make test-yaml --env STACK_VERSION=7.9.0 --env TEST_SUITE=oss
cargo make test-yaml --env STACK_VERSION=7.9.0 --env TEST_SUITE=free
```

### Packages
Expand Down Expand Up @@ -198,4 +198,4 @@ if wishing to use the MSVC debugger with Rust in VS code, which may be preferred
}
```

3. Add `"debug.allowBreakpointsEverywhere": true` to VS code settings.json
3. Add `"debug.allowBreakpointsEverywhere": true` to VS code settings.json
32 changes: 17 additions & 15 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ default_to_workspace = false

[env]
# Determines the version of Elasticsearch docker container used
STACK_VERSION = "8.0.0-SNAPSHOT"
# Determines the distribution of docker container used. Either xpack or oss
TEST_SUITE = "xpack"
STACK_VERSION = { value = "8.0.0-SNAPSHOT", condition = { env_not_set = ["STACK_VERSION"] }}
# Determines the distribution of docker container used. Either platinum or free
TEST_SUITE = { value = "free", condition = { env_not_set = ["TEST_SUITE"] }}
# Set publish flags to dry-run by default, to force user to explicitly define for publishing
CARGO_MAKE_CARGO_PUBLISH_FLAGS = "--dry-run"

[tasks.set-oss-env]
[tasks.set-free-env]
category = "Elasticsearch"
description = "Sets ELASTICSEARCH_URL environment variable if not already set for later tasks when oss test suite used"
description = "Sets ELASTICSEARCH_URL environment variable if not already set for later tasks when free test suite used"
private = true
condition = { env = { "TEST_SUITE" = "oss" }, env_not_set = ["ELASTICSEARCH_URL"] }
condition = { env = { "TEST_SUITE" = "free" }, env_not_set = ["ELASTICSEARCH_URL"] }
env = { "ELASTICSEARCH_URL" = "http://localhost:9200" }

[tasks.set-xpack-env]
[tasks.set-platinum-env]
category = "Elasticsearch"
description = "Sets ELASTICSEARCH_URL environment variable if not already set for later tasks when xpack test suite used"
description = "Sets ELASTICSEARCH_URL environment variable if not already set for later tasks when platinum test suite used"
private = true
condition = { env = { "TEST_SUITE" = "xpack" }, env_not_set = ["ELASTICSEARCH_URL"] }
condition = { env = { "TEST_SUITE" = "platinum" }, env_not_set = ["ELASTICSEARCH_URL"] }
env = { "ELASTICSEARCH_URL" = "https://elastic:changeme@localhost:9200" }

[tasks.run-yaml-test-runner]
Expand Down Expand Up @@ -52,7 +52,7 @@ dependencies = ["generate-yaml-tests"]
[tasks.test-elasticsearch]
category = "Elasticsearch"
private = true
condition = { env_set = [ "ELASTICSEARCH_URL" ], env = { "TEST_SUITE" = "xpack" } }
condition = { env_set = [ "ELASTICSEARCH_URL" ], env = { "TEST_SUITE" = "platinum" } }
command = "cargo"
args = ["test", "-p", "elasticsearch"]
dependencies = ["start-elasticsearch"]
Expand Down Expand Up @@ -85,7 +85,7 @@ dependencies = ["install-cargo2junit"]
category = "Elasticsearch"
private = true
condition = { env_set = [ "STACK_VERSION", "TEST_SUITE" ], env_false = ["CARGO_MAKE_CI"] }
dependencies = ["set-oss-env", "set-xpack-env"]
dependencies = ["set-free-env", "set-platinum-env"]

[tasks.run-elasticsearch.linux]
command = "./.ci/run-elasticsearch.sh"
Expand Down Expand Up @@ -120,17 +120,19 @@ exec cargo publish %{CARGO_MAKE_CARGO_PUBLISH_FLAGS}

[tasks.start-elasticsearch]
extend = "run-elasticsearch"
private = false
description = "Starts Elasticsearch docker container with the given version and distribution"
env = { "CLEANUP" = false, "DETACH" = true }

[tasks.stop-elasticsearch]
extend = "run-elasticsearch"
private = false
description = "Stops Elasticsearch docker container, if running"
env = { "CLEANUP" = true, "DETACH" = false }

[tasks.test-yaml]
category = "Elasticsearch"
description = "Generates and runs yaml_test_runner package xpack/oss tests against a given Elasticsearch version"
description = "Generates and runs yaml_test_runner package platinum/free tests against a given Elasticsearch version"
condition = { env_set = [ "STACK_VERSION", "TEST_SUITE" ] }
dependencies = ["generate-yaml-tests", "create-test-results-dir", "test-yaml-test-runner", "test-yaml-test-runner-ci", "convert-test-results-junit"]
run_task = "stop-elasticsearch"
Expand All @@ -146,7 +148,7 @@ args = ["test", "-p", "api_generator"]
category = "Elasticsearch"
clear = true
description = "Runs elasticsearch package tests against a given Elasticsearch version"
env = { "TEST_SUITE" = { value = "xpack", condition = { env_set = ["TEST_SUITE"] } } }
env = { "TEST_SUITE" = { value = "platinum", condition = { env_set = ["TEST_SUITE"] } } }
dependencies = ["test-elasticsearch"]
run_task = "stop-elasticsearch"

Expand Down Expand Up @@ -217,7 +219,7 @@ script = ['''
echo - start-elasticsearch: Starts Elasticsearch docker container with the given version and distribution
echo - stop-elasticsearch: Stops Elasticsearch docker container, if running
echo
echo - test-yaml: Generates and runs yaml_test_runner package xpack/oss tests against a given Elasticsearch version
echo - test-yaml: Generates and runs yaml_test_runner package platinum/free tests against a given Elasticsearch version
echo - test-generator: Generates and runs api_generator package tests
echo - test: Runs elasticsearch package tests against a given Elasticsearch version
echo
Expand All @@ -230,7 +232,7 @@ script = ['''
echo
echo Most tasks use these environment variables:
echo - STACK_VERSION (default '${STACK_VERSION}'): the version of Elasticsearch
echo - TEST_SUITE ('oss' or 'xpack', default '${TEST_SUITE}'): the distribution of Elasticsearch
echo - TEST_SUITE ('free' or 'platinum', default '${TEST_SUITE}'): the distribution of Elasticsearch
echo - CI (default not set): set when running on CI to determine whether to start Elasticsearch and format test output as JSON
echo
echo Run 'cargo make --list-all-steps' for a complete list of available tasks.
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/async_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
//! let you asynchronously execute a search request, monitor its progress, and retrieve
//! partial results as they become available.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@
//! ```
//!

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/ccr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
//! - Disaster recovery in case a primary cluster fails. A secondary cluster can serve as a hot backup
//! - Geo-proximity so that reads can be served locally

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
//! [Manage settings](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster.html),
//! perform operations, and retrieve information about an Elasticsearch cluster.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/dangling_indices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
//!
//! The dangling indices APIs can list, import and delete dangling indices.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/enrich.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
//! as part of an [ingest pipeline](../ingest/index.html), to add data from your existing indices
//! to incoming documents during ingest.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
//! indices, [inferring relationships across documents](https://www.elastic.co/what-is/elasticsearch-graph),
//! and allowing the [exploration of such relationships](https://www.elastic.co/guide/en/elasticsearch/reference/master/graph-explore-api.html).

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/ilm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
//! template used to create them. Update the policy to modify the lifecycle of both new
//! and existing indices.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/indices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
//! [Manage individual indices](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices.html),
//! index settings, aliases, mappings, and index templates.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
//! be conditionally executed, and failures within pipelines can be explicitly handled by defining
//! processors to execute in the event of failure.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/license.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
//! - Start indefinite use of the Basic license features
//! - Get the status of trial and basic license features

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
//!
//! [Simplify upgrading X-Pack indices from one version to another](https://www.elastic.co/guide/en/elasticsearch/reference/master/migration-api.html).

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/ml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
//!
//! [Perform machine learning anomaly detection activities](https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-apis.html).

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
//! Manage settings, perform operations, and retrieve information about the
//! [nodes in an Elasticsearch cluster](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster.html).

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/root/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
// cargo make generate-api
// -----------------------------------------------

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/security.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
//! - Authenticate users against an OpenID Connect or SAML authentication realm when using a
//! custom web application other than Kibana

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/slm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
//! indices. Snapshot Lifecycle Management can also perform deletion of older snapshots based on a
//! configurable retention policy.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
//! indices or the entire cluster, stored in a repository on a shared filesystem or a remote repository
//! on S3, HDFS, Azure, Google Cloud storage, and more.

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
3 changes: 2 additions & 1 deletion elasticsearch/src/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
//!
//! [Execute SQL queries against Elasticsearch indices and return results in tabular format](https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-sql.html).

# ! [ allow ( unused_imports ) ]use crate::{
#![allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
Expand Down
Loading