Skip to content

Commit

Permalink
add-vs-vsr-status-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vepatel committed Jun 5, 2020
1 parent 07eb78a commit 7d34105
Show file tree
Hide file tree
Showing 17 changed files with 679 additions and 35 deletions.
4 changes: 4 additions & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ results.xml
__pycache__/
*.py[cod]
.pytest_cache

# Pytest HTML report
*.html
*.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServerRoute
metadata:
name: backends
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend1
service: backend1-svc
port: 80
- name: backend3
service: backend3-svc
port: 80
subroutes:
- path: /backends/backend8
action:
pass: backend1
- path: /backends/backend9
action:
pass: backend3
20 changes: 20 additions & 0 deletions tests/data/virtual-server-route-status/route-multiple-invalid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServerRoute
metadata:
name: backends
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend1
service: backend1-svc
port: 80
- name: backend3
service: backend3-svc
port: 80
subroutes:
- path: backends/backend1
action:
pass: backend1
- path: backends/backend3
action:
pass: backend3
20 changes: 20 additions & 0 deletions tests/data/virtual-server-route-status/route-multiple.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServerRoute
metadata:
name: backends
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend1
service: backend1-svc
port: 80
- name: backend3
service: backend3-svc
port: 80
subroutes:
- path: /backends/backend1
action:
pass: backend1
- path: /backends/backend3
action:
pass: backend3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServerRoute
metadata:
name: backend2
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend2
service: backend2-svc
port: 80
subroutes:
- path: /backend6
action:
pass: backend2
14 changes: 14 additions & 0 deletions tests/data/virtual-server-route-status/route-single-invalid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServerRoute
metadata:
name: backend2
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend2
service: backend2-svc
port: 80
subroutes:
- path: backend2
action:
pass: backend2
14 changes: 14 additions & 0 deletions tests/data/virtual-server-route-status/route-single.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServerRoute
metadata:
name: backend2
spec:
host: virtual-server-route.example.com
upstreams:
- name: backend2
service: backend2-svc
port: 80
subroutes:
- path: /backend2
action:
pass: backend2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: virtual-server-route
spec:
host: virtual-server-route.example.com
routes:
- path: /backends
route: backends-namespace/backends
- path: /backend2
route: backend2-namespace/backend2
11 changes: 11 additions & 0 deletions tests/data/virtual-server-route-status/virtual-server-invalid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: virtual-server-route
spec:
host: virtual-server-route.example.com
routes:
- path: /backend_x
route: backends-namespace/backend_x
- path: /backend_y
route: backend2-namespace/backend_y
20 changes: 20 additions & 0 deletions tests/data/virtual-server-status/invalid-state.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: virtual-server-status
spec:
host: virtual-server-status.example.com
upstreams:
- name: backend2
service: backend2-svc
port: 80
- name: backend1
service: backend1-svc
port: 80
routes:
- path: backend1
action:
pass: backend1
- path: backend2
action:
pass: backend2
20 changes: 20 additions & 0 deletions tests/data/virtual-server-status/standard/virtual-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: virtual-server-status
spec:
host: virtual-server-status.example.com
upstreams:
- name: backend2
service: backend2-svc
port: 80
- name: backend1
service: backend1-svc
port: 80
routes:
- path: /backend1
action:
pass: backend1
- path: /backend2
action:
pass: backend2
22 changes: 22 additions & 0 deletions tests/data/virtual-server-status/warning-state.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: virtual-server-status
spec:
host: virtual-server-status.example.com
upstreams:
- name: backend2
service: backend2-svc
lb-method: random
slow-start: 1m
port: 80
- name: backend1
service: backend1-svc
port: 80
routes:
- path: /backend1
action:
pass: backend1
- path: /backend2
action:
pass: backend2
3 changes: 2 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ ipaddress==1.0.22 # >= 1.0.17
cffi==1.12.3
pyopenssl==19.0.0
certifi==2019.6.16
urllib3==1.25.3
urllib3==1.25.3
pytest-html==2.1.1
Loading

0 comments on commit 7d34105

Please sign in to comment.