Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more numbers #19

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion container_ci_suite/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, path: Path, package_name: str, tarball_dir: Path, namespace:
self.package_name: str = package_name
self.tarball_dir = tarball_dir
if namespace == "default":
self.namespace = f"helm-sclorg-{random.randrange(1000, 10000, 6)}"
self.namespace = f"helm-sclorg-{random.randrange(10000, 100000)}"
else:
self.namespace = namespace
self.create_project()
Expand Down
14 changes: 12 additions & 2 deletions tests/test_helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,27 @@


import pytest
import os
from flexmock import flexmock
from pathlib import Path


from container_ci_suite.helm import HelmChartsAPI

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


class TestContainerCISuiteHelmCharts:

def setup_method(self):
self.helm_chart = HelmChartsAPI("foo_path", "postgresql-imagestreams", "0.0.1", namespace="pgsql-13")
flexmock(HelmChartsAPI).should_receive("create_project").and_return(True)
self.helm_chart = HelmChartsAPI(
Path("foo_path"), package_name="postgresql-imagestreams", tarball_dir=test_dir, namespace="pgsql-13"
)
self.helm_chart.set_version("0.0.1")

def test_helm_api(self):
assert self.helm_chart.path == "foo_path"
assert self.helm_chart.path == Path("foo_path")
assert self.helm_chart.package_name == "postgresql-imagestreams"
assert self.helm_chart.version == "0.0.1"
assert self.helm_chart.namespace == "pgsql-13"
Expand All @@ -53,6 +62,7 @@ def test_check_imagestreams(self, tag, registry, expected_value, postgresql_json
assert self.helm_chart.check_imagestreams(tag, registry=registry) == expected_value

def test_package_helm_chart_success(self, helm_package_success):
flexmock(HelmChartsAPI).should_receive("is_chart_yaml_present").and_return(True)
flexmock(HelmChartsAPI).should_receive("run_helm_command").and_return(helm_package_success)
assert self.helm_chart.helm_package()

Expand Down