Skip to content

Commit

Permalink
Merge pull request #886 from mdujava/stable-2.14
Browse files Browse the repository at this point in the history
Backports to 2.14 stream
  • Loading branch information
dhlavac authored Nov 20, 2024
2 parents e841312 + 9cd5415 commit edb4aef
Show file tree
Hide file tree
Showing 27 changed files with 145 additions and 308 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ SHELL = /bin/bash
TB ?= short
LOGLEVEL ?= INFO

export resultsdir

ifdef WORKSPACE # Yes, this is for jenkins
resultsdir = $(WORKSPACE)
else
Expand Down
2 changes: 0 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ cfssl = "==0.0.3b243"
openshift-client = ">=2.0.1"
hyperfoil-client="*"
paramiko = "*"
docker = "*"
podman = "*"
jsondiff = "*"
weakget = "*"
flaky = "*"
Expand Down
1 change: 1 addition & 0 deletions config/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ default:
default:
kind: "SystemApicast"
rhsso:
kind: rhsso
username: admin
test_user:
username: testUser
Expand Down
3 changes: 2 additions & 1 deletion config/settings.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ default:
threescale:
name: "{DEFAULT_OPENSHIFT_THREESCALE_PROJECT}"
rhsso:
kind: rhsso # rhsso is deault for 2.14; other acceptable value is rhbk
test_user:
username: testUser
password: testUser
Expand Down Expand Up @@ -206,4 +207,4 @@ development:
resolved_images: # Dict of resolved images
amd64:
ppc64le:
s390x:
s390x:
67 changes: 0 additions & 67 deletions doc/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,70 +136,3 @@ def test_skip_apicast_retrying_on_404(application, api_client):
client = api_client(disable_retry_status_list={404})

assert client.get("/status/404").status_code == 404


################################################################################
# Example usage of DockerRuntime
def example_docker():
from testsuite.containers.docker_runtime import DockerRuntime
from testsuite.containers.container_runtime import ContainerConfig
from contextlib import closing

with closing(DockerRuntime("tcp://10.0.145.159:2376")) as d:
cc = ContainerConfig("mysql", "latest", {"MYSQL_ROOT_PASSWORD": "root"}, {"3306": "33767"}, cmd=["ls", "-la"])
cc.attach_volume("/root/dkr", "/mnt")
c = d.run(cc)
print(d.logs(c))

# d.stop(c)
d.delete_container(c)


###############################################################################
# Example usage of PodmanRuntime
def example_podman():
from testsuite.containers.podman_runtime import PodmanRuntime
from testsuite.containers.container_runtime import ContainerConfig
from contextlib import closing

with closing(PodmanRuntime("ssh://root@10.0.145.150/run/podman/io.podman")) as d:
cc = ContainerConfig("mysql", "latest", {"MYSQL_ROOT_PASSWORD": "root"}, {"3306": "33075"}, cmd=["ls"])
cc.attach_volume("/root/blah", "/mnt")
c = d.run(cc)
print(d.logs(c))
# d.stop(c)
d.delete_container(c)


###############################################################################
# Example usage of DockerRuntime
def example_docker_no_cm():
from testsuite.containers.docker_runtime import DockerRuntime
from testsuite.containers.container_runtime import ContainerConfig

d = DockerRuntime("tcp://10.0.145.159:2376")
cc = ContainerConfig("mysql", "latest", {"MYSQL_ROOT_PASSWORD": "root"}, {"3306": "33767"}, cmd=["ls", "-la"])
cc.attach_volume("/root/dkr", "/mnt")
c = d.run(cc)
print(d.logs(c))

# d.stop(c)
d.delete_container(c)
d.close()


###############################################################################
# Example usage of PodmanRuntime
def example_podman_no_cm():
from testsuite.containers.podman_runtime import PodmanRuntime
from testsuite.containers.container_runtime import ContainerConfig

