Skip to content

Commit

Permalink
Fix Test suite
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Oct 23, 2024
1 parent a48dc25 commit 6e13333
Showing 1 changed file with 3 additions and 56 deletions.
59 changes: 3 additions & 56 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,67 +173,14 @@ def test_tenantnamespace_yaml(self):
assert yaml_load == expected_yaml

def test_tenantnegress_yaml(self):
expected_yaml = {
"apiVersion": "tenant.paas.redhat.com/v1alpha1",
"kind": "TenantEgress",
"metadata": {
"name": "default",
"namespace": "core-services-ocp--123456"
},
"spec": {
"egress": [
{
"to": {
"dnsName": "github.com"
},
"type": "Allow"
},
{
"to": {
"cidrSelector": "172.0.0.0/8"
},
"type": "Allow"
},
{
"to": {
"cidrSelector": "172.0.0.0/8"
},
"type": "Allow"
},
{
"to": {
"cidrSelector": "10.0.0.0/9"
},
"type": "Allow"
},
{
"to": {
"cidrSelector": "52.218.128.0/17"
},
"type": "Allow"
},
{
"to": {
"cidrSelector": "52.92.128.0/17"
},
"type": "Allow"
},
{
"to": {
"cidrSelector": "52.216.0.0/15"
},
"type": "Allow"
}
]
}
}
tenant_yaml = utils.save_tenant_egress_yaml(project_name="123456")
print(tenant_yaml)
with open(tenant_yaml) as fd:
yaml_load = yaml.safe_load(fd.read())
assert yaml_load
assert yaml_load["metadata"]["namespace"] == "core-services-ocp--123456"
assert yaml_load == expected_yaml
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"

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

0 comments on commit 6e13333

Please sign in to comment.