diff options
-rw-r--r-- | .travis.yml | 7 | ||||
-rwxr-xr-x | tests/kong.py | 22 |
2 files changed, 27 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index 1deea24..14ab868 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -13,7 +13,7 @@ install: | |||
13 | - nix-channel --update | 13 | - nix-channel --update |
14 | 14 | ||
15 | # Install ansible | 15 | # Install ansible |
16 | - nix-env -i ansible ansible-lint | 16 | - nix-env -i python3 ansible ansible-lint |
17 | - nix-env -if ./dhall-1.26.1.nix | 17 | - nix-env -if ./dhall-1.26.1.nix |
18 | 18 | ||
19 | # Check ansible version | 19 | # Check ansible version |
@@ -22,12 +22,15 @@ install: | |||
22 | 22 | ||
23 | # Create ansible.cfg with correct roles_path | 23 | # Create ansible.cfg with correct roles_path |
24 | - printf '[defaults]\nroles_path=../' >ansible.cfg | 24 | - printf '[defaults]\nroles_path=../' >ansible.cfg |
25 | # Basic webserver to fake a Kong | ||
26 | - | | ||
27 | ./tests/kong.py& | ||
25 | 28 | ||
26 | script: | 29 | script: |
27 | # Basic role syntax check | 30 | # Basic role syntax check |
28 | - ansible-playbook tests/test.yml -i tests/inventory --syntax-check | 31 | - ansible-playbook tests/test.yml -i tests/inventory --syntax-check |
29 | - ansible-lint . | 32 | - ansible-lint . |
30 | - ansible-playbook tests/test.yml -i tests/inventory -C -D | 33 | - ansible-playbook tests/test.yml -i tests/inventory -D |
31 | - scripts/dhall_check.sh | 34 | - scripts/dhall_check.sh |
32 | 35 | ||
33 | notifications: | 36 | notifications: |
diff --git a/tests/kong.py b/tests/kong.py new file mode 100755 index 0000000..32bafb2 --- /dev/null +++ b/tests/kong.py | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | from http.server import HTTPServer, CGIHTTPRequestHandler | ||
4 | |||
5 | class SimpleHTTPRequestHandler(CGIHTTPRequestHandler): | ||
6 | def do_GET(self): | ||
7 | if self.path == '/services/test': | ||
8 | self.send_response(404) | ||
9 | else: | ||
10 | self.send_response(200) | ||
11 | self.send_header('Content-Type', 'application/json') | ||
12 | self.end_headers() | ||
13 | self.wfile.write(b'{ "data": [] }') | ||
14 | |||
15 | def do_POST(self): | ||
16 | self.send_response(200) | ||
17 | self.end_headers() | ||
18 | self.wfile.write(b'Hello, world!') | ||
19 | |||
20 | |||
21 | httpd = HTTPServer(('127.0.0.1', 8000), SimpleHTTPRequestHandler) | ||
22 | httpd.serve_forever() | ||