[DNM] wait test

Change-Id: I1ea87fd7225e85891a34e6a2f82bcfa328f0e7dd
This commit is contained in:
Ruslan Aliev 2023-07-21 19:37:19 -05:00
parent 812546c875
commit 42074956c8
2 changed files with 22 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import collections
import copy import copy
import math import math
import re import re
import subprocess
import time import time
from kubernetes import watch from kubernetes import watch
@ -343,7 +344,7 @@ class ResourceWait(ABC):
timed_out, modified, unready, found_resources = ( timed_out, modified, unready, found_resources = (
self._watch_resource_completions(timeout=deadline_remaining)) self._watch_resource_completions(timeout=deadline_remaining))
if (not found_resources) and not self.required: if not found_resources:
return None return None
if timed_out: if timed_out:
@ -405,6 +406,23 @@ class ResourceWait(ABC):
# Only watch new events. # Only watch new events.
kwargs['resource_version'] = resource_list.metadata.resource_version kwargs['resource_version'] = resource_list.metadata.resource_version
command = ['armada-go', 'wait', '--resource-type', self.resource_type,
'--namespace', self.chart_wait.release_id.namespace,
'--label-selector', self.label_selector,
'--timeout', "{}s".format(timeout)]
LOG.info('Running command=%s', command)
try:
subprocess.run( # nosec
command, check=True, universal_newlines=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
timeout=timeout)
return False, [], [], False
except subprocess.CalledProcessError as e:
raise armada_exceptions.WaitException(e)
w = watch.Watch() w = watch.Watch()
for event in w.stream(self.get_resources, **kwargs): for event in w.stream(self.get_resources, **kwargs):
event_type = event['type'].upper() event_type = event['type'].upper()

View File

@ -20,6 +20,7 @@ RUN set -ex && \
ca-certificates \ ca-certificates \
curl \ curl \
git \ git \
wget \
netbase \ netbase \
python3-dev \ python3-dev \
python3-setuptools \ python3-setuptools \
@ -92,6 +93,8 @@ COPY . ./
# Setting the version explicitly for PBR # Setting the version explicitly for PBR
ENV PBR_VERSION 0.8.0 ENV PBR_VERSION 0.8.0
RUN wget -O /usr/local/bin/armada-go https://artifacts-nc.mtn57z.cti.att.com/artifactory/cloud-images-local/armada-go/armada-go && chmod a+x /usr/local/bin/armada-go
RUN \ RUN \
chown -R armada:users . && \ chown -R armada:users . && \
python3 setup.py install python3 setup.py install