apache-ignite

Форк
0
77 строк · 2.9 Кб
1
# Licensed to the Apache Software Foundation (ASF) under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#    http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15

16
"""
17
Checks JVM settings.
18
"""
19

20
import pytest
21

22
from ignitetest.services.utils.jvm_utils import create_jvm_settings, merge_jvm_settings, DEFAULT_HEAP
23

24

25
class CheckJVMSettings:
26
    """
27
    Checks behavior of various tools.
28
    """
29

30
    def check_list(self):
31
        """
32
        Checks list representation of JVM settings.
33
        """
34
        jvm_settings = create_jvm_settings()
35

36
        assert "-Xms" + DEFAULT_HEAP in jvm_settings
37
        assert "-Xmx" + DEFAULT_HEAP in jvm_settings
38

39
        jvm_settings = merge_jvm_settings(jvm_settings, additionals="-Xms981M -Xmx981M")
40

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
45

46
        jvm_settings = merge_jvm_settings(jvm_settings, additionals="-XX:ParallelGCThreads=1024")
47
        jvm_settings = merge_jvm_settings(jvm_settings, additionals="-xx:ParallelGCThreads=512")
48

49
        assert "-XX:ParallelGCThreads=1024" in jvm_settings
50
        assert "-XX:ParallelGCThreads=512" not in jvm_settings
51

52
    @pytest.mark.parametrize(
53
        'settings,additionals,expected',
54
        [
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}],
58
            [
59
                ['-Xmx5G', '-Xms512m', '-XX:ParallelGCThreads=1024'],
60
                ['-Xmx10G', '-Xms1G', '-XX:ParallelGCThreads=512'],
61
                {'-Xmx10G': 1, '-Xms1G': 1, '-XX:ParallelGCThreads=512': 1}
62
            ],
63
            [['-Xmx5G', '-Xms512m', '-ea'], ['-Xmx10G', '-Xms1G', '-ea'], {'-Xmx10G': 1, '-Xms1G': 1, '-ea': 1}],
64
        ]
65
    )
66
    def check_merge_jvm_settings(self, settings, additionals, expected):
67
        """
68
        Tests different variants of merge jvm settings.
69
        """
70
        res = {}
71
        for param in merge_jvm_settings(settings, additionals=additionals):
72
            if param in res:
73
                res[param] += 1
74
            else:
75
                res[param] = 1
76

77
        assert res == expected
78

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.