Skip to content
This repository was archived by the owner on Aug 21, 2022. It is now read-only.

Commit b5d7d63

Browse files
committed
tests: add smoketest
1 parent 6129b61 commit b5d7d63

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed

.github/workflows/ansible.yml renamed to .github/workflows/release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
jobs:
1313

1414
release:
15+
needs: test
1516
runs-on: ubuntu-latest
1617
env:
1718
GIT_AUTHOR_EMAIL: [email protected]

.github/workflows/test.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
name: Smoketest test-tf-generation
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- run: ansible-playbook ./__tests__/test-tf-generation.yml

__tests__/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.tf

__tests__/test-tf-generation.yml

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
- hosts: localhost
3+
connection: local
4+
vars:
5+
stackhead__tf_project_folder: "."
6+
stackhead__certificates_project_folder: ".stackhead/certificates/{{ project_name }}"
7+
stackhead__snakeoil_fullchain: ".stackhead/global_certificates/fullchain_snakeoil.pem"
8+
stackhead__snakeoil_privkey: ".stackhead/global_certificates/privkey_snakeoil.pem"
9+
project_name: test
10+
app_config:
11+
domains:
12+
- domain: example.com
13+
expose:
14+
- service: php
15+
internal_port: 5000
16+
external_port: 5000
17+
- service: nginx
18+
internal_port: 80
19+
external_port: 80
20+
security:
21+
authentication:
22+
- type: basic
23+
username: user1
24+
password: pass1
25+
- domain: test.example.com
26+
expose:
27+
- service: php
28+
internal_port: 5000
29+
external_port: 80
30+
security:
31+
authentication:
32+
- type: basic
33+
username: user1
34+
password: pass1
35+
- type: basic
36+
username: user2
37+
password: pass2
38+
container:
39+
registries:
40+
- username: dockerhub-user
41+
password: dockerhub-pass
42+
- username: myregistry-user
43+
password: myregistry-pass
44+
url: myregistry.com
45+
services:
46+
- name: data
47+
image: mycontainer:latest
48+
- name: nginx
49+
image: getstackhead/nginx:php
50+
environment:
51+
NGINX_PUBLIC_DIRECTORY: public
52+
DOCKER_PROXY_SERVICE_NAME: "$DOCKER_SERVICE_NAME['php']"
53+
volumes:
54+
- type: global
55+
src: data
56+
dest: /var/www/public/data
57+
mode: ro
58+
- type: global
59+
src: uploads
60+
dest: /var/www/public/uploads
61+
mode: ro
62+
volumes_from:
63+
- data:ro
64+
- name: php
65+
image: getstackhead/php:7.2
66+
volumes_from:
67+
- data
68+
volumes:
69+
- type: global
70+
src: fileadmin
71+
dest: /var/www/public/fileadmin
72+
- type: global
73+
src: uploads
74+
dest: /var/www/public/uploads
75+
- type: global
76+
src: typo3temp
77+
dest: /var/www/public/typo3temp
78+
- type: global
79+
src: var
80+
dest: /var/www/var
81+
- name: db
82+
image: mariadb
83+
environment:
84+
MYSQL_ROOT_PASSWORD: db
85+
MYSQL_DATABASE: db
86+
MYSQL_USER: db
87+
MYSQL_PASSWORD: db
88+
volumes:
89+
- type: local
90+
src: data
91+
dest: /var/lib/mysql
92+
tasks:
93+
- set_fact:
94+
containerapp__expose: "{{ containerapp__expose|default([]) + item.expose }}"
95+
when: item.expose is defined and item.expose not in containerapp__expose|default([])
96+
with_items: "{{ app_config.domains }}"
97+
- block:
98+
- name: Generate Nginx Server Block Terraform file
99+
import_tasks: "{{ role_path }}/tasks/steps/generate-serverblock-tf.yml"
100+
- name: Generate htpasswd Terraform file
101+
import_tasks: "{{ role_path }}/tasks/steps/generate-htpasswd-tf.yml"
102+
vars:
103+
role_path: ".."
104+
nginx_usehttps: 1
105+
nginx_servername: "test_project"
106+
stackhead__acme_folder: ""
107+
nginx_htpasswd_path: /etc/nginx/passwd
108+
nginx_basicauth_title: "Restricted area"

0 commit comments

Comments
 (0)