Skip to content

Commit

Permalink
Do not create project on Shared Cluster every time. One time is enough.
Browse files Browse the repository at this point in the history
The fixture over all classes does this job.

Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Nov 27, 2024
1 parent ae59c4f commit 0c29de6
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 134 deletions.
24 changes: 12 additions & 12 deletions tests/test_httpd_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="httpd-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELHttpdImageStreams:

def setup_method(self):
package_name = "httpd-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry,expected",
[
Expand All @@ -27,7 +27,7 @@ def teardown_method(self):
("2.4-el9", "registry.redhat.io/rhel9/httpd-24", True),
],
)
def test_httpd_imagestream(self, version, registry, expected):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected
def test_httpd_imagestream(self, helm_api, version, registry, expected):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry) == expected
25 changes: 13 additions & 12 deletions tests/test_mariadb_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="mariadb-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELMariadbImageStreams:

def setup_method(self):
package_name = "mariadb-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)

def teardown_method(self):
self.hc_api.delete_project()
class TestHelmRHELMariadbImageStreams:

@pytest.mark.parametrize(
"version,registry,expected",
Expand All @@ -28,7 +29,7 @@ def teardown_method(self):
("10.5-el8", "registry.redhat.io/rhel8/mariadb-105:latest", True),
],
)
def test_package_imagestream(self, version, registry, expected):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected
def test_package_imagestream(self, helm_api, version, registry, expected):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry) == expected
24 changes: 12 additions & 12 deletions tests/test_mysql_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="mysql-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELMySQLImageStreams:

def setup_method(self):
package_name = "mysql-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry,expected",
[
("8.0-el9", "registry.redhat.io/rhel9/mysql-80:latest", True),
("8.0-el8", "registry.redhat.io/rhel8/mysql-80:latest", True),
],
)
def test_package_imagestream(self, version, registry, expected):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected
def test_package_imagestream(self, helm_api, version, registry, expected):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry) == expected
24 changes: 12 additions & 12 deletions tests/test_nginx_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="nginx-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELNginxImageStreams:

def setup_method(self):
package_name = "nginx-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry,expected",
[
Expand All @@ -29,7 +29,7 @@ def teardown_method(self):
("1.20-ubi8", "registry.redhat.io/ubi8/nginx-120:latest", False),
],
)
def test_package_imagestream(self, version, registry, expected):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected
def test_package_imagestream(self, helm_api, version, registry, expected):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry) == expected
15 changes: 8 additions & 7 deletions tests/test_nodejs_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="redhat-nodejs-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELNodeJSImageStreams:

def setup_method(self):
package_name = "redhat-nodejs-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry",
Expand Down
24 changes: 13 additions & 11 deletions tests/test_perl_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="perl-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELPerlImageStreams:

def setup_method(self):
package_name = "perl-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
class TestHelmRHELPerlImageStreams:

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry",
Expand All @@ -26,7 +28,7 @@ def teardown_method(self):
("5.26-ubi8", "registry.redhat.io/ubi8/perl-526:latest"),
],
)
def test_package_imagestream(self, version, registry):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry)
def test_package_imagestream(self, helm_api, version, registry):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry)
1 change: 0 additions & 1 deletion tests/test_php_cakephp_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def teardown_method(self):
"7.4-ubi8",
"8.0-ubi8",
"8.0-ubi9",
"8.1-ubi9",
"8.2-ubi8",
"8.2-ubi9",
]
Expand Down
24 changes: 13 additions & 11 deletions tests/test_php_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="php-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELPHPImageStreams:

def setup_method(self):
package_name = "php-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
class TestHelmRHELPHPImageStreams:

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry,expected",
Expand All @@ -29,7 +31,7 @@ def teardown_method(self):
("7.4-ubi8", "registry.redhat.io/ubi8/php-74:latest", True),
],
)
def test_package_imagestream(self, version, registry, expected):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected
def test_package_imagestream(self, helm_api, version, registry, expected):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry) == expected
24 changes: 13 additions & 11 deletions tests/test_postgresql_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="postgresql-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELPostgresqlImageStreams:

def setup_method(self):
package_name = "postgresql-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
class TestHelmRHELPostgresqlImageStreams:

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry,expected",
Expand All @@ -30,7 +32,7 @@ def teardown_method(self):
("16-el9", "registry.redhat.io/rhel9/postgresql-16:latest", True),
],
)
def test_package_imagestream(self, version, registry, expected):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected
def test_package_imagestream(self, helm_api, version, registry, expected):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry) == expected
24 changes: 13 additions & 11 deletions tests/test_python_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="python-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()

class TestHelmRHELPythonImageStreams:

def setup_method(self):
package_name = "python-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
class TestHelmRHELPythonImageStreams:

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry",
Expand All @@ -30,7 +32,7 @@ def teardown_method(self):
("3.6-ubi8", "registry.redhat.io/ubi8/python-36:latest"),
],
)
def test_package_imagestream(self, version, registry):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry)
def test_package_imagestream(self, helm_api, version, registry):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry)
25 changes: 14 additions & 11 deletions tests/test_redis_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))

@pytest.fixture(scope="module")
def helm_api(request):
helm_api = HelmChartsAPI(path=test_dir / "../charts/redhat", package_name="redis-imagestreams", tarball_dir=test_dir)
print(request)
# app_name = os.path.basename(request.param)
yield helm_api
pass
helm_api.delete_project()


class TestHelmRHELRedisImageStreams:

def setup_method(self):
package_name = "redis-imagestreams"
path = test_dir / "../charts/redhat"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
class TestHelmRHELRedisImageStreams:

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry,expected",
Expand All @@ -25,7 +28,7 @@ def teardown_method(self):
("6-el8", "registry.redhat.io/rhel8/redis-6:latest", True),
],
)
def test_package_imagestream(self, version, registry, expected):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected
def test_package_imagestream(self, helm_api, version, registry, expected):
assert helm_api.helm_package()
assert helm_api.helm_installation()
assert helm_api.check_imagestreams(version=version, registry=registry) == expected
Loading

0 comments on commit 0c29de6

Please sign in to comment.