]> git.immae.eu Git - github/fretlink/ansible-clever.git/commitdiff
tests: Add more test cases
authorPaul Bonaud <paul.bonaud@fretlink.com>
Fri, 19 Jun 2020 09:38:17 +0000 (11:38 +0200)
committerPaul Bonaud <paul.bonaud@fretlink.com>
Fri, 19 Jun 2020 15:01:56 +0000 (17:01 +0200)
.travis.yml
tests/test-configure-app.yml [new file with mode: 0644]
tests/test-haskell-app.yml [new file with mode: 0644]
tests/test-simple-app.yml [new file with mode: 0644]
tests/test.yml [deleted file]

index 0fcb053b7525ef5d95b87a846864e62476489760..752366ff80d14db02d0923cf33d97ed87a9895ca 100644 (file)
@@ -19,8 +19,7 @@ install:
   - printf '[defaults]\nroles_path=../' >ansible.cfg
 
 script:
-  # Basic role syntax check
-  - ansible-playbook tests/test.yml -i tests/inventory --syntax-check
+  # Basic role syntax check & linting
   - ansible-lint .
   - shellcheck **/*.sh
   - scripts/dhall_check.sh
@@ -28,7 +27,9 @@ script:
   - mkdir -p ~/.local/bin
   - cp tests/fake.sh ~/.local/bin/clever
   - cp tests/fake.sh ~/.local/bin/git
-  - ansible-playbook tests/test.yml -i tests/inventory
+  - ansible-playbook tests/test-simple-app.yml -i tests/inventory
+  - ansible-playbook tests/test-haskell-app.yml -i tests/inventory
+  - ansible-playbook tests/test-configure-app.yml -i tests/inventory
 
 notifications:
   slack: fretlink:pTIylIN7zkwRFuL3aHERmsbB
diff --git a/tests/test-configure-app.yml b/tests/test-configure-app.yml
new file mode 100644 (file)
index 0000000..06e5e92
--- /dev/null
@@ -0,0 +1,18 @@
+---
+- name: Deploy an app & configure system details on clever
+  hosts: localhost
+  remote_user: root
+  roles:
+    - role: clever
+      vars:
+        clever_token: 123abc
+        clever_secret: cba321
+        clever_app: app_00000000-0000-0000-0000-000000000000
+        clever_domain: my-app.example.org
+        clever_syslog_server: 172.10.0.1:54000
+        clever_build_flavor: M
+  post_tasks:
+    - name: Check CC_RUN_COMMAND is not part of the environment
+      fail:
+        msg: "CC_RUN_COMMAND env variable should not be present in the environment dict"
+      when: clever_env.CC_RUN_COMMAND is defined
diff --git a/tests/test-haskell-app.yml b/tests/test-haskell-app.yml
new file mode 100644 (file)
index 0000000..69a25ae
--- /dev/null
@@ -0,0 +1,16 @@
+---
+- name: Deploy a Haskell app to clever
+  hosts: localhost
+  remote_user: root
+  roles:
+    - role: clever
+      vars:
+        clever_token: 123abc
+        clever_secret: cba321
+        clever_app: app_00000000-0000-0000-0000-000000000000
+        clever_haskell_entry_point: coucou-server
+  post_tasks:
+    - name: Check CC_RUN_COMMAND is present
+      fail:
+        msg: "CC_RUN_COMMAND env variable should be added for Haskell apps"
+      when: not clever_env.CC_RUN_COMMAND is defined
diff --git a/tests/test-simple-app.yml b/tests/test-simple-app.yml
new file mode 100644 (file)
index 0000000..e0b905a
--- /dev/null
@@ -0,0 +1,15 @@
+---
+- name: Deploy simple app to clever
+  hosts: localhost
+  remote_user: root
+  roles:
+    - role: clever
+      vars:
+        clever_token: 123abc
+        clever_secret: cba321
+        clever_app: app_00000000-0000-0000-0000-000000000000
+  post_tasks:
+    - name: Check CC_RUN_COMMAND is not part of the environment
+      fail:
+        msg: "CC_RUN_COMMAND env variable should not be present in the environment dict"
+      when: clever_env.CC_RUN_COMMAND is defined
diff --git a/tests/test.yml b/tests/test.yml
deleted file mode 100644 (file)
index 663bc6b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
----
-- hosts: localhost
-  remote_user: root
-  roles:
-    - role: clever
-      vars:
-        clever_token: 123abc
-        clever_secret: cba321
-        clever_app: app_00000000-0000-0000-0000-000000000000