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

IGNITE-23196 [ducktests] Change JVM options to JDK11 ones #11536

Merged
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
92 changes: 87 additions & 5 deletions modules/ducktests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ The `ignitetest` framework provides basic functionality and services
to write integration tests for Apache Ignite. This framework bases on
the `ducktape` test framework, for information about it check the links:
- https://github.com/confluentinc/ducktape - source code of the `ducktape`.
- http://ducktape-docs.readthedocs.io - documentation to the `ducktape`.
- https://ducktape.readthedocs.io/en/latest/index.html - documentation to the `ducktape`.

Structure of the `tests` directory is:
- `./ignitetest/services` contains basic services functionality.
Expand Down Expand Up @@ -77,24 +77,106 @@ You may set versions (products) using `@ignite_versions` decorator at code
```
or passing versions set via globals during the execution
```
--globals-json, eg: {"ignite_versions":["2.8.1", "dev"]}
--global-json, eg: {"ignite_versions":["2.8.1", "dev"]}
```
You may also specify product prefix by `project` param at globals, for example:
```
--globals-json, eg: {"project": "fork" ,"ignite_versions": ["ignite-2.8.1", "2.8.1", "dev"]}
--global-json, eg: {"project": "fork" ,"ignite_versions": ["ignite-2.8.1", "2.8.1", "dev"]}
```
will execute tests on `ignite-2.8.1, fork-2.8.1, fork-dev`

## Run tests from the external source/repository
TBD

# Special runs
## Run with FlightRecorder (JFR)
To run ignite with flight recorder you should enable `jfr_enabled` through globals, for example:
```
--global-json, eg: {"jfr_enabled":true}
```
## Run with safepoints logging
Safepoint logging is disabled by default, to enable it, you need to pass `true` for `safepoint_log_enabled` for example:
```
--global-json, eg: {"safepoint_log_enabled":true}
```
## Run with enabled security
### Run with SSL enabled
TBD
To enable ssl it is only required to pass `enabled` for `ssl` in globals:
```
--global-json, eg: {"ssl":{"enabled":true}}
```
In this case, all ssl params will be set to default values, and will be written to ignite config.
These values correspond to the keystores that are generated (and you shouldn't worry about it).
Default keystores for these services are generated automatically on creating environment.

If you want, you could override these values through globals, for example:
```
{"ssl": {
"enabled": true,
"params": {
"server": {
"key_store_jks": "server.jks",
"key_store_password": "123456",
"trust_store_jks": "truststore.jks",
"trust_store_password": "123456"
},
"client": {
"key_store_jks": "client.jks",
"key_store_password": "123456",
"trust_store_jks": "truststore.jks",
"trust_store_password": "123456"
},
"admin": {
"key_store_jks": "admin.jks",
"key_store_password": "123456",
"trust_store_jks": "truststore.jks",
"trust_store_password": "123456"
}
}
}
}
```
Where:

Server, client and admin are three possible interactions with a cluster in a ducktape, each of them has its own alias,
which corresponds to keystore:
* Ignite(clientMode = False) - server
* Ignite(clientMode = True) - client
* ControlUtility - admin

And options `key_store_jks` and `trust_store_jks` are paths to keys.
If you start it with `/` it will be used as an absolute path.
Otherwise, it will be a relative path that starts from `/mnt/service/shared/`.

And if you need to specify values only for one configuration, you can skip other configurations, for example:

```
{"ssl": {
"enabled": true,
"params": {
"server": {
"key_store_jks": "server.jks",
"key_store_password": "123456",
"trust_store_jks": "truststore.jks",
"trust_store_password": "123456"
}
}
}
}
```

For more information about ssl in ignite you can check this link: [SSL in ignite](https://ignite.apache.org/docs/latest/security/ssl-tls)

### Run with build-in authentication enabled
TBD
Via this option you could overwrite default login and password options in tests with authentication.
```
{"authentication":{
"enabled": true,
"username": "username",
"password": "password"
}
}
```

## Run with metrics export enabled

Expand Down
22 changes: 12 additions & 10 deletions modules/ducktests/tests/checks/utils/check_ignite_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,19 @@ def check_default_jvm_options__are_not_used__if_merge_with_default_is_false(serv

def check_boolean_options__go_after_default_ones_and_overwrite_them__if_passed_via_jvm_opt(service):
Copy link
Contributor

@skorotkov skorotkov Sep 17, 2024

Choose a reason for hiding this comment

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

Even if the UnlockCommercialFeatures option is not used for JVM 11+ anymore it's not a reason to drop the test for the boolean options support. Just choose another boolean option. The -XX:+FlightRecorder would be ok I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returned the test, tweaked it to check FlightRecorder in options

service.context.globals[JFR_ENABLED] = True
spec = IgniteApplicationSpec(service, jvm_opts="-XX:-UnlockCommercialFeatures")
assert "-XX:-UnlockCommercialFeatures" in spec.jvm_opts
assert "-XX:-UnlockCommercialFeatures" in spec.jvm_opts
assert spec.jvm_opts.index("-XX:-UnlockCommercialFeatures") >\
spec.jvm_opts.index("-XX:+UnlockCommercialFeatures")
spec = IgniteApplicationSpec(service, jvm_opts="-XX:-FlightRecorder")
assert "-XX:-FlightRecorder" in spec.jvm_opts
Copy link
Contributor

Choose a reason for hiding this comment

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

We have here 2 identical asserts.

I think one of them should be replaced with the
assert "-XX:+FlightRecorder" in spec.jvm_opts

Otherwise it doesn't make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

assert "-XX:+FlightRecorder" in spec.jvm_opts
assert spec.jvm_opts.index("-XX:-FlightRecorder") >\
spec.jvm_opts.index("-XX:+FlightRecorder")


def check_colon_options__go_after_default_ones_and_overwrite_them__if_passed_via_jvm_opt(service):
service.log_dir = "/default-path"
spec = IgniteApplicationSpec(service, jvm_opts=["-Xloggc:/some-non-default-path/gc.log"])
assert "-Xloggc:/some-non-default-path/gc.log" in spec.jvm_opts
assert "-Xloggc:/default-path/gc.log" in spec.jvm_opts
assert spec.jvm_opts.index("-Xloggc:/some-non-default-path/gc.log") > \
spec.jvm_opts.index("-Xloggc:/default-path/gc.log")
spec = IgniteApplicationSpec(service, jvm_opts=["-Xlog:gc:/some-non-default-path/gc.log"])
assert "-Xlog:gc:/some-non-default-path/gc.log" in spec.jvm_opts
assert "-Xlog:gc*=debug,gc+stats*=debug,gc+ergo*=debug:/default-path/gc.log:uptime,time,level,tags" \
in spec.jvm_opts
assert spec.jvm_opts.index("-Xlog:gc:/some-non-default-path/gc.log") > \
spec.jvm_opts.index(
"-Xlog:gc*=debug,gc+stats*=debug,gc+ergo*=debug:/default-path/gc.log:uptime,time,level,tags")
10 changes: 7 additions & 3 deletions modules/ducktests/tests/ignitetest/services/utils/ignite_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from ignitetest.services.utils.metrics.metrics import is_opencensus_metrics_enabled, configure_opencensus_metrics,\
is_jmx_metrics_enabled, configure_jmx_metrics
from ignitetest.services.utils.jmx_remote.jmx_remote_params import get_jmx_remote_params
from ignitetest.utils.ignite_test import JFR_ENABLED
from ignitetest.utils.ignite_test import JFR_ENABLED, SAFEPOINT_LOGS_ENABLED
from ignitetest.utils.version import DEV_BRANCH

SHARED_PREPARED_FILE = ".ignite_prepared"
Expand Down Expand Up @@ -102,6 +102,11 @@ def __get_default_jvm_opts(self):
oom_path=os.path.join(self.service.log_dir, "out_of_mem.hprof"),
vm_error_path=os.path.join(self.service.log_dir, "hs_err_pid%p.log"))

if self.service.context.globals.get(SAFEPOINT_LOGS_ENABLED, False):
default_jvm_opts = merge_jvm_settings(
default_jvm_opts, ["-Xlog:safepoint*=debug:file=" + os.path.join(self.service.log_dir, "safepoint.log")
+ ":time,uptime,level,tags"])

default_jvm_opts = merge_jvm_settings(
default_jvm_opts, ["-DIGNITE_SUCCESS_FILE=" + os.path.join(self.service.persistent_root, "success_file"),
"-Dlog4j.configDebug=true"])
Expand All @@ -112,8 +117,7 @@ def __get_default_jvm_opts(self):

if self.service.context.globals.get(JFR_ENABLED, False):
default_jvm_opts = merge_jvm_settings(default_jvm_opts,
["-XX:+UnlockCommercialFeatures",
"-XX:+FlightRecorder",
["-XX:+FlightRecorder",
"-XX:StartFlightRecording=dumponexit=true," +
f"filename={self.service.jfr_dir}/recording.jfr"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create_jvm_settings(heap_size=DEFAULT_HEAP, gc_settings=JVM_PARAMS_GC_G1, ge
"""
gc_dump = ""
if gc_dump_path:
gc_dump = "-verbose:gc -Xloggc:" + gc_dump_path
gc_dump = "-Xlog:gc*=debug,gc+stats*=debug,gc+ergo*=debug:" + gc_dump_path + ":uptime,time,level,tags"

out_of_mem_dump = ""
if oom_path:
Expand Down
1 change: 1 addition & 0 deletions modules/ducktests/tests/ignitetest/utils/ignite_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# globals:
JFR_ENABLED = "jfr_enabled"
IGNITE_TEST_CONTEXT_CLASS_KEY_NAME = "IgniteTestContext"
SAFEPOINT_LOGS_ENABLED = "safepoint_log_enabled"


class IgniteTestContext(TestContext):
Expand Down