Skip to content

Commit

Permalink
Fix test suite. Browse all records and detects if proper one is
Browse files Browse the repository at this point in the history
mentioned.

Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Oct 30, 2024
1 parent 8e63352 commit e65b428
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion container_ci_suite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def save_tenant_egress_yaml(project_name: str, rules: List[str] = []) -> str:
if not rules:
rules = [
"github.com", "api.github.com", "codeload.github.com", "pypi.org", "www.cpan.org",
"registry.npmjs.org", "npmjs.org", "npmjs.com",
"registry.npmjs.org", "npmjs.org", "npmjs.com", "rubygems.org"
"backpan.perl.org", "www.metacpan.org", "files.pythonhosted.org", "getcomposer.org",
]
generated_yaml = []
Expand Down
13 changes: 11 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,17 @@ def test_tenantnegress_yaml(self):
assert yaml_load
assert yaml_load["metadata"]["namespace"] == "core-services-ocp--123456"
assert yaml_load["spec"]["egress"][0]["to"]["dnsName"] == "github.com"
assert len(yaml_load["spec"]["egress"]) == 14
assert yaml_load["spec"]["egress"][14-2]["to"]["cidrSelector"] == "52.92.128.0/17"
check_address = False
check_dnsName = False
for egress in yaml_load["spec"]["egress"]:
if "cidrSelector" in egress["to"]:
if egress["to"]["cidrSelector"] == "52.92.128.0/17":
check_address = True
if "dnsName" in egress["to"]:
if egress["to"]["dnsName"] == "registry.npmjs.org":
check_dnsName = True
assert check_address
assert check_dnsName

@pytest.mark.parametrize(
"json_data,expected_output",
Expand Down

0 comments on commit e65b428

Please sign in to comment.