Skip to content

Commit

Permalink
Merge pull request redpanda-data#23277 from redpanda-data/clee/PESDLC…
Browse files Browse the repository at this point in the history
…-1438

[rptest] unbreak Azure T4/T5 tests
  • Loading branch information
ivotron authored Dec 6, 2024
2 parents aa91926 + 85b0d80 commit cfabd3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions tests/rptest/clients/kubectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,13 @@ class KubeNodeShell():
def __init__(self,
kubectl: KubectlTool,
node_name: str,
namespace: str = 'redpanda-node-setup',
clean=False) -> None:
self.kubectl = kubectl
self.node_name = node_name
# It is bad, but it works
self.logger = self.kubectl._redpanda.logger
self.namespace = namespace
self.current_context = self.kubectl.cmd(
f"config current-context").strip()
# Make sure that name is not longer that 63 chars
Expand Down Expand Up @@ -528,6 +530,7 @@ def initialize_nodeshell(self):
# Feel free to uncomment
_out = self.kubectl.cmd([
f"--context={self.current_context}",
f"--namespace={self.namespace}",
"run",
"--image docker.io/library/alpine",
"--restart=Never",
Expand All @@ -541,7 +544,8 @@ def initialize_nodeshell(self):
def destroy_nodeshell(self):
if self._is_shell_running():
try:
self.kubectl.cmd(f"delete pod {self.pod_name}")
self.kubectl.cmd(
f"-n {self.namespace} delete pod {self.pod_name}")
except Exception as e:
self.logger.warning("Failed to delete node shell pod "
f"'{self.pod_name}': {e}")
Expand All @@ -558,7 +562,7 @@ def __exit__(self, *args, **kwargs):
def __call__(self, cmd: list[str] | str, capture=False):
self.logger.info(f"Running command inside node '{self.node_name}'")
# Prefix for running inside proper pod
_kcmd = ["exec", self.pod_name, "--"]
_kcmd = ["-n", f"{self.namespace}", "exec", self.pod_name, "--"]
# Universal for list and str
_cmd = cmd if isinstance(cmd, list) else cmd.split()
_kcmd += _cmd
Expand Down
2 changes: 1 addition & 1 deletion tests/rptest/services/cloud_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def inject_script(self, script_name):
# Copy agent -> broker node
remote_path = os.path.join("/tmp", script_name)
_cp_cmd = self._kubeclient._ssh_prefix() + [
'kubectl', 'cp', script_name,
'kubectl', '-n', 'redpanda-node-setup', 'cp', script_name,
f"{self.nodeshell.pod_name}:{remote_path}"
]
self.logger.debug(_cp_cmd)
Expand Down

0 comments on commit cfabd3c

Please sign in to comment.