]> git.immae.eu Git - github/fretlink/ansible-clever.git/commitdiff
fix(tests): use `! grep` instead of `grep -v` 72/head
authorClement Delafargue <clement.delafargue@fretlink.com>
Tue, 30 Jun 2020 13:46:41 +0000 (15:46 +0200)
committerClement Delafargue <clement.delafargue@fretlink.com>
Tue, 30 Jun 2020 14:26:19 +0000 (16:26 +0200)
`grep -v` makes sure a file contains other lines than the one that
matched. This is different from `! grep` which makes sure the file
does not contain a line that matched.

tests/test-configure-app.yml
tests/test-restart-app.yml
tests/test-scalability.yml

index 15987fd8248288743e2d529e8b2027205a064e99..e9861a2e12359063b5381407a27ff7a2d084a220 100644 (file)
@@ -21,7 +21,7 @@
         msg: "CC_RUN_COMMAND env variable should not be present in the environment dict"
       when: clever_env.CC_RUN_COMMAND is defined
     - name: Check stubbed commands
-      command: "{{ item.cmd }}"
+      shell: "{{ item.cmd }}"
       ignore_errors: true
       vars:
         display: "{{ item.display }}"
@@ -34,7 +34,7 @@
           display: "Expected 'clever domain' command to be called"
         - cmd: "grep drain ../clever-commands"
           display: "Expected 'clever drain' command to be called"
-        - cmd: "grep -v restart ../clever-commands"
+        - cmd: "! grep restart ../clever-commands"
           display: "Expected 'clever restart' command to NOT be called"
       register: tests_results
     - name: show results
index 4c13a14fd01230120b4ddb30f0d841ede4e8454f..bc880a8fb1a9a8f7d137c18be6b207ff1181a60f 100644 (file)
         clever_restart_only: true
   post_tasks:
     - name: Check stubbed commands
-      command: "{{ item.cmd }}"
+      shell: "{{ item.cmd }}"
       ignore_errors: true
       vars:
         display: "{{ item.display }}"
       with_list:
         - cmd: "grep restart ../clever-commands"
           display: "Expected 'clever restart' command to be called"
-        - cmd: "grep -v deploy ../clever-commands"
+        - cmd: "! grep deploy ../clever-commands"
           display: "Expected 'clever deploy' command to NOT be called"
-        - cmd: "grep -v scale ../clever-commands"
+        - cmd: "! grep scale ../clever-commands"
           display: "Expected 'clever scale' command to NOT be called"
       register: tests_results
     - name: show results
index 6bb90d2ac97ecd04116bcd7402f900e8daf67237..258beaf5dcabb69bd5fef50d8b8ac62734a91055 100644 (file)
@@ -29,7 +29,7 @@
           flavors: { min: "nano", max: "XS" }
   post_tasks:
     - name: Check stubbed commands
-      command: "{{ item.cmd }}"
+      shell: "{{ item.cmd }}"
       ignore_errors: true
       vars:
         display: "{{ item.display }}"
@@ -38,7 +38,7 @@
           display: "Expected 'clever deploy' command to be called"
         - cmd: "grep scale ../clever-commands"
           display: "Expected 'clever scale' command to be called"
-        - cmd: "grep -v restart ../clever-commands"
+        - cmd: "! grep restart ../clever-commands"
           display: "Expected 'clever restart' command to NOT be called"
       register: tests_results
     - name: show results