This is an automated email from the ASF dual-hosted git repository. nizhikov pushed a commit to branch ignite-ducktape in repository https://gitbox.apache.org/repos/asf/ignite.git
commit 2d57713cf88ec3d287e9a5fe10ee7d8f3dd580df Author: Nikolay Izhikov <[email protected]> AuthorDate: Wed May 6 17:42:41 2020 +0300 ignite-ducktape: cleaning garbage. --- tests/ignitetest/services/ignite/__init__.py | 2 - tests/ignitetest/services/ignite/ignite.py | 2 +- tests/ignitetest/services/ignite/util.py | 37 ------- tests/ignitetest/utils/__init__.py | 16 ---- tests/ignitetest/utils/remote_account.py | 41 -------- tests/ignitetest/utils/util.py | 138 --------------------------- 6 files changed, 1 insertion(+), 235 deletions(-) diff --git a/tests/ignitetest/services/ignite/__init__.py b/tests/ignitetest/services/ignite/__init__.py index 6377f9e..ec20143 100644 --- a/tests/ignitetest/services/ignite/__init__.py +++ b/tests/ignitetest/services/ignite/__init__.py @@ -12,5 +12,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -from ignite import IgniteService \ No newline at end of file diff --git a/tests/ignitetest/services/ignite/ignite.py b/tests/ignitetest/services/ignite/ignite.py index 16b87fe..1107ffe 100644 --- a/tests/ignitetest/services/ignite/ignite.py +++ b/tests/ignitetest/services/ignite/ignite.py @@ -86,7 +86,7 @@ class IgniteService(Service): wait_for_message = "Topology snapshot" if wait_for_rebalance: - wait_for_message = "Completed (final) rebalancing [grp=test-cache" + wait_for_message = "Completed (final) rebalancing \[grp=test-cache" with node.account.monitor_log(IgniteService.STDOUT_STDERR_CAPTURE) as monitor: node.account.ssh(cmd) diff --git a/tests/ignitetest/services/ignite/util.py b/tests/ignitetest/services/ignite/util.py deleted file mode 100644 index bbd63e7..0000000 --- a/tests/ignitetest/services/ignite/util.py +++ /dev/null @@ -1,37 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os.path - -from collections import namedtuple - -def java_version(node): - # Determine java version on the node - version = -1 - for line in node.account.ssh_capture("java -version"): - if line.find("version") != -1: - version = parse_version_str(line) - return version - -def parse_version_str(line): - # Parse java version string. Examples: - #`openjdk version "11.0.5" 2019-10-15` will return 11. - #`java version "1.5.0"` will return 5. - line = line[line.find('version \"') + 9:] - dot_pos = line.find(".") - if line[:dot_pos] == "1": - return int(line[dot_pos+1:line.find(".", dot_pos+1)]) - else: - return int(line[:dot_pos]) diff --git a/tests/ignitetest/utils/__init__.py b/tests/ignitetest/utils/__init__.py deleted file mode 100644 index d753d8e..0000000 --- a/tests/ignitetest/utils/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from util import ignitetest_version, is_int, is_int_with_prefix, node_is_reachable, validate_delivery diff --git a/tests/ignitetest/utils/remote_account.py b/tests/ignitetest/utils/remote_account.py deleted file mode 100644 index e838a96..0000000 --- a/tests/ignitetest/utils/remote_account.py +++ /dev/null @@ -1,41 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -def file_exists(node, file): - """Quick and dirty check for existence of remote file.""" - try: - node.account.ssh("cat " + file, allow_fail=False) - return True - except: - return False - - -def path_exists(node, path): - """Quick and dirty check for existence of remote path.""" - try: - node.account.ssh("ls " + path, allow_fail=False) - return True - except: - return False - - -def line_count(node, file): - """Return the line count of file on node""" - out = [line for line in node.account.ssh_capture("wc -l %s" % file)] - if len(out) != 1: - raise Exception("Expected single line of output from wc -l") - - return int(out[0].strip().split(" ")[0]) diff --git a/tests/ignitetest/utils/util.py b/tests/ignitetest/utils/util.py deleted file mode 100644 index 0bb22eb..0000000 --- a/tests/ignitetest/utils/util.py +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 2015 Confluent Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ignitetest import __version__ as __ignitetest_version__ - -import math -import re -import time - - -def ignitetest_version(): - """Return string representation of current ducktape version.""" - return __ignitetest_version__ - - -def is_int(msg): - """Method used to check whether the given message is an integer - - return int or raises an exception if message is not an integer - """ - try: - return int(msg) - except ValueError: - raise Exception("Unexpected message format (expected an integer). Message: %s" % (msg)) - - -def is_int_with_prefix(msg): - """ - Method used check whether the given message is of format 'integer_prefix'.'integer_value' - - :param msg: message to validate - :return: msg or raises an exception is a message is of wrong format - """ - try: - parts = msg.split(".") - if len(parts) != 2: - raise Exception("Unexpected message format. Message should be of format: integer " - "prefix dot integer value. Message: %s" % (msg)) - int(parts[0]) - int(parts[1]) - return msg - except ValueError: - raise Exception("Unexpected message format. Message should be of format: integer " - "prefix dot integer value, but one of the two parts (before or after dot) " - "are not integers. Message: %s" % (msg)) - - -def node_is_reachable(src_node, dst_node): - """ - Returns true if a node is unreachable from another node. - - :param src_node: The source node to check from reachability from. - :param dst_node: The destination node to check for reachability to. - :return: True only if dst is reachable from src. - """ - return 0 == src_node.account.ssh("nc -w 3 -z %s 22" % dst_node.account.hostname, allow_fail=True) - - -def annotate_missing_msgs(missing, acked, consumed, msg): - missing_list = list(missing) - msg += "%s acked message did not make it to the Consumer. They are: " %\ - len(missing_list) - if len(missing_list) < 20: - msg += str(missing_list) + ". " - else: - msg += ", ".join(str(m) for m in missing_list[:20]) - msg += "...plus %s more. Total Acked: %s, Total Consumed: %s. " \ - % (len(missing_list) - 20, len(set(acked)), len(set(consumed))) - return msg - - -def annotate_data_lost(data_lost, msg, number_validated): - print_limit = 10 - if len(data_lost) > 0: - msg += "The first %s missing messages were validated to ensure they are in Kafka's data files. " \ - "%s were missing. This suggests data loss. Here are some of the messages not found in the data files: %s\n" \ - % (number_validated, len(data_lost), str(data_lost[0:print_limit]) if len(data_lost) > print_limit else str(data_lost)) - else: - msg += "We validated that the first %s of these missing messages correctly made it into Kafka's data files. " \ - "This suggests they were lost on their way to the consumer." % number_validated - return msg - - -def validate_delivery(acked, consumed, idempotence_enabled=False, check_lost_data=None, may_truncate_acked_records=False): - """Check that each acked message was consumed.""" - success = True - msg = "" - - # Correctness of the set difference operation depends on using equivalent - # message_validators in producer and consumer - missing = set(acked) - set(consumed) - - # Were all acked messages consumed? - if len(missing) > 0: - msg = annotate_missing_msgs(missing, acked, consumed, msg) - - # Did we miss anything due to data loss? - if check_lost_data: - max_truncate_count = 100 if may_truncate_acked_records else 0 - max_validate_count = max(1000, max_truncate_count) - - to_validate = list(missing)[0:min(len(missing), max_validate_count)] - data_lost = check_lost_data(to_validate) - - # With older versions of message format before KIP-101, data loss could occur due to truncation. - # These records won't be in the data logs. Tolerate limited data loss for this case. - if len(missing) < max_truncate_count and len(data_lost) == len(missing): - msg += "The %s missing messages were not present in Kafka's data files. This suggests data loss " \ - "due to truncation, which is possible with older message formats and hence are ignored " \ - "by this test. The messages lost: %s\n" % (len(data_lost), str(data_lost)) - else: - msg = annotate_data_lost(data_lost, msg, len(to_validate)) - success = False - else: - success = False - - # Are there duplicates? - if len(set(consumed)) != len(consumed): - num_duplicates = abs(len(set(consumed)) - len(consumed)) - - if idempotence_enabled: - success = False - msg += "Detected %d duplicates even though idempotence was enabled.\n" % num_duplicates - else: - msg += "(There are also %d duplicate messages in the log - but that is an acceptable outcome)\n" % num_duplicates - - return success, msg
