From 351765fbc860a54d0b8691f74555b04fde5416bb Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Fri, 19 Jun 2020 11:38:17 +0200 Subject: tests: Add more test cases --- .travis.yml | 7 ++++--- tests/test-configure-app.yml | 18 ++++++++++++++++++ tests/test-haskell-app.yml | 16 ++++++++++++++++ tests/test-simple-app.yml | 15 +++++++++++++++ tests/test.yml | 9 --------- 5 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 tests/test-configure-app.yml create mode 100644 tests/test-haskell-app.yml create mode 100644 tests/test-simple-app.yml delete mode 100644 tests/test.yml diff --git a/.travis.yml b/.travis.yml index 0fcb053..752366f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 index 0000000..06e5e92 --- /dev/null +++ b/tests/test-configure-app.yml @@ -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 index 0000000..69a25ae --- /dev/null +++ b/tests/test-haskell-app.yml @@ -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 index 0000000..e0b905a --- /dev/null +++ b/tests/test-simple-app.yml @@ -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 index 663bc6b..0000000 --- a/tests/test.yml +++ /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 -- cgit v1.2.3 From 037673812bd192ffb122cc22e9f3028afcc58399 Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Fri, 19 Jun 2020 15:52:47 +0200 Subject: core: fix execution mode on shell script --- files/clever-set-drain.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 files/clever-set-drain.sh diff --git a/files/clever-set-drain.sh b/files/clever-set-drain.sh old mode 100644 new mode 100755 -- cgit v1.2.3 From 50411cbb2d091a3bca251e8cd1f599928141cb7b Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Fri, 19 Jun 2020 16:20:43 +0200 Subject: fix: make sure not to include unecessary ENV variable This is a fix to an unfortunate bug introduced by #64 because we had a default value set to `None` on the `clever_haskell_entry_point`. Ansible considers `None` as a defined value so the `is defined` condition doesn't match our need --- README.md | 1 - defaults/main.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 7a4557b..c0f7959 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,6 @@ Variables for the application Example: `{ name: pg, env_prefix: POSTGRESQL_ADDON }` - `clever_app_tasks_file`: tasks file to be executed after environment and addons variables where gathered. Specific to an app, should be use to run migrations. Optional. - `clever_haskell_entry_point`: the haskell executable name to be executed by clever cloud, optional. -- _Obsolete_: `clever_entry_point`: Same as above but was replaced by `clever_haskell_entry_point` since v1.14 of this role. - `clever_domain`: the domain from which the application should be reachable, optional. - _Obsolete_: `domain`: Same as above but was replaced by `clever_domain` since v1.4 of this role. - `clever_syslog_server`: UDP Syslog server to be used as UDPSyslog drain for the application, optional. Example: `udp://198.51.100.51:12345`. diff --git a/defaults/main.yml b/defaults/main.yml index bd3b6a6..4e2ef8e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,7 +6,6 @@ clever_app_root: "{{ app_root | default(playbook_dir + '/..') }}" clever_app_confdir: "{{ clever_app_root }}/.clever_cloud" clever_login_file: "{{ clever_app_confdir }}/login" -clever_haskell_entry_point: "{{ clever_entry_point | default(None) }}" clever_haskell_env: {} clever_env: {} -- cgit v1.2.3