d = PodmanRuntime("ssh://root@10.0.145.150/run/podman/io.podman")
cc = ContainerConfig("mysql", "latest", {"MYSQL_ROOT_PASSWORD": "root"}, {"3306": "33076"}, cmd=["ls"])
cc.attach_volume("/root/blah", "/mnt")
c = d.run(cc)
print(d.logs(c))
# d.stop(c)
d.delete_container(c)

d.close()
1 change: 1 addition & 0 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ disable=duplicate-code, # reports false alarms AND can't be disabled locally; p
consider-using-f-string, # % string operator is absolutely fine
redefined-outer-name,
missing-timeout, # socket timeout is set globally, no need to specify it in calls
too-many-positional-arguments,

[FORMAT]
# Maximum number of characters on a single line.
Expand Down
2 changes: 1 addition & 1 deletion testsuite/certificates/persist.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self) -> None:
@property
def _directory(self):
if not self._dir:
self._dir = tempfile.mkdtemp()
self._dir = tempfile.mkdtemp(prefix="tls_certs_", dir=os.environ.get("resultsdir"))
return self._dir

@abstractmethod
Expand Down
Empty file removed testsuite/containers/__init__.py
Empty file.
91 changes: 0 additions & 91 deletions testsuite/containers/container_runtime.py

This file was deleted.

46 changes: 0 additions & 46 deletions testsuite/containers/docker_runtime.py

This file was deleted.

55 changes: 0 additions & 55 deletions testsuite/containers/podman_runtime.py

This file was deleted.

12 changes: 9 additions & 3 deletions testsuite/dynaconf_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def _guess_version(ocp, namespace):
"""Attempt to determine version from amp-system imagestream"""

version = None
# TODO: ImageStreams are no longer used by 3scale; https://github.com/3scale-qe/3scale-tests/issues/816
try:
version = ocp.image_stream_tag_from_trigger("dc/apicast-production")
Version(version)
Expand Down Expand Up @@ -99,16 +100,21 @@ def _guess_apicast_operator_version(ocp, settings):

def _apicast_image(ocp):
"""Find source of amp-apicast image"""
lookup = ocp.do_action("get", ["dc/apicast-production", "-o", "yaml"], parse_output=True)
return lookup.model.spec.template.spec.containers[0].image
# dc are replaced with deployments in 2.15-dev
try:
lookup = ocp.do_action("get", ["deployment/apicast-production", "-o", "yaml"], parse_output=True)
return lookup.model.spec.template.spec.containers[0].image
except OpenShiftPythonException:
lookup = ocp.do_action("get", ["dc/apicast-production", "-o", "yaml"], parse_output=True)
return lookup.model.spec.template.spec.containers[0].image


def _rhsso_password(tools_config, rhsso_config):
"""Search for SSO admin password"""
server_url = tools_config.get("server")
project = tools_config.get("namespace")
token = tools_config.get("token")
kind = rhsso_config.get("kind", "rhbk")
kind = rhsso_config.get("kind", "rhsso")
try:
# is this RHOAM?
tools = OpenShiftClient(project_name="redhat-rhoam-user-sso", server_url=server_url, token=token)
Expand Down
9 changes: 8 additions & 1 deletion testsuite/gateways/apicast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from typing import Optional, List, Dict, Tuple
import logging

from openshift_client import OpenShiftPythonException

from threescale_api.resources import Service

from testsuite.capabilities import Capability
Expand Down Expand Up @@ -82,7 +84,12 @@ def setup_tls(self, secret_name, https_port):
@property
def deployment(self) -> Deployment:
"""Gateway deployment"""
return self.openshift.deployment(f"dc/{self.name}")
# dc are replaced with deployments in 2.15-dev
try:
self.openshift.do_action("get", [f"deployment/{self.name}"])
return self.openshift.deployment(f"deployment/{self.name}")
except OpenShiftPythonException:
return self.openshift.deployment(f"dc/{self.name}")

def _routename(self, service):
"""name of route for given service"""
Expand Down
Loading

0 comments on commit edb4aef

Please sign in to comment.