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

Rename read_crds to read_custom_resource #1519

Merged
merged 1 commit into from
Apr 8, 2021
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 tests/suite/custom_resources_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def delete_crd(api_extensions_v1_beta1: ApiextensionsV1beta1Api, name) -> None:
print(f"CRD was removed with name '{name}'")


def read_crd(custom_objects: CustomObjectsApi, namespace, plural, name) -> object:
def read_custom_resource(custom_objects: CustomObjectsApi, namespace, plural, name) -> object:
"""
Get CRD information (kubectl describe output)

Expand Down
14 changes: 7 additions & 7 deletions tests/suite/test_ac_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from kubernetes.client.rest import ApiException
from suite.resources_utils import wait_before_test, replace_configmap_from_yaml
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
delete_virtual_server,
create_virtual_server_from_yaml,
patch_virtual_server_from_yaml,
Expand Down Expand Up @@ -122,7 +122,7 @@ def test_deny_policy(
)
wait_before_test()

policy_info = read_crd(kube_apis.custom_objects, test_namespace, "policies", pol_name)
policy_info = read_custom_resource(kube_apis.custom_objects, test_namespace, "policies", pol_name)
print(f"\nUse IP listed in deny block: 10.0.0.1")
resp1 = requests.get(
virtual_server_setup.backend_1_url,
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_allow_policy(
)
wait_before_test()

policy_info = read_crd(kube_apis.custom_objects, test_namespace, "policies", pol_name)
policy_info = read_custom_resource(kube_apis.custom_objects, test_namespace, "policies", pol_name)
print(f"\nUse IP listed in allow block: 10.0.0.1")
resp1 = requests.get(
virtual_server_setup.backend_1_url,
Expand Down Expand Up @@ -300,13 +300,13 @@ def test_invalid_policy(
)
print(f"Response: {resp.status_code}\n{resp.text}")

vs_info = read_crd(
vs_info = read_custom_resource(
kube_apis.custom_objects,
virtual_server_setup.namespace,
"virtualservers",
virtual_server_setup.vs_name,
)
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects, test_namespace, "policies", invalid_pol_name
)
delete_policy(kube_apis.custom_objects, invalid_pol_name, test_namespace)
Expand Down Expand Up @@ -353,7 +353,7 @@ def test_deleted_policy(
)

wait_before_test()
vs_info = read_crd(
vs_info = read_custom_resource(
kube_apis.custom_objects,
virtual_server_setup.namespace,
"virtualservers",
Expand All @@ -369,7 +369,7 @@ def test_deleted_policy(
)
print(f"Response: {resp.status_code}\n{resp.text}")

vs_info = read_crd(
vs_info = read_custom_resource(
kube_apis.custom_objects,
virtual_server_setup.namespace,
"virtualservers",
Expand Down
10 changes: 5 additions & 5 deletions tests/suite/test_ac_policies_vsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from kubernetes.client.rest import ApiException
from suite.resources_utils import wait_before_test, replace_configmap_from_yaml
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
delete_virtual_server,
create_virtual_server_from_yaml,
patch_virtual_server_from_yaml,
Expand Down Expand Up @@ -123,7 +123,7 @@ def test_deny_policy_vsr(
v_s_route_setup.route_m.namespace,
)
wait_before_test()
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects, v_s_route_setup.route_m.namespace, "policies", pol_name
)

Expand Down Expand Up @@ -185,7 +185,7 @@ def test_allow_policy_vsr(
v_s_route_setup.route_m.namespace,
)
wait_before_test()
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects, v_s_route_setup.route_m.namespace, "policies", pol_name
)

Expand Down Expand Up @@ -306,7 +306,7 @@ def test_invalid_policy_vsr(
v_s_route_setup.route_m.namespace,
)
wait_before_test()
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects, v_s_route_setup.route_m.namespace, "policies", pol_name
)

Expand All @@ -316,7 +316,7 @@ def test_invalid_policy_vsr(
headers={"host": v_s_route_setup.vs_host, "X-Real-IP": "10.0.0.1"},
)
print(f"Response: {resp.status_code}\n{resp.text}")
vsr_info = read_crd(
vsr_info = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
Expand Down
8 changes: 4 additions & 4 deletions tests/suite/test_jwt_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
replace_secret,
)
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
delete_virtual_server,
create_virtual_server_from_yaml,
delete_and_create_vs_from_yaml,
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_jwt_policy_secret(
resp = requests.get(virtual_server_setup.backend_1_url, headers=headers)
print(resp.status_code)

crd_info = read_crd(
crd_info = read_custom_resource(
kube_apis.custom_objects,
virtual_server_setup.namespace,
"virtualservers",
Expand Down Expand Up @@ -226,7 +226,7 @@ def test_jwt_policy(
)

print(f"Patch vs with policy: {policy}")
policy_info = read_crd(kube_apis.custom_objects, test_namespace, "policies", pol_name)
policy_info = read_custom_resource(kube_apis.custom_objects, test_namespace, "policies", pol_name)
if policy == jwt_pol_valid_src:
vs_src = jwt_vs_single_src
assert (
Expand All @@ -253,7 +253,7 @@ def test_jwt_policy(
wait_before_test()
resp = requests.get(virtual_server_setup.backend_1_url, headers=headers)
print(resp.status_code)
crd_info = read_crd(
crd_info = read_custom_resource(
kube_apis.custom_objects,
virtual_server_setup.namespace,
"virtualservers",
Expand Down
14 changes: 7 additions & 7 deletions tests/suite/test_jwt_policies_vsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
replace_secret,
)
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
delete_virtual_server,
patch_virtual_server_from_yaml,
patch_v_s_route_from_yaml,
Expand Down Expand Up @@ -208,7 +208,7 @@ def test_jwt_policy_secret(
resp = requests.get(f"{req_url}{v_s_route_setup.route_m.paths[0]}", headers=headers,)
print(resp.status_code)

crd_info = read_crd(
crd_info = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
Expand Down Expand Up @@ -277,10 +277,10 @@ def test_jwt_policy(

resp = requests.get(f"{req_url}{v_s_route_setup.route_m.paths[0]}", headers=headers,)
print(resp.status_code)
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects, v_s_route_setup.route_m.namespace, "policies", pol_name
)
crd_info = read_crd(
crd_info = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
Expand Down Expand Up @@ -353,7 +353,7 @@ def test_jwt_policy_delete_secret(
delete_secret(kube_apis.v1, secret, v_s_route_setup.route_m.namespace)
resp2 = requests.get(f"{req_url}{v_s_route_setup.route_m.paths[0]}", headers=headers,)
print(resp2.status_code)
crd_info = read_crd(
crd_info = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
Expand Down Expand Up @@ -413,7 +413,7 @@ def test_jwt_policy_delete_policy(

resp2 = requests.get(f"{req_url}{v_s_route_setup.route_m.paths[0]}", headers=headers,)
print(resp2.status_code)
crd_info = read_crd(
crd_info = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
Expand Down Expand Up @@ -472,7 +472,7 @@ def test_jwt_policy_override(
resp = requests.get(f"{req_url}{v_s_route_setup.route_m.paths[0]}", headers=headers,)
print(resp.status_code)

crd_info = read_crd(
crd_info = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
Expand Down
8 changes: 4 additions & 4 deletions tests/suite/test_rl_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from kubernetes.client.rest import ApiException
from suite.resources_utils import wait_before_test, replace_configmap_from_yaml
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
delete_virtual_server,
create_virtual_server_from_yaml,
patch_virtual_server_from_yaml,
Expand Down Expand Up @@ -76,7 +76,7 @@ def test_rl_policy_1rs(
)

wait_before_test()
policy_info = read_crd(kube_apis.custom_objects, test_namespace, "policies", pol_name)
policy_info = read_custom_resource(kube_apis.custom_objects, test_namespace, "policies", pol_name)
occur = []
t_end = time.perf_counter() + 1
resp = requests.get(
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_rl_policy_10rs(
)

wait_before_test()
policy_info = read_crd(kube_apis.custom_objects, test_namespace, "policies", pol_name)
policy_info = read_custom_resource(kube_apis.custom_objects, test_namespace, "policies", pol_name)
occur = []
t_end = time.perf_counter() + 1
resp = requests.get(
Expand Down Expand Up @@ -158,7 +158,7 @@ def test_rl_policy_invalid(
)

wait_before_test()
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects, test_namespace, "policies", invalid_pol_name
)
resp = requests.get(
Expand Down
8 changes: 4 additions & 4 deletions tests/suite/test_rl_policies_vsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from kubernetes.client.rest import ApiException
from suite.resources_utils import wait_before_test, replace_configmap_from_yaml
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
delete_virtual_server,
create_virtual_server_from_yaml,
patch_virtual_server_from_yaml,
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_rl_policy_1rs_vsr(
)

wait_before_test()
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects, v_s_route_setup.route_m.namespace, "policies", pol_name
)
occur = []
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_rl_policy_10rs_vsr(
)

wait_before_test()
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects, v_s_route_setup.route_m.namespace, "policies", pol_name
)
occur = []
Expand Down Expand Up @@ -292,7 +292,7 @@ def test_rl_policy_invalid_vsr(
)

wait_before_test()
policy_info = read_crd(
policy_info = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"policies",
Expand Down
2 changes: 1 addition & 1 deletion tests/suite/test_v_s_route_rewrites.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from kubernetes.client.rest import ApiException
from suite.resources_utils import wait_before_test
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
patch_virtual_server_from_yaml,
patch_v_s_route_from_yaml,
delete_virtual_server,
Expand Down
22 changes: 11 additions & 11 deletions tests/suite/test_v_s_route_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from kubernetes.client.rest import ApiException
from suite.resources_utils import wait_before_test
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
patch_virtual_server_from_yaml,
patch_v_s_route_from_yaml,
delete_virtual_server,
Expand Down Expand Up @@ -60,13 +60,13 @@ def test_status_valid(
"""
Test VirtualServerRoute status with a valid fields in yaml
"""
response_m = read_crd(
response_m = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
v_s_route_setup.route_m.name,
)
response_s = read_crd(
response_s = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_s.namespace,
"virtualserverroutes",
Expand Down Expand Up @@ -109,13 +109,13 @@ def test_status_invalid(
)
wait_before_test()

response_m = read_crd(
response_m = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
v_s_route_setup.route_m.name,
)
response_s = read_crd(
response_s = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_s.namespace,
"virtualserverroutes",
Expand Down Expand Up @@ -161,13 +161,13 @@ def test_status_invalid_prefix(
)
wait_before_test()

response_m = read_crd(
response_m = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
v_s_route_setup.route_m.name,
)
response_s = read_crd(
response_s = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_s.namespace,
"virtualserverroutes",
Expand Down Expand Up @@ -202,13 +202,13 @@ def test_status_invalid_vsr_in_vs(
)
wait_before_test()

response_m = read_crd(
response_m = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
v_s_route_setup.route_m.name,
)
response_s = read_crd(
response_s = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_s.namespace,
"virtualserverroutes",
Expand Down Expand Up @@ -239,13 +239,13 @@ def test_status_remove_vs(
kube_apis.custom_objects, v_s_route_setup.vs_name, v_s_route_setup.namespace,
)

response_m = read_crd(
response_m = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_m.namespace,
"virtualserverroutes",
v_s_route_setup.route_m.name,
)
response_s = read_crd(
response_s = read_custom_resource(
kube_apis.custom_objects,
v_s_route_setup.route_s.namespace,
"virtualserverroutes",
Expand Down
2 changes: 1 addition & 1 deletion tests/suite/test_virtual_server_rewrites.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from kubernetes.client.rest import ApiException
from suite.resources_utils import wait_before_test
from suite.custom_resources_utils import (
read_crd,
read_custom_resource,
patch_virtual_server_from_yaml,
)
from settings import TEST_DATA
Expand Down
Loading