You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ki...@apache.org on 2020/07/24 21:34:02 UTC

[trafficserver-ingress-controller] branch master updated: Integration tests (#17)

This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new ae252a8  Integration tests (#17)
ae252a8 is described below

commit ae252a8469739c6f9e8d54e3c38e22cad2fc0a14
Author: Rishabh Chhabra <ri...@gmail.com>
AuthorDate: Fri Jul 24 16:33:56 2020 -0500

    Integration tests (#17)
    
    * Adds test hello file for integration tests
    
    * Adds integration tests
    
    * Copies over yaml files to test data folder
    
    * Moves files to subfolder
    
    * Adds license
---
 k8s/backend/node-app-1/hello-updated.html          |  15 ++
 k8s/backend/node-app-1/server.js                   |   5 +
 tests/conftest.py                                  |  28 ++++
 tests/data/ats-ingress-add.yaml                    |  42 +++++
 tests/data/ats-ingress-delete.yaml                 |  38 +++++
 tests/data/ats-ingress-snippet.yaml                |  36 ++++
 tests/data/ats-ingress-update.yaml                 |  42 +++++
 tests/data/setup/apps/app-deployment.yaml          | 147 +++++++++++++++++
 tests/data/setup/apps/app-service.yaml             |  89 ++++++++++
 tests/data/setup/configmaps/ats-configmap.yaml     |  33 ++++
 tests/data/setup/configmaps/fluentd-configmap.yaml |  41 +++++
 tests/data/setup/ingresses/ats-ingress-2.yaml      |  47 ++++++
 tests/data/setup/ingresses/ats-ingress-2s.yaml     |  40 +++++
 tests/data/setup/ingresses/ats-ingress.yaml        |  50 ++++++
 .../data/setup/traffic-server/ats-deployment.yaml  | 122 ++++++++++++++
 tests/data/setup/traffic-server/ats-rbac.yaml      |  60 +++++++
 tests/requirements.txt                             |   3 +
 tests/suite/test_ingress.py                        | 182 +++++++++++++++++++++
 18 files changed, 1020 insertions(+)

diff --git a/k8s/backend/node-app-1/hello-updated.html b/k8s/backend/node-app-1/hello-updated.html
new file mode 100644
index 0000000..d224b8a
--- /dev/null
+++ b/k8s/backend/node-app-1/hello-updated.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<HTML>
+
+<HEAD>
+    <TITLE>
+        Hello from app1 - Request to path /app2
+    </TITLE>
+</HEAD>
+
+<BODY>
+    <H1>Hi</H1>
+    <P>This is very minimal "hello world" HTML document.</P>
+</BODY>
+
+</HTML>
diff --git a/k8s/backend/node-app-1/server.js b/k8s/backend/node-app-1/server.js
index 61b8288..59a6b85 100644
--- a/k8s/backend/node-app-1/server.js
+++ b/k8s/backend/node-app-1/server.js
@@ -32,5 +32,10 @@ app.get('/app1', (req, res) => {
   res.sendFile('hello.html', {root: __dirname });
 })
 
+app.get('/app2', (req, res) => {
+  res.sendFile('hello-updated.html', {root: __dirname });
+})
+
+
 app.listen(PORT, HOST);
 console.log(`Running on http://${HOST}:${PORT}`);
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..75c9201
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,28 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import pytest
+
+def pytest_addoption(parser):
+    parser.addoption("--minikubeip", action="store")
+
+
+def pytest_generate_tests(metafunc):
+    # This is called for every test. Only get/set command line arguments
+    # if the argument is specified in the list of test "fixturenames".
+    option_value = metafunc.config.option.minikubeip
+    if 'minikubeip' in metafunc.fixturenames and option_value is not None:
+        metafunc.parametrize("minikubeip", [option_value])
\ No newline at end of file
diff --git a/tests/data/ats-ingress-add.yaml b/tests/data/ats-ingress-add.yaml
new file mode 100644
index 0000000..56bf49d
--- /dev/null
+++ b/tests/data/ats-ingress-add.yaml
@@ -0,0 +1,42 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: app-ingress
+  namespace: trafficserver-test-2
+spec:
+  rules:
+  - host: test.media.com
+    http:
+      paths:
+      - path: /app1
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+      - path: /test
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+                    
+  - host: test.edge.com
+    http:
+      paths:
+      - path: /app1
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+          
diff --git a/tests/data/ats-ingress-delete.yaml b/tests/data/ats-ingress-delete.yaml
new file mode 100644
index 0000000..9bc9546
--- /dev/null
+++ b/tests/data/ats-ingress-delete.yaml
@@ -0,0 +1,38 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: app-ingress
+  namespace: trafficserver-test-2
+spec:
+  rules:
+  - host: test.media.com
+    http:
+      paths:
+      - path: /app1
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+                    
+  - host: test.edge.com
+    http:
+      paths:
+      - path: /app1
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+          
diff --git a/tests/data/ats-ingress-snippet.yaml b/tests/data/ats-ingress-snippet.yaml
new file mode 100644
index 0000000..fd348c5
--- /dev/null
+++ b/tests/data/ats-ingress-snippet.yaml
@@ -0,0 +1,36 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: app-ingress
+  namespace: trafficserver-test-3
+  annotations:
+    ats.ingress.kubernetes.io/server-snippet: |
+      ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, function()
+        ts.client_response.header['Location'] = 'https://test.edge.com/app2'
+      end)
+      ts.http.skip_remapping_set(0)
+      ts.http.set_resp(301, 'Redirect')
+spec:
+  rules:
+  - host: test.edge.com
+    http:
+      paths:
+      - path: /app2
+        backend:
+          serviceName: appsvc2
+          servicePort: 8080
\ No newline at end of file
diff --git a/tests/data/ats-ingress-update.yaml b/tests/data/ats-ingress-update.yaml
new file mode 100644
index 0000000..3737c4b
--- /dev/null
+++ b/tests/data/ats-ingress-update.yaml
@@ -0,0 +1,42 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: app-ingress
+  namespace: trafficserver-test-2
+spec:
+  rules:
+  - host: test.media.com
+    http:
+      paths:
+      - path: /app1
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+      - path: /app2
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+          
+  - host: test.edge.com
+    http:
+      paths:
+      - path: /app1
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+          
diff --git a/tests/data/setup/apps/app-deployment.yaml b/tests/data/setup/apps/app-deployment.yaml
new file mode 100644
index 0000000..79ff78d
--- /dev/null
+++ b/tests/data/setup/apps/app-deployment.yaml
@@ -0,0 +1,147 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test-2
+
+---
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test-3
+
+---
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: app1
+  namespace: trafficserver-test-2
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: app1
+  template:
+    metadata:
+      labels:
+        app: app1
+    spec:
+      containers:
+      - name: app1
+        image: node-app-1:latest
+        imagePullPolicy: Never
+        env:
+        - name: AUTHOR
+          value: app1
+        ports:
+        - containerPort: 8080
+        resources:
+          limits:
+            memory: '150Mi'
+            cpu: 50m
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: app2
+  namespace: trafficserver-test-2
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: app2
+  template:
+    metadata:
+      labels:
+        app: app2
+    spec:
+      containers:
+      - name: app2
+        image: node-app-2:latest
+        imagePullPolicy: Never
+        env:
+        - name: AUTHOR
+          value: app2
+        ports:
+        - containerPort: 8080
+        resources:
+          limits:
+            memory: '150Mi'
+            cpu: 50m
+
+---
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: app1
+  namespace: trafficserver-test-3
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: app1
+  template:
+    metadata:
+      labels:
+        app: app1
+    spec:
+      containers:
+      - name: app1
+        image: node-app-1:latest
+        imagePullPolicy: Never
+        env:
+        - name: AUTHOR
+          value: app1
+        ports:
+        - containerPort: 8080
+        resources:
+          limits:
+            memory: '150Mi'
+            cpu: 50m
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: app2
+  namespace: trafficserver-test-3
+spec:
+  replicas: 2
+  selector:
+    matchLabels:
+      app: app2
+  template:
+    metadata:
+      labels:
+        app: app2
+    spec:
+      containers:
+      - name: app2
+        image: node-app-2:latest
+        imagePullPolicy: Never
+        env:
+        - name: AUTHOR
+          value: app2
+        ports:
+        - containerPort: 8080
+        resources:
+          limits:
+            memory: '150Mi'
+            cpu: 50m
diff --git a/tests/data/setup/apps/app-service.yaml b/tests/data/setup/apps/app-service.yaml
new file mode 100644
index 0000000..260c8cf
--- /dev/null
+++ b/tests/data/setup/apps/app-service.yaml
@@ -0,0 +1,89 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test-2
+
+---
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test-3
+
+---
+
+apiVersion: v1
+kind: Service
+metadata:
+  name: appsvc1
+  namespace: trafficserver-test-2
+spec:
+  ports:
+  - port: 8080
+    protocol: TCP
+    targetPort: 8080
+  selector:
+    app: app1
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: appsvc2
+  namespace: trafficserver-test-2
+spec:
+  ports:
+  - port: 8080
+    name: "main"
+    protocol: TCP
+    targetPort: 8080
+
+  selector:
+    app: app2
+
+---
+
+apiVersion: v1
+kind: Service
+metadata:
+  name: appsvc1
+  namespace: trafficserver-test-3
+spec:
+  ports:
+  - port: 8080
+    protocol: TCP
+    targetPort: 8080
+  selector:
+    app: app1
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: appsvc2
+  namespace: trafficserver-test-3
+spec:
+  ports:
+  - port: 8080
+    name: "main"
+    protocol: TCP
+    targetPort: 8080
+
+  selector:
+    app: app2
+
+  
diff --git a/tests/data/setup/configmaps/ats-configmap.yaml b/tests/data/setup/configmaps/ats-configmap.yaml
new file mode 100644
index 0000000..7d66ddd
--- /dev/null
+++ b/tests/data/setup/configmaps/ats-configmap.yaml
@@ -0,0 +1,33 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test
+
+---
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  namespace: trafficserver-test
+  name: ats
+data:
+  # reloadable data only
+  proxy.config.output.logfile.rolling_enabled: "1"
+  proxy.config.output.logfile.rolling_interval_sec: "3000"
+  proxy.config.restart.active_client_threshold: "0"
diff --git a/tests/data/setup/configmaps/fluentd-configmap.yaml b/tests/data/setup/configmaps/fluentd-configmap.yaml
new file mode 100644
index 0000000..f42bbb7
--- /dev/null
+++ b/tests/data/setup/configmaps/fluentd-configmap.yaml
@@ -0,0 +1,41 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: fluentd-config
+  namespace: trafficserver-test
+data:
+  fluent.conf: |
+    <source>
+      type tail
+      path /var/log/squid.log
+      pos_file /var/log/squid.log.pos
+      <parse>
+        @type regexp
+        expression ^(?<timestamp>[^ ]*)\s(?<processing_time>[^ ]*)\s(?<client_ip>[^ ]*)\s(?<cache_result>[^ ]*)\s(?<response_length>[^ ]*)\s(?<request_method>[^ ]*)\s(?<url>[^ ]*)\s(?<username_authenticated_client>[^ ]*)\s(?<heirarchy_route>[^ ]*)\s(?<content_type>[^ ]*)$
+      </parse>
+      tag trafficserver.access
+    </source>
+
+    <match **>
+      @type stdout
+    </match>
+
+    <match fluent.**>
+      @type null
+    </match>
\ No newline at end of file
diff --git a/tests/data/setup/ingresses/ats-ingress-2.yaml b/tests/data/setup/ingresses/ats-ingress-2.yaml
new file mode 100644
index 0000000..e9abdfc
--- /dev/null
+++ b/tests/data/setup/ingresses/ats-ingress-2.yaml
@@ -0,0 +1,47 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test-3
+
+---
+
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: app-ingress
+  namespace: trafficserver-test-3
+  annotations:
+    ats.ingress.kubernetes.io/server-snippet: |
+      ts.debug('Debug msg example')
+      ts.error('Error msg example')
+      -- ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, function()
+      --   ts.client_response.header['Location'] = 'https://test.edge.com/app2'
+      -- end)
+      -- ts.http.skip_remapping_set(0)
+      -- ts.http.set_resp(301, 'Redirect')
+      ts.debug('Uncomment the above lines to redirect http request to https')
+spec:
+  rules:
+  - host: test.edge.com
+    http:
+      paths:
+      - path: /app2
+        backend:
+          serviceName: appsvc2
+          servicePort: 8080
diff --git a/tests/data/setup/ingresses/ats-ingress-2s.yaml b/tests/data/setup/ingresses/ats-ingress-2s.yaml
new file mode 100644
index 0000000..8396ea9
--- /dev/null
+++ b/tests/data/setup/ingresses/ats-ingress-2s.yaml
@@ -0,0 +1,40 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test-3
+
+---
+
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: app-ingress-https
+  namespace: trafficserver-test-3
+spec:
+  tls:
+  - hosts:
+    - test.edge.com
+  rules:
+  - host: test.edge.com
+    http:
+      paths:
+      - path: /app2
+        backend:
+          serviceName: appsvc2
+          servicePort: 8080
diff --git a/tests/data/setup/ingresses/ats-ingress.yaml b/tests/data/setup/ingresses/ats-ingress.yaml
new file mode 100644
index 0000000..bddf63b
--- /dev/null
+++ b/tests/data/setup/ingresses/ats-ingress.yaml
@@ -0,0 +1,50 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test-2
+
+---
+
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: app-ingress
+  namespace: trafficserver-test-2
+spec:
+  rules:
+  - host: test.media.com
+    http:
+      paths:
+      - path: /app1
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+      - path: /app2
+        backend:
+          serviceName: appsvc2
+          servicePort: 8080
+
+  - host: test.edge.com
+    http:
+      paths:
+      - path: /app1
+        backend:
+          serviceName: appsvc1
+          servicePort: 8080
+          
diff --git a/tests/data/setup/traffic-server/ats-deployment.yaml b/tests/data/setup/traffic-server/ats-deployment.yaml
new file mode 100644
index 0000000..15fc4d1
--- /dev/null
+++ b/tests/data/setup/traffic-server/ats-deployment.yaml
@@ -0,0 +1,122 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test
+
+---
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  labels:
+    app: trafficserver-test
+  name: trafficserver-test
+  namespace: trafficserver-test
+spec:
+  minReadySeconds: 30
+
+  selector:
+    matchLabels:
+      app: trafficserver-test
+
+  # DO NOT EXCEED ONE COPY
+  replicas: 1
+  # DO NOT EXCEED ONE COPY
+  template:
+    metadata:
+      labels:
+        app: trafficserver-test
+    spec:
+
+      containers:
+        - name: trafficserver-test
+          image: ats_alpine:latest # Needs to be updated
+          volumeMounts:
+            - mountPath: "/etc/ats/ssl"
+              name: ats-ssl
+              readOnly: true
+            - name: varlog
+              mountPath: /usr/local/var/log/trafficserver
+          imagePullPolicy: IfNotPresent
+          env:
+            - name: POD_NAME
+              valueFrom:
+                fieldRef:
+                  fieldPath: metadata.name
+            - name: POD_NAMESPACE
+              valueFrom:
+                fieldRef:
+                  fieldPath: metadata.namespace
+#            - name: INGRESS_CLASS
+#              value: "ats"
+            - name: POD_TLS_PATH
+              value: "/etc/ats/ssl"
+          ports:
+          - containerPort: 80
+            hostPort: 80
+            name: http
+            protocol: TCP
+          - containerPort: 443
+            hostPort: 443
+            name: https
+            protocol: TCP
+        - name: log-collector
+          image: fluent/fluentd:v1.6-debian-1
+          volumeMounts:
+          - name: varlog
+            mountPath: "/var/log"
+          - name: config-volume
+            mountPath: "/fluentd/etc"
+        - name: trafficserver-exporter
+          image: tsexporter:latest
+          imagePullPolicy: IfNotPresent
+          ports:
+          - containerPort: 9122
+      volumes:
+        - name: ats-ssl
+          secret:
+            secretName: tls-secret
+        - name: varlog
+          emptyDir: {}
+        - name: config-volume
+          configMap:
+            name: fluentd-config
+
+---
+
+apiVersion: v1
+kind: Service
+metadata:
+  name: trafficserver-test
+  namespace: trafficserver-test
+spec:
+  type: NodePort
+  ports:
+  - name: http
+    port: 80
+    protocol: TCP
+    targetPort: 80
+    nodePort: 30000
+  - name: https
+    port: 443
+    protocol: TCP
+    targetPort: 443
+    nodePort: 30043
+  selector:
+    app: trafficserver-test
\ No newline at end of file
diff --git a/tests/data/setup/traffic-server/ats-rbac.yaml b/tests/data/setup/traffic-server/ats-rbac.yaml
new file mode 100644
index 0000000..bb04ba2
--- /dev/null
+++ b/tests/data/setup/traffic-server/ats-rbac.yaml
@@ -0,0 +1,60 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: trafficserver-test
+
+---
+
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRole
+metadata:
+  name: trafficserver-test
+rules:
+- apiGroups:
+  - '*'
+  resources:
+  - ingresses
+  - secrets
+  - services
+  - pods
+  - namespaces
+  - replicationcontrollers
+  - endpoints
+  - configmaps
+  verbs:
+  - get
+  - list
+  - watch
+
+---
+
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+  name: trafficserver-test
+subjects:
+- kind: ServiceAccount
+  name: default
+  namespace: trafficserver-test
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: trafficserver-test
+
diff --git a/tests/requirements.txt b/tests/requirements.txt
new file mode 100644
index 0000000..dd54281
--- /dev/null
+++ b/tests/requirements.txt
@@ -0,0 +1,3 @@
+pytest==5.4.3
+requests==2.24.0
+urllib3==1.25.10
\ No newline at end of file
diff --git a/tests/suite/test_ingress.py b/tests/suite/test_ingress.py
new file mode 100644
index 0000000..9ccd10a
--- /dev/null
+++ b/tests/suite/test_ingress.py
@@ -0,0 +1,182 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+import requests
+import pytest
+import os
+import time
+import textwrap
+
+def kubectl_apply(yaml_path):
+    os.system('kubectl apply -f ' + yaml_path)
+    time.sleep(3)
+
+def kubectl_create(resource):
+    os.system('kubectl create ' + resource)
+    time.sleep(1)
+
+def kubectl_delete(resource):
+    os.system('kubectl delete ' + resource)
+
+def misc_command(command):
+    os.system(command)
+
+def setup_module(module):
+    misc_command('openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=atssvc/O=atssvc"')
+    kubectl_create('namespace trafficserver-test')
+    kubectl_create('secret tls tls-secret --key tls.key --cert tls.crt -n trafficserver-test --dry-run=client -o yaml | kubectl apply -f -')
+    kubectl_apply('data/setup/configmaps/')
+    kubectl_apply('data/setup/traffic-server/')
+    kubectl_apply('data/setup/apps/')
+    kubectl_apply('data/setup/ingresses/')
+    time.sleep(90)
+
+def teardown_module(module):
+    kubectl_delete('namespace trafficserver-test-3')
+    kubectl_delete('namespace trafficserver-test-2')
+    kubectl_delete('namespace trafficserver-test')
+
+def get_expected_response_app1():
+    resp = """<!DOCTYPE html>
+            <HTML>
+
+            <HEAD>
+            <TITLE>
+                Hello from app1
+            </TITLE>
+            </HEAD>
+
+            <BODY>
+                <H1>Hi</H1>
+                <P>This is very minimal "hello world" HTML document.</P>
+            </BODY>
+            </HTML>"""
+    
+    return ' '.join(resp.split())
+
+def get_expected_response_app1_updated():
+    resp = """<!DOCTYPE html>
+            <HTML>
+
+            <HEAD>
+            <TITLE>
+                Hello from app1 - Request to path /app2
+            </TITLE>
+            </HEAD>
+
+            <BODY>
+                <H1>Hi</H1>
+                <P>This is very minimal "hello world" HTML document.</P>
+            </BODY>
+            </HTML>"""
+    
+    return ' '.join(resp.split())
+
+def get_expected_response_app2():
+    resp = """<!DOCTYPE html>
+            <HTML>
+
+            <HEAD>
+            <TITLE>
+                A Small Hello
+            </TITLE>
+            </HEAD>
+
+            <BODY>
+                <H1>Hi</H1>
+                <P>This is very minimal "hello world" HTML document.</P>
+            </BODY>
+            </HTML>"""
+    
+    return ' '.join(resp.split())
+
+class TestIngress:
+    def test_basic_routing_edge_app1(self, minikubeip):
+        req_url = "http://" + minikubeip + ":30000/app1"
+        resp = requests.get(req_url, headers={"host": "test.edge.com"})
+
+        assert resp.status_code == 200,\
+            f"Expected: 200 response code for test_basic_routing"
+        assert ' '.join(resp.text.split()) == get_expected_response_app1()
+        
+    def test_basic_routing_media_app1(self, minikubeip):
+        req_url = "http://" + minikubeip + ":30000/app1"
+        resp = requests.get(req_url, headers={"host": "test.media.com"})
+
+        assert resp.status_code == 200,\
+            f"Expected: 200 response code for test_basic_routing"
+        assert ' '.join(resp.text.split()) == get_expected_response_app1()
+    
+    def test_basic_routing_edge_app2(self, minikubeip):
+        req_url = "http://" + minikubeip + ":30000/app2"
+        resp = requests.get(req_url, headers={"host": "test.edge.com"})
+
+        assert resp.status_code == 200,\
+            f"Expected: 200 response code for test_basic_routing"
+        assert ' '.join(resp.text.split()) == get_expected_response_app2()
+    
+    def test_basic_routing_media_app2(self, minikubeip):
+        req_url = "http://" + minikubeip + ":30000/app2"
+        resp = requests.get(req_url, headers={"host": "test.media.com"})
+
+        assert resp.status_code == 200,\
+            f"Expected: 200 response code for test_basic_routing"
+        assert ' '.join(resp.text.split()) == get_expected_response_app2()
+    
+    def test_basic_routing_edge_app2_https(self, minikubeip):
+        req_url = "https://" + minikubeip + ":30043/app2"
+        resp = requests.get(req_url, headers={"host": "test.edge.com"}, verify=False)
+
+        assert resp.status_code == 200,\
+            f"Expected: 200 response code for test_basic_routing"
+        assert ' '.join(resp.text.split()) == get_expected_response_app2()
+    
+    def test_updating_ingress_media_app2(self, minikubeip):
+        kubectl_apply('data/ats-ingress-update.yaml')
+        req_url = "http://" + minikubeip + ":30000/app2"
+        resp = requests.get(req_url, headers={"host": "test.media.com"})
+
+        assert resp.status_code == 200,\
+            f"Expected: 200 response code for test_basic_routing"
+        assert ' '.join(resp.text.split()) == get_expected_response_app1_updated()
+    
+    def test_deleting_ingress_media_app2(self, minikubeip):
+        kubectl_apply('data/ats-ingress-delete.yaml')
+        req_url = "http://" + minikubeip + ":30000/app2"
+        resp = requests.get(req_url, headers={"host": "test.media.com"})
+
+        assert resp.status_code == 404,\
+            f"Expected: 400 response code for test_basic_routing_deleted_ingress"
+
+    def test_add_ingress_media(self, minikubeip):
+        kubectl_apply('data/ats-ingress-add.yaml')
+        req_url = "http://" + minikubeip + ":30000/test"
+        resp = requests.get(req_url, headers={"host": "test.media.com"})
+
+        assert resp.status_code == 200,\
+            f"Expected: 200 response code for test_basic_routing"
+        assert ' '.join(resp.text.split()) == get_expected_response_app1()
+
+    def test_snippet_edge_app2(self, minikubeip):
+        kubectl_apply('data/ats-ingress-snippet.yaml')
+        req_url = "http://" + minikubeip + ":30000/app2"
+        resp = requests.get(req_url, headers={"host": "test.edge.com"},allow_redirects=False)
+
+        assert resp.status_code == 301,\
+            f"Expected: 301 response code for test_snippet_edge_app2"
+        assert resp.headers['Location'] == 'https://test.edge.com/app2'
+    
+        
\ No newline at end of file