You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ni...@apache.org on 2020/05/25 08:08:27 UTC
[ignite] 12/24: ignite-ducktape: fix logging to the docker image
instead of src/ignite/work directory.
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 082b1876cd424dc594d574562a6c8a56b0d869e9
Author: Nikolay Izhikov <ni...@apache.org>
AuthorDate: Tue May 5 22:59:29 2020 +0300
ignite-ducktape: fix logging to the docker image instead of src/ignite/work directory.
---
.gitignore | 3 ++
bin/include/build-classpath.sh | 6 ++-
tests/docker/Dockerfile | 2 +-
tests/docker/build/node_hosts | 8 ++--
tests/ignitetest/ignite_utils/ignite_config.py | 54 ++++++++++++++++++++++++--
tests/ignitetest/services/ignite/ignite.py | 13 ++++++-
6 files changed, 74 insertions(+), 12 deletions(-)
diff --git a/.gitignore b/.gitignore
index cdc7065..c5415d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -107,3 +107,6 @@ packages
#NodeJs files
/modules/platforms/nodejs/node_modules
+
+/results
+.ducktape
diff --git a/bin/include/build-classpath.sh b/bin/include/build-classpath.sh
index dbcd81e..edfb267 100644
--- a/bin/include/build-classpath.sh
+++ b/bin/include/build-classpath.sh
@@ -52,8 +52,10 @@ includeToClassPath() {
IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/classes
fi
- if [ -d "${file}/target/test-classes" ]; then
- IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/test-classes
+ if [[ -z "${EXCLUDE_TEST_CLASSES}" ]]; then
+ if [ -d "${file}/target/test-classes" ]; then
+ IGNITE_LIBS=${IGNITE_LIBS}${SEP}${file}/target/test-classes
+ fi
fi
if [ -d "${file}/target/libs" ]; then
diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile
index 390d849..c94e9f3 100644
--- a/tests/docker/Dockerfile
+++ b/tests/docker/Dockerfile
@@ -32,7 +32,7 @@ ARG ducker_creator=default
LABEL ducker.creator=$ducker_creator
# Update Linux and install necessary utilities.
-RUN apt update && apt install -y sudo netcat iptables rsync unzip wget curl jq coreutils openssh-server net-tools vim python-pip python-dev libffi-dev libssl-dev cmake pkg-config libfuse-dev iperf traceroute && apt-get -y clean
+RUN apt update && apt install -y sudo netcat iptables rsync unzip wget curl jq coreutils openssh-server net-tools vim python-pip python-dev libffi-dev libssl-dev cmake pkg-config libfuse-dev iperf traceroute mc && apt-get -y clean
RUN python -m pip install -U pip==9.0.3;
RUN pip install --upgrade cffi virtualenv pyasn1 boto3 pycrypto pywinrm ipaddress enum34 && pip install --upgrade ducktape==0.7.6
diff --git a/tests/docker/build/node_hosts b/tests/docker/build/node_hosts
index 9da72b8..e1183dd 100644
--- a/tests/docker/build/node_hosts
+++ b/tests/docker/build/node_hosts
@@ -1,7 +1,7 @@
-172.26.0.2 ducker01
-172.26.0.3 ducker02
-172.26.0.4 ducker03
-172.26.0.5 ducker04
+172.22.0.2 ducker01
+172.22.0.3 ducker02
+172.22.0.4 ducker03
+172.22.0.5 ducker04
172.26.0.6 ducker05
172.26.0.7 ducker06
172.26.0.8 ducker07
diff --git a/tests/ignitetest/ignite_utils/ignite_config.py b/tests/ignitetest/ignite_utils/ignite_config.py
index 416391a..b0008a6 100644
--- a/tests/ignitetest/ignite_utils/ignite_config.py
+++ b/tests/ignitetest/ignite_utils/ignite_config.py
@@ -22,7 +22,7 @@ class IgniteConfig:
def __init__(self, project="ignite"):
self.project = project
- def render(self, work_dir):
+ def render(self, config_dir, work_dir):
return """<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
@@ -30,7 +30,55 @@ class IgniteConfig:
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="workDirectory" value="{0}" />
+ <property name="workDirectory" value="{work_dir}" />
+ <property name="gridLogger">
+ <bean class="org.apache.ignite.logger.log4j.Log4JLogger">
+ <constructor-arg type="java.lang.String" value="{config_dir}/ignite-log4j.xml"/>
+ </bean>
+ </property>
</bean>
</beans>
- """.format(work_dir)
+ """.format(config_dir=config_dir, work_dir=work_dir)
+
+ def render_log4j(self, work_dir):
+ return """<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN"
+ "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+ <appender name="CONSOLE_ERR" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.err"/>
+
+ <param name="Threshold" value="ERROR"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="[%d{{ISO8601}}][%-5p][%t][%c{{1}}] %m%n"/>
+ </layout>
+ </appender>
+
+ <category name="org.springframework">
+ <level value="WARN"/>
+ </category>
+
+ <category name="org.eclipse.jetty">
+ <level value="WARN"/>
+ </category>
+
+ <category name="org.eclipse.jetty.util.log">
+ <level value="ERROR"/>
+ </category>
+
+ <category name="org.eclipse.jetty.util.component">
+ <level value="ERROR"/>
+ </category>
+
+ <category name="com.amazonaws">
+ <level value="WARN"/>
+ </category>
+
+ <root>
+ <level value="INFO"/>
+ <appender-ref ref="CONSOLE_ERR"/>
+ </root>
+</log4j:configuration>
+ """.format(work_dir=work_dir)
diff --git a/tests/ignitetest/services/ignite/ignite.py b/tests/ignitetest/services/ignite/ignite.py
index af60986..e92508d 100644
--- a/tests/ignitetest/services/ignite/ignite.py
+++ b/tests/ignitetest/services/ignite/ignite.py
@@ -29,6 +29,7 @@ class IgniteService(IgnitePathResolverMixin, Service):
PERSISTENT_ROOT = "/mnt/ignite"
WORK_DIR = os.path.join(PERSISTENT_ROOT, "work")
CONFIG_FILE = os.path.join(PERSISTENT_ROOT, "ignite-config.xml")
+ LOG4J_CONFIG_FILE = os.path.join(PERSISTENT_ROOT, "ignite-log4j.xml")
HEAP_DUMP_FILE = os.path.join(PERSISTENT_ROOT, "ignite-heap.bin")
STDOUT_STDERR_CAPTURE = os.path.join(PERSISTENT_ROOT, "console.log")
@@ -58,8 +59,14 @@ class IgniteService(IgnitePathResolverMixin, Service):
self.logger.info("Waiting for Ignite to start...")
def start_cmd(self, node):
- cmd = "%s %s 1>> %s 2>> %s &" % \
+ jvm_opts = "-J-DIGNITE_SUCCESS_FILE=" + IgniteService.PERSISTENT_ROOT + "/success_file "
+ jvm_opts += "-J-Dlog4j.configDebug=true"
+
+ cmd = "export EXCLUDE_TEST_CLASSES=true; "
+ cmd += "export IGNITE_LOG_DIR=" + IgniteService.PERSISTENT_ROOT + "; "
+ cmd += "%s %s %s 1>> %s 2>> %s &" % \
(self.path.script("ignite.sh", node),
+ jvm_opts,
IgniteService.CONFIG_FILE,
IgniteService.STDOUT_STDERR_CAPTURE,
IgniteService.STDOUT_STDERR_CAPTURE)
@@ -67,7 +74,9 @@ class IgniteService(IgnitePathResolverMixin, Service):
def start_node(self, node, timeout_sec=180):
node.account.mkdirs(IgniteService.PERSISTENT_ROOT)
- node.account.create_file(IgniteService.CONFIG_FILE, self.config.render(IgniteService.WORK_DIR))
+ node.account.create_file(IgniteService.CONFIG_FILE,
+ self.config.render(IgniteService.PERSISTENT_ROOT, IgniteService.WORK_DIR))
+ node.account.create_file(IgniteService.LOG4J_CONFIG_FILE, self.config.render_log4j(IgniteService.WORK_DIR))
cmd = self.start_cmd(node)
self.logger.debug("Attempting to start IgniteService on %s with command: %s" % (str(node.account), cmd))