Skip to content

Commit

Permalink
Update NAP DoS test container (#3663) (#3857)
Browse files Browse the repository at this point in the history
* Update NAP DoS test container

* Add to path - good_path.html (#3679)

---------

Co-authored-by: pasmant <78279234+pasmant@users.noreply.github.com>
(cherry picked from commit d7f795a)
  • Loading branch information
lucacome authored May 4, 2023
1 parent 643f1b4 commit 1af92da
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 31 deletions.
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ pythonpath = [
addopts = "--tb=native -ra --disable-warnings -x -l --profile -v"
log_cli = true
markers =[
"smoke",
"vsr",
"policies",
"vs",
"ts",
"ingresses",
"appprotect",
"dos",
"ingresses",
"policies",
"rewrite",
"skip_for_nginx_oss",
"smoke",
"ts",
"vs",
"vsr",
]
testpaths = [
"tests",
Expand Down
38 changes: 19 additions & 19 deletions tests/data/common/app/dos/app.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
apiVersion: v1
kind: Service
metadata:
name: dos-svc
spec:
selector:
app: dos-server
ports:
- protocol: "TCP"
port: 80
targetPort: 8080
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -27,10 +14,23 @@ spec:
spec:
containers:
- name: dos-server
image: nginxkic/test-dos-server:2.0.0
image: ghcr.io/nginxinc/kic-test-dos-server:0.2.0
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'python3 /root/webserver.py; tail -f "/dev/null"']
lifecycle:
preStop:
exec:
command: ['sh', '-c', 'python3 /root/webserver.py;']
ports:
- containerPort: 8000
name: http
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: dos-svc
spec:
selector:
app: dos-server
ports:
- name: http
targetPort: 8000
port: 80
protocol: TCP
type: NodePort
2 changes: 1 addition & 1 deletion tests/data/common/app/grpc-vs-mixed/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: greeter
image: ghcr.io/nginxinc/kic-test-grpc-server:0.1.2
image: ghcr.io/nginxinc/kic-test-grpc-server:0.2.0
ports:
- containerPort: 50051
---
Expand Down
4 changes: 2 additions & 2 deletions tests/data/common/app/grpc-vs/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: greeter
image: ghcr.io/nginxinc/kic-test-grpc-server:0.1.2
image: ghcr.io/nginxinc/kic-test-grpc-server:0.2.0
ports:
- containerPort: 50051
---
Expand Down Expand Up @@ -47,7 +47,7 @@ spec:
spec:
containers:
- name: greeter
image: ghcr.io/nginxinc/kic-test-grpc-server:0.1.2
image: ghcr.io/nginxinc/kic-test-grpc-server:0.2.0
ports:
- containerPort: 50051
---
Expand Down
2 changes: 1 addition & 1 deletion tests/data/common/app/grpc/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: greeter
image: ghcr.io/nginxinc/kic-test-grpc-server:0.1.2
image: ghcr.io/nginxinc/kic-test-grpc-server:0.2.0
ports:
- containerPort: 50051
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: tcp-service
image: ghcr.io/nginxinc/kic-test-tcp-server:0.1.2
image: ghcr.io/nginxinc/kic-test-tcp-server:0.2.0
ports:
- containerPort: 3333
name: tcp-server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: udp-service
image: ghcr.io/nginxinc/kic-test-udp-server:0.1.2
image: ghcr.io/nginxinc/kic-test-udp-server:0.2.0
ports:
- containerPort: 3334
name: udp-server
Expand Down
1 change: 1 addition & 0 deletions tests/suite/test_virtual_server_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def virtual_server_setup_dos(request, kube_apis, ingress_controller_endpoint, te
vs_name = create_virtual_server_from_yaml(kube_apis.custom_objects, vs_source, test_namespace)
vs_host = get_first_host_from_yaml(vs_source)
vs_paths = get_paths_from_vs_yaml(vs_source)
vs_paths[0] += f"good_path.html"
if request.param["app_type"]:
create_example_app(kube_apis, request.param["app_type"], test_namespace)
wait_until_all_pods_are_ready(kube_apis.v1, test_namespace)
Expand Down
1 change: 1 addition & 0 deletions tests/suite/utils/resources_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def are_all_pods_in_ready_state(v1: CoreV1Api, namespace) -> bool:
return False
pod_ready_amount = 0
for pod in pods.items:
print(f"Pod {pod.metadata.name} has image {pod.spec.containers[0].image}")
if pod.status.conditions is None:
return False
for condition in pod.status.conditions:
Expand Down

0 comments on commit 1af92da

Please sign in to comment.