Skip to content

Conversation

@unknowntpo
Copy link
Contributor

@unknowntpo unknowntpo commented Nov 15, 2025

Use /etc/environment instead of ~/.ssh/environment to set PATH.

If we use eclipse-temurin:17-jdk-jammy to run e2e tests:

jdk_version="eclipse-temurin:17-jdk-jammy" \
image_name="ducker-ak:$(git rev-parse --short HEAD)" \
TC_PATHS="tests/kafkatest/tests/client/pluggable_test.py" \
/bin/bash tests/docker/run_tests.sh

we will get:

test_id:
kafkatest.tests.client.pluggable_test.PluggableConsumerTest.test_start_stop.metadata_quorum=ISOLATED_KRAFT
status:     FAIL
run time:   3.241 seconds

    RemoteCommandError({'ssh_config': {'host': 'ducker02', 'hostname':
'ducker02', 'user': 'ducker', 'port': 22, 'password': '',
'identityfile': '/home/ducker/.ssh/id_rsa', 'connecttimeout': None},
'hostname': 'ducker02', 'ssh_hostname': 'ducker02', 'user': 'ducker',
'externally_routable_ip': 'ducker02', '_logger': <Logger
kafkatest.tests.client.pluggable_test.PluggableConsumerTest.test_start_stop.metadata_quorum=ISOLATED_KRAFT-1
(DEBUG)>, 'os': 'linux', '_ssh_client': <paramiko.client.SSHClient
object at 0xffffb95fdae0>, '_sftp_client':
<paramiko.sftp_client.SFTPClient object at 0xffffb95feef0>,
'_custom_ssh_exception_checks': None}, 'java -version', 127, b'')
Traceback (most recent call last):
  File
"/usr/local/lib/python3.10/dist-packages/ducktape/tests/runner_client.py",
line 350, in _do_run
    self.setup_test()
  File
"/usr/local/lib/python3.10/dist-packages/ducktape/tests/runner_client.py",
line 402, in setup_test
    self.test.setup()
  File "/usr/local/lib/python3.10/dist-packages/ducktape/tests/test.py",
line 74, in setup
    self.setUp()
  File "/opt/kafka-dev/tests/kafkatest/tests/kafka_test.py", line 47, in
setUp
    self.kafka.start()
  File "/opt/kafka-dev/tests/kafkatest/services/kafka/kafka.py", line
651, in start
self.isolated_controller_quorum.start(nodes_to_skip=isolated_controllers_to_skip)
  File "/opt/kafka-dev/tests/kafkatest/services/kafka/kafka.py", line
653, in start
    Service.start(self, **kwargs)
  File
"/usr/local/lib/python3.10/dist-packages/ducktape/services/service.py",
line 265, in start
    self.start_node(node, **kwargs)
  File "/opt/kafka-dev/tests/kafkatest/services/kafka/kafka.py", line
854, in start_node
    self.security_config.setup_node(node)
  File
"/opt/kafka-dev/tests/kafkatest/services/security/security_config.py",
line 335, in setup_node
    if java_version(node) <= 11 and self.properties.get('tls.version')
== 'TLSv1.3':
  File "/opt/kafka-dev/tests/kafkatest/utils/remote_account.py", line
44, in java_version
    for line in node.account.ssh_capture("java -version"):
  File
"/usr/local/lib/python3.10/dist-packages/ducktape/cluster/remoteaccount.py",
line 697, in next
    return next(self.iter_obj)
  File
"/usr/local/lib/python3.10/dist-packages/ducktape/cluster/remoteaccount.py",
line 364, in output_generator
    raise RemoteCommandError(self, cmd, exit_status, stderr.read())
ducktape.cluster.remoteaccount.RemoteCommandError: ducker@ducker02:
Command 'java -version' returned non-zero exit status 127.

The reason is that ducktape use paramiko.SSHClient to execute ssh
command. But doesn't load ~/.ssh/environment, causing 'java -version'
to fail with exit code 127 in ducktape tests.

Use /etc/environment instead of ~/.ssh/environment to set PATH.
Paramiko's exec_command() doesn't load ~/.ssh/environment, causing
'java -version' to fail with exit code 127 in ducktape tests.
@github-actions github-actions bot added triage PRs from the community tests Test fixes (including flaky tests) small Small PRs labels Nov 15, 2025
@unknowntpo unknowntpo changed the title Fix Java PATH for ducktape SSH sessions MINOR: fix ssh problem in e2e Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small Small PRs tests Test fixes (including flaky tests) triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant