17
Checks Spec class that describes config and command line to start Ignite-aware service.
19
from unittest.mock import Mock
23
from ignitetest.services.utils.ignite_spec import IgniteApplicationSpec
24
from ignitetest.utils.ignite_test import JFR_ENABLED
30
Create mock of service.
34
service.persistent_root = ''
35
service.context.globals = {"cluster_size": 1}
36
service.log_config_file = ''
42
Checks that the JVM options passed via constructor are not overriden by the default ones.
46
def check_default_options__are_used__if_jvm_opts_is_not_passed(service):
47
spec = IgniteApplicationSpec(service)
48
assert "-DIGNITE_NO_SHUTDOWN_HOOK=true" in spec.jvm_opts
49
assert "-Dlog4j.configDebug=true" in spec.jvm_opts
52
def check_default_options__are_overriden__if_passed_as_jvm_opts_string(service):
53
spec_with_default = IgniteApplicationSpec(service)
54
spec_with_default_overriden = IgniteApplicationSpec(service, jvm_opts="-Dlog4j.configDebug=false")
55
assert "-Dlog4j.configDebug=true" in spec_with_default.jvm_opts
56
assert "-Dlog4j.configDebug=true" not in spec_with_default_overriden.jvm_opts
58
assert "-Dlog4j.configDebug=false" not in spec_with_default.jvm_opts
59
assert "-Dlog4j.configDebug=false" in spec_with_default_overriden.jvm_opts
62
def check_default_options__are_overriden__if_passed_as_jvm_opts_list(service):
63
spec_with_default = IgniteApplicationSpec(service)
64
spec_with_default_overriden = IgniteApplicationSpec(service, jvm_opts=["-Dlog4j.configDebug=false"])
65
assert "-Dlog4j.configDebug=true" in spec_with_default.jvm_opts
66
assert "-Dlog4j.configDebug=true" not in spec_with_default_overriden.jvm_opts
68
assert "-Dlog4j.configDebug=false" not in spec_with_default.jvm_opts
69
assert "-Dlog4j.configDebug=false" in spec_with_default_overriden.jvm_opts
72
def check_default_jvm_options__are_not_used__if_merge_with_default_is_false(service):
73
spec = IgniteApplicationSpec(service, jvm_opts="-Xmx256m -ea", merge_with_default=False)
74
assert "-Xmx256m" in spec.jvm_opts
75
assert "-ea" in spec.jvm_opts
76
assert len(spec.jvm_opts) == 2
78
spec = IgniteApplicationSpec(service, merge_with_default=False)
79
assert len(spec.jvm_opts) == 0
82
def check_boolean_options__go_after_default_ones_and_overwrite_them__if_passed_via_jvm_opt(service):
83
service.context.globals[JFR_ENABLED] = True
84
spec = IgniteApplicationSpec(service, jvm_opts="-XX:-UnlockCommercialFeatures")
85
assert "-XX:-UnlockCommercialFeatures" in spec.jvm_opts
86
assert "-XX:-UnlockCommercialFeatures" in spec.jvm_opts
87
assert spec.jvm_opts.index("-XX:-UnlockCommercialFeatures") >\
88
spec.jvm_opts.index("-XX:+UnlockCommercialFeatures")
91
def check_colon_options__go_after_default_ones_and_overwrite_them__if_passed_via_jvm_opt(service):
92
service.log_dir = "/default-path"
93
spec = IgniteApplicationSpec(service, jvm_opts=["-Xloggc:/some-non-default-path/gc.log"])
94
assert "-Xloggc:/some-non-default-path/gc.log" in spec.jvm_opts
95
assert "-Xloggc:/default-path/gc.log" in spec.jvm_opts
96
assert spec.jvm_opts.index("-Xloggc:/some-non-default-path/gc.log") > \
97
spec.jvm_opts.index("-Xloggc:/default-path/gc.log")