22
from ignitetest.services.utils.jvm_utils import create_jvm_settings, merge_jvm_settings, DEFAULT_HEAP
25
class CheckJVMSettings:
27
Checks behavior of various tools.
32
Checks list representation of JVM settings.
34
jvm_settings = create_jvm_settings()
36
assert "-Xms" + DEFAULT_HEAP in jvm_settings
37
assert "-Xmx" + DEFAULT_HEAP in jvm_settings
39
jvm_settings = merge_jvm_settings(jvm_settings, additionals="-Xms981M -Xmx981M")
41
assert "-Xms981M" in jvm_settings
42
assert "-Xmx981M" in jvm_settings
43
assert "-Xms" + DEFAULT_HEAP not in jvm_settings
44
assert "-Xmx" + DEFAULT_HEAP not in jvm_settings
46
jvm_settings = merge_jvm_settings(jvm_settings, additionals="-XX:ParallelGCThreads=1024")
47
jvm_settings = merge_jvm_settings(jvm_settings, additionals="-xx:ParallelGCThreads=512")
49
assert "-XX:ParallelGCThreads=1024" in jvm_settings
50
assert "-XX:ParallelGCThreads=512" not in jvm_settings
52
@pytest.mark.parametrize(
53
'settings,additionals,expected',
55
[['-Xmx10G, -Xms1G'], ['-Xmx5G', '-Xms512m'], {'-Xmx5G': 1, '-Xms512m': 1}],
56
[['-Xmx5G', '-Xms512m'], ['-Xmx10G', '-Xms1G'], {'-Xmx10G': 1, '-Xms1G': 1}],
57
[['-Xmx10G, -Xms1G'], ['-Xmx5G', '-Xms512m'], {'-Xmx5G': 1, '-Xms512m': 1}],
59
['-Xmx5G', '-Xms512m', '-XX:ParallelGCThreads=1024'],
60
['-Xmx10G', '-Xms1G', '-XX:ParallelGCThreads=512'],
61
{'-Xmx10G': 1, '-Xms1G': 1, '-XX:ParallelGCThreads=512': 1}
63
[['-Xmx5G', '-Xms512m', '-ea'], ['-Xmx10G', '-Xms1G', '-ea'], {'-Xmx10G': 1, '-Xms1G': 1, '-ea': 1}],
66
def check_merge_jvm_settings(self, settings, additionals, expected):
68
Tests different variants of merge jvm settings.
71
for param in merge_jvm_settings(settings, additionals=additionals):
77
assert res == expected