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 d42ff0239c11c097991aace1a70fd22ff6e6829f Author: Nikolay Izhikov <[email protected]> AuthorDate: Thu Apr 9 14:23:08 2020 +0300 ignite-ducktape: WIP. --- tests/docker/Dockerfile | 7 +- tests/docker/build/cluster.json | 6 +- tests/docker/build/node_hosts | 28 ++--- tests/docker/ducker-ignite | 18 ++-- tests/docker/run_tests.sh | 6 +- tests/ignitetest/__init__.py | 4 +- .../rebalance/add_node_rebalance_test.py} | 34 ++++--- .../services/__init__.py} | 15 --- .../services/ignite/__init__.py} | 16 +-- tests/ignitetest/services/ignite/ignite.py | 113 +++++++++++++++++++++ .../services/ignite/util.py} | 33 +++--- .../run_tests.sh => ignitetest/tests/__init__.py} | 16 --- .../tests/ignite_test.py} | 31 +++--- tests/ignitetest/version.py | 106 ++++--------------- 14 files changed, 229 insertions(+), 204 deletions(-) diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile index d0135e4..eb53d8c 100644 --- a/tests/docker/Dockerfile +++ b/tests/docker/Dockerfile @@ -45,8 +45,11 @@ RUN echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config # Install binary test dependencies. # we use the same versions as in vagrant/base.sh ARG IGNITE_MIRROR="https://apache-mirror.rbc.ru/pub/apache/" -ARG ARCHIVE_NAME="apache-ignite-2.8.0-bin.zip" -RUN mkdir -p "/opt/ignite-2.8.0" && chmod a+rw /opt/ignite-2.8.0 && cd /opt && curl -s "$IGNITE_MIRROR/ignite/2.8.0/$ARCHIVE_NAME" > /opt/$ARCHIVE_NAME && unzip /opt/ +ARG RELEASE_NAME="apache-ignite-2.8.0-bin" +RUN chmod a+wr /opt +RUN curl -s "$IGNITE_MIRROR/ignite/2.8.0/$RELEASE_NAME.zip" > /opt/$RELEASE_NAME.zip +RUN cd /opt && unzip $RELEASE_NAME.zip +RUN chmod a+wr /opt/$RELEASE_NAME -R # The version of Kibosh to use for testing. # If you update this, also update vagrant/base.sh diff --git a/tests/docker/build/cluster.json b/tests/docker/build/cluster.json index 3597cac..e0de330 100644 --- a/tests/docker/build/cluster.json +++ b/tests/docker/build/cluster.json @@ -37,8 +37,10 @@ "port": 22, "user": "ducker" } - }, - { + } + ] +} + "externally_routable_ip": "ducker04", "ssh_config": { "host": "ducker04", diff --git a/tests/docker/build/node_hosts b/tests/docker/build/node_hosts index 73a0745..291afdf 100644 --- a/tests/docker/build/node_hosts +++ b/tests/docker/build/node_hosts @@ -1,14 +1,14 @@ -172.21.0.2 ducker01 -172.21.0.3 ducker02 -172.21.0.4 ducker03 -172.21.0.5 ducker04 -172.21.0.6 ducker05 -172.21.0.7 ducker06 -172.21.0.8 ducker07 -172.21.0.9 ducker08 -172.21.0.10 ducker09 -172.21.0.11 ducker10 -172.21.0.12 ducker11 -172.21.0.13 ducker12 -172.21.0.14 ducker13 -172.21.0.15 ducker14 +172.18.0.2 ducker01 +172.18.0.3 ducker02 +172.18.0.4 ducker03 +172.26.0.5 ducker04 +172.26.0.6 ducker05 +172.26.0.7 ducker06 +172.26.0.8 ducker07 +172.26.0.9 ducker08 +172.26.0.10 ducker09 +172.26.0.11 ducker10 +172.26.0.12 ducker11 +172.26.0.13 ducker12 +172.26.0.14 ducker13 +172.26.0.15 ducker14 diff --git a/tests/docker/ducker-ignite b/tests/docker/ducker-ignite index 6ea13a0..2a90c04 100755 --- a/tests/docker/ducker-ignite +++ b/tests/docker/ducker-ignite @@ -45,7 +45,7 @@ default_num_nodes=14 default_jdk="openjdk:8" # The default ducker-ignite image name. -default_image_name="ducker-ak" +default_image_name="ducker-ignite" # Display a usage message on the terminal and exit. # @@ -53,7 +53,7 @@ default_image_name="ducker-ak" usage() { local exit_status="${1}" cat <<EOF -ducker-ak: a tool for running Apache Ignite tests inside Docker images. +ducker-ignite: a tool for running Apache Ignite tests inside Docker images. Usage: ${script_path} [command] [options] @@ -78,7 +78,7 @@ up [-n|--num-nodes NUM_NODES] [-f|--force] [docker-image] test [test-name(s)] Run a test or set of tests inside the currently active Ducker nodes. For example, to run the system test produce_bench_test, you would run: - ./tests/docker/ducker-ak test ./tests/ignitetest/test/core/rebalance_test.py + ./tests/docker/ducker-ignite test ./tests/ignitetest/test/core/rebalance_test.py ssh [node-name|user-name@node-name] [command] Log in to a running ducker container. If node-name is not given, it prints @@ -89,12 +89,12 @@ ssh [node-name|user-name@node-name] [command] shell. down [-q|--quiet] [-f|--force] - Tear down all the currently active ducker-ak nodes. If --quiet is specified, + Tear down all the currently active ducker-ignite nodes. If --quiet is specified, only error messages are printed. If --force or -f is specified, "docker rm -f" - will be used to remove the nodes, which kills currently running ducker-ak test. + will be used to remove the nodes, which kills currently running ducker-ignite test. purge [--f|--force] - Purge Docker images created by ducker-ak. This will free disk space. + Purge Docker images created by ducker-ignite. This will free disk space. If --force is set, we run 'docker rmi -f'. EOF exit "${exit_status}" @@ -429,14 +429,14 @@ ducker_test() { for arg in "${@}"; do local regex=".*\/ignitetest\/(.*)" if [[ $arg =~ $regex ]]; then - local kpath=${BASH_REMATCH[1]} - args="${args} ./tests/ignitetest/${kpath}" + local ignpath=${BASH_REMATCH[1]} + args="${args} ./tests/ignitetest/${ignpath}" else args="${args} ${arg}" fi done must_pushd "${ignite_dir}" - (test -f ./gradlew || gradle) && ./gradlew systemTestLibs + #(test mvn) && mvn package -DskipTests -Dmaven.javadoc.skip=true -Plgpl,-examples,-clean-libs,-release,-scala,-clientDocs must_popd cmd="cd /opt/ignite-dev && ducktape --cluster-file /opt/ignite-dev/tests/docker/build/cluster.json $args" echo "docker exec ducker01 bash -c \"${cmd}\"" diff --git a/tests/docker/run_tests.sh b/tests/docker/run_tests.sh index 09c6797..96064bf 100755 --- a/tests/docker/run_tests.sh +++ b/tests/docker/run_tests.sh @@ -16,7 +16,7 @@ # limitations under the License. SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -IGNITE_NUM_CONTAINERS=${IGNITE_NUM_CONTAINERS:-14} +IGNITE_NUM_CONTAINERS=${IGNITE_NUM_CONTAINERS:-3} TC_PATHS=${TC_PATHS:-./ignitetest/} die() { @@ -25,6 +25,6 @@ die() { } if ${SCRIPT_DIR}/ducker-ignite ssh | grep -q '(none)'; then - ${SCRIPT_DIR}/ducker-ignite up -n "${IGNITE_NUM_CONTAINERS}" || die "ducker-ak up failed" + ${SCRIPT_DIR}/ducker-ignite up -n "${IGNITE_NUM_CONTAINERS}" || die "ducker-ignite up failed" fi -${SCRIPT_DIR}/ducker-ignite test ${TC_PATHS} ${_DUCKTAPE_OPTIONS} || die "ducker-ak test failed" +${SCRIPT_DIR}/ducker-ignite test ${TC_PATHS} ${_DUCKTAPE_OPTIONS} || die "ducker-ignite test failed" diff --git a/tests/ignitetest/__init__.py b/tests/ignitetest/__init__.py index c5862fe..a4b3d8c 100644 --- a/tests/ignitetest/__init__.py +++ b/tests/ignitetest/__init__.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This determines the version of kafkatest that can be published to PyPi and installed with pip +# This determines the version of ignitetest that can be published to PyPi and installed with pip # -# Note that in development, this version name can't follow Kafka's convention of having a trailing "-SNAPSHOT" +# Note that in development, this version name can't follow Ignite's convention of having a trailing "-SNAPSHOT" # due to python version naming restrictions, which are enforced by python packaging tools # (see https://www.python.org/dev/peps/pep-0440/) # diff --git a/tests/docker/run_tests.sh b/tests/ignitetest/rebalance/add_node_rebalance_test.py old mode 100755 new mode 100644 similarity index 53% copy from tests/docker/run_tests.sh copy to tests/ignitetest/rebalance/add_node_rebalance_test.py index 09c6797..501bf42 --- a/tests/docker/run_tests.sh +++ b/tests/ignitetest/rebalance/add_node_rebalance_test.py @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - # 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. @@ -15,16 +13,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -IGNITE_NUM_CONTAINERS=${IGNITE_NUM_CONTAINERS:-14} -TC_PATHS=${TC_PATHS:-./ignitetest/} +from ignitetest.tests.ignite_test import IgniteTest + + +class AddNodeRebalanceTest(IgniteTest): + """ + Test performs rebalance tests. + """ + def __init__(self, test_context): + super(IgniteTest, self).__init__(test_context) -die() { - echo $@ - exit 1 -} + def teardown(self): + self.ignite.stop() -if ${SCRIPT_DIR}/ducker-ignite ssh | grep -q '(none)'; then - ${SCRIPT_DIR}/ducker-ignite up -n "${IGNITE_NUM_CONTAINERS}" || die "ducker-ak up failed" -fi -${SCRIPT_DIR}/ducker-ignite test ${TC_PATHS} ${_DUCKTAPE_OPTIONS} || die "ducker-ak test failed" + def test_add_node(self): + """ + Test performs add node rebalance test which consists of following steps: + * Start cluster. + * Put data to it via CacheDataProducer. + * Start one more node. + * Await for rebalance to finish. + """ + for node in self.ignite.nodes: + node.account.ssh("touch /opt/hello-from-test.txt") diff --git a/tests/docker/run_tests.sh b/tests/ignitetest/services/__init__.py old mode 100755 new mode 100644 similarity index 62% copy from tests/docker/run_tests.sh copy to tests/ignitetest/services/__init__.py index 09c6797..e556dc9 --- a/tests/docker/run_tests.sh +++ b/tests/ignitetest/services/__init__.py @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - # 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. @@ -15,16 +13,3 @@ # See the License for the specific language governing permissions and # limitations under the License. -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -IGNITE_NUM_CONTAINERS=${IGNITE_NUM_CONTAINERS:-14} -TC_PATHS=${TC_PATHS:-./ignitetest/} - -die() { - echo $@ - exit 1 -} - -if ${SCRIPT_DIR}/ducker-ignite ssh | grep -q '(none)'; then - ${SCRIPT_DIR}/ducker-ignite up -n "${IGNITE_NUM_CONTAINERS}" || die "ducker-ak up failed" -fi -${SCRIPT_DIR}/ducker-ignite test ${TC_PATHS} ${_DUCKTAPE_OPTIONS} || die "ducker-ak test failed" diff --git a/tests/docker/run_tests.sh b/tests/ignitetest/services/ignite/__init__.py old mode 100755 new mode 100644 similarity index 62% copy from tests/docker/run_tests.sh copy to tests/ignitetest/services/ignite/__init__.py index 09c6797..6377f9e --- a/tests/docker/run_tests.sh +++ b/tests/ignitetest/services/ignite/__init__.py @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - # 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. @@ -15,16 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -IGNITE_NUM_CONTAINERS=${IGNITE_NUM_CONTAINERS:-14} -TC_PATHS=${TC_PATHS:-./ignitetest/} - -die() { - echo $@ - exit 1 -} - -if ${SCRIPT_DIR}/ducker-ignite ssh | grep -q '(none)'; then - ${SCRIPT_DIR}/ducker-ignite up -n "${IGNITE_NUM_CONTAINERS}" || die "ducker-ak up failed" -fi -${SCRIPT_DIR}/ducker-ignite test ${TC_PATHS} ${_DUCKTAPE_OPTIONS} || die "ducker-ak test failed" +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 new file mode 100644 index 0000000..7db90ec --- /dev/null +++ b/tests/ignitetest/services/ignite/ignite.py @@ -0,0 +1,113 @@ +# 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 +import signal + +from ducktape.services.service import Service +from ducktape.utils.util import wait_until +from ducktape.cluster.remoteaccount import RemoteCommandError + +from ignitetest.version import DEV_VERSION + + +class IgniteService(Service): + PERSISTENT_ROOT = "/mnt/ignite" + CONFIG_FILE = os.path.join(PERSISTENT_ROOT, "ignite-config.xml") + HEAP_DUMP_FILE = os.path.join(PERSISTENT_ROOT, "ignite-heap.bin") + STDOUT_STDERR_CAPTURE = os.path.join(PERSISTENT_ROOT, "console.log") + + def __init__(self, + context, + num_nodes, + version=DEV_VERSION): + """ + :param context: test context + :param num_nodes: number of Ignite nodes. + """ + Service.__init__(self, context, num_nodes) + + self.log_level = "DEBUG" + + for node in self.nodes: + node.version = version + + def set_version(self, version): + for node in self.nodes: + node.version = version + + def alive(self, node): + return len(self.pids(node)) > 0 + + def start(self): + Service.start(self) + + self.logger.info("Waiting for Ignite to start...") + + def start_cmd(self, node): + cmd = "%s %s 1>> %s 2>> %s &" % \ + (self.path.script("ignite.sh", node), + IgniteService.CONFIG_FILE, + IgniteService.STDOUT_STDERR_CAPTURE, + IgniteService.STDOUT_STDERR_CAPTURE) + return cmd + + def start_node(self, node, timeout_sec=60): + node.account.mkdirs(IgniteService.PERSISTENT_ROOT) + + cmd = self.start_cmd(node) + self.logger.debug("Attempting to start IgniteService on %s with command: %s" % (str(node.account), cmd)) + with node.account.monitor_log(IgniteService.STDOUT_STDERR_CAPTURE) as monitor: + node.account.ssh(cmd) + monitor.wait_until("Ignite\s*Server.*started", timeout_sec=timeout_sec, backoff_sec=.25, + err_msg="Ignite server didn't finish startup in %d seconds" % timeout_sec) + + if len(self.pids(node)) == 0: + raise Exception("No process ids recorded on node %s" % node.account.hostname) + + def pids(self, node): + """Return process ids associated with running processes on the given node.""" + try: + cmd = "jcmd | grep -e %s | awk '{print $1}'" % self.java_class_name() + pid_arr = [pid for pid in node.account.ssh_capture(cmd, allow_fail=True, callback=int)] + return pid_arr + except (RemoteCommandError, ValueError) as e: + return [] + + def stop_node(self, node, clean_shutdown=True, timeout_sec=60): + pids = self.pids(node) + sig = signal.SIGTERM if clean_shutdown else signal.SIGKILL + + for pid in pids: + node.account.signal(pid, sig, allow_fail=False) + + try: + wait_until(lambda: len(self.pids(node)) == 0, timeout_sec=timeout_sec, + err_msg="Ignite node failed to stop in %d seconds" % timeout_sec) + except Exception: + self.thread_dump(node) + raise + + def thread_dump(self, node): + for pid in self.pids(node): + try: + node.account.signal(pid, signal.SIGQUIT, allow_fail=True) + except: + self.logger.warn("Could not dump threads on node") + + def clean_node(self, node): + node.account.kill_java_processes(self.java_class_name(), + clean_shutdown=False, allow_fail=True) + node.account.ssh("sudo rm -rf -- %s" % IgniteService.PERSISTENT_ROOT, allow_fail=False) diff --git a/tests/docker/run_tests.sh b/tests/ignitetest/services/ignite/util.py old mode 100755 new mode 100644 similarity index 53% copy from tests/docker/run_tests.sh copy to tests/ignitetest/services/ignite/util.py index 09c6797..bbd63e7 --- a/tests/docker/run_tests.sh +++ b/tests/ignitetest/services/ignite/util.py @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - # 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. @@ -15,16 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -IGNITE_NUM_CONTAINERS=${IGNITE_NUM_CONTAINERS:-14} -TC_PATHS=${TC_PATHS:-./ignitetest/} +import os.path + +from collections import namedtuple -die() { - echo $@ - exit 1 -} +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 -if ${SCRIPT_DIR}/ducker-ignite ssh | grep -q '(none)'; then - ${SCRIPT_DIR}/ducker-ignite up -n "${IGNITE_NUM_CONTAINERS}" || die "ducker-ak up failed" -fi -${SCRIPT_DIR}/ducker-ignite test ${TC_PATHS} ${_DUCKTAPE_OPTIONS} || die "ducker-ak test failed" +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/docker/run_tests.sh b/tests/ignitetest/tests/__init__.py old mode 100755 new mode 100644 similarity index 62% copy from tests/docker/run_tests.sh copy to tests/ignitetest/tests/__init__.py index 09c6797..ec20143 --- a/tests/docker/run_tests.sh +++ b/tests/ignitetest/tests/__init__.py @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - # 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. @@ -14,17 +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. - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -IGNITE_NUM_CONTAINERS=${IGNITE_NUM_CONTAINERS:-14} -TC_PATHS=${TC_PATHS:-./ignitetest/} - -die() { - echo $@ - exit 1 -} - -if ${SCRIPT_DIR}/ducker-ignite ssh | grep -q '(none)'; then - ${SCRIPT_DIR}/ducker-ignite up -n "${IGNITE_NUM_CONTAINERS}" || die "ducker-ak up failed" -fi -${SCRIPT_DIR}/ducker-ignite test ${TC_PATHS} ${_DUCKTAPE_OPTIONS} || die "ducker-ak test failed" diff --git a/tests/docker/run_tests.sh b/tests/ignitetest/tests/ignite_test.py old mode 100755 new mode 100644 similarity index 54% copy from tests/docker/run_tests.sh copy to tests/ignitetest/tests/ignite_test.py index 09c6797..c30a8fd --- a/tests/docker/run_tests.sh +++ b/tests/ignitetest/tests/ignite_test.py @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - # 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. @@ -15,16 +13,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -IGNITE_NUM_CONTAINERS=${IGNITE_NUM_CONTAINERS:-14} -TC_PATHS=${TC_PATHS:-./ignitetest/} +from ducktape.tests.test import Test + + +from ignitetest.services.ignite import IgniteService + + +class IgniteTest(Test): + """ + Helper class that manages setting up a Ignite cluster. Use this if the + default settings for Ignite are sufficient for your test; any customization + needs to be done manually. Your run() method should call tearDown and + setUp. The Ignite service are available as the fields IgniteTest.ignite. + """ + def __init__(self, test_context): + super(IgniteTest, self).__init__(test_context) -die() { - echo $@ - exit 1 -} + self.ignite = IgniteService(test_context, self.num_brokers) -if ${SCRIPT_DIR}/ducker-ignite ssh | grep -q '(none)'; then - ${SCRIPT_DIR}/ducker-ignite up -n "${IGNITE_NUM_CONTAINERS}" || die "ducker-ak up failed" -fi -${SCRIPT_DIR}/ducker-ignite test ${TC_PATHS} ${_DUCKTAPE_OPTIONS} || die "ducker-ak test failed" + def setUp(self): + self.ignite.start() \ No newline at end of file diff --git a/tests/ignitetest/version.py b/tests/ignitetest/version.py index 9509909..31ad73d 100644 --- a/tests/ignitetest/version.py +++ b/tests/ignitetest/version.py @@ -15,24 +15,25 @@ from distutils.version import LooseVersion -from ignitetest.utils import ignitetest_version +from ignitetest import __version__ -class KafkaVersion(LooseVersion): - """Container for kafka versions which makes versions simple to compare. +class IgniteVersion(LooseVersion): + """ + Container for Ignite versions which makes versions simple to compare. distutils.version.LooseVersion (and StrictVersion) has robust comparison and ordering logic. Example: - v10 = KafkaVersion("0.10.0") - v9 = KafkaVersion("0.9.0.1") - assert v10 > v9 # assertion passes! + v27 = IgniteVersion("2.7.0") + v28 = IgniteVersion("2.8.1") + assert v28 > v27 # assertion passes! """ def __init__(self, version_string): self.is_dev = (version_string.lower() == "dev") if self.is_dev: - version_string = kafkatest_version() + version_string = __version__ # Drop dev suffix if present dev_suffix_index = version_string.find(".dev") @@ -49,14 +50,10 @@ class KafkaVersion(LooseVersion): else: return LooseVersion.__str__(self) - def supports_named_listeners(self): - return self >= V_0_10_2_0 - - def topic_command_supports_bootstrap_server(self): - return self >= V_2_3_0 def get_version(node=None): - """Return the version attached to the given node. + """ + Return the version attached to the given node. Default to DEV_BRANCH if node or node.version is undefined (aka None) """ if node is not None and hasattr(node, "version") and node.version is not None: @@ -64,77 +61,12 @@ def get_version(node=None): else: return DEV_BRANCH -DEV_BRANCH = KafkaVersion("dev") -DEV_VERSION = KafkaVersion("2.6.0-SNAPSHOT") - -# 0.8.2.x versions -V_0_8_2_1 = KafkaVersion("0.8.2.1") -V_0_8_2_2 = KafkaVersion("0.8.2.2") -LATEST_0_8_2 = V_0_8_2_2 - -# 0.9.0.x versions -V_0_9_0_0 = KafkaVersion("0.9.0.0") -V_0_9_0_1 = KafkaVersion("0.9.0.1") -LATEST_0_9 = V_0_9_0_1 - -# 0.10.0.x versions -V_0_10_0_0 = KafkaVersion("0.10.0.0") -V_0_10_0_1 = KafkaVersion("0.10.0.1") -LATEST_0_10_0 = V_0_10_0_1 - -# 0.10.1.x versions -V_0_10_1_0 = KafkaVersion("0.10.1.0") -V_0_10_1_1 = KafkaVersion("0.10.1.1") -LATEST_0_10_1 = V_0_10_1_1 - -# 0.10.2.x versions -V_0_10_2_0 = KafkaVersion("0.10.2.0") -V_0_10_2_1 = KafkaVersion("0.10.2.1") -V_0_10_2_2 = KafkaVersion("0.10.2.2") -LATEST_0_10_2 = V_0_10_2_2 - -LATEST_0_10 = LATEST_0_10_2 - -# 0.11.0.x versions -V_0_11_0_0 = KafkaVersion("0.11.0.0") -V_0_11_0_1 = KafkaVersion("0.11.0.1") -V_0_11_0_2 = KafkaVersion("0.11.0.2") -V_0_11_0_3 = KafkaVersion("0.11.0.3") -LATEST_0_11_0 = V_0_11_0_3 -LATEST_0_11 = LATEST_0_11_0 - -# 1.0.x versions -V_1_0_0 = KafkaVersion("1.0.0") -V_1_0_1 = KafkaVersion("1.0.1") -V_1_0_2 = KafkaVersion("1.0.2") -LATEST_1_0 = V_1_0_2 - -# 1.1.x versions -V_1_1_0 = KafkaVersion("1.1.0") -V_1_1_1 = KafkaVersion("1.1.1") -LATEST_1_1 = V_1_1_1 - -# 2.0.x versions -V_2_0_0 = KafkaVersion("2.0.0") -V_2_0_1 = KafkaVersion("2.0.1") -LATEST_2_0 = V_2_0_1 - -# 2.1.x versions -V_2_1_0 = KafkaVersion("2.1.0") -V_2_1_1 = KafkaVersion("2.1.1") -LATEST_2_1 = V_2_1_1 - -# 2.2.x versions -V_2_2_0 = KafkaVersion("2.2.0") -V_2_2_1 = KafkaVersion("2.2.1") -V_2_2_2 = KafkaVersion("2.2.2") -LATEST_2_2 = V_2_2_2 - -# 2.3.x versions -V_2_3_0 = KafkaVersion("2.3.0") -V_2_3_1 = KafkaVersion("2.3.1") -LATEST_2_3 = V_2_3_1 - -# 2.4.x versions -V_2_4_0 = KafkaVersion("2.4.0") -LATEST_2_4 = V_2_4_0 + +DEV_BRANCH = IgniteVersion("dev") +DEV_VERSION = IgniteVersion("2.9.0-SNAPSHOT") + +# 2.7.x versions +V_2_7_6 = IgniteVersion("2.7.6") + +# 2.8.0 versions +V_2_8_0 = IgniteVersion("2.8.0")
