#26 Update test examples with results.yml [fix #3]
Merged 4 years ago by psss. Opened 4 years ago by psss.

file modified
+15 -4
@@ -129,14 +129,20 @@ 

    - name: Test block

      block:

        - name: Test that /proc/1 exists

-         shell: ls /proc > /tmp/test.log && grep -qw 1 /tmp/test.log

+         shell: |

+             ls /proc > /tmp/test.log || exit 1

+             grep -qw 1 /tmp/test.log && result=pass || result=fail

+             echo -e "results:\n- {result: $result, test: proc}" > /tmp/results.yml

  

      always:

        - name: Pull out the artifacts

          fetch:

            dest: "{{ artifacts }}/"

-           src: "/tmp/test.log"

+           src: "{{ item }}"

            flat: yes

+         with_items:

+           - /tmp/test.log

+           - /tmp/results.yml

  ----

  

  All tests have an artifacts directory where they place their output.
@@ -231,14 +237,19 @@ 

    - name: Test block

      block:

        - name: Execute the tests

-         shell: exec > /tmp/test.log 2>&1 && /usr/local/bin/test-simple

+         shell: |

+           /usr/local/bin/test-simple &> /tmp/test.log && result=pass || result=fail

+           echo -e "results:\n- {result: $result, test: simple}" > /tmp/results.yml

  

      always:

        - name: Pull out the logs

          fetch:

            dest: "{{ artifacts }}/"

-           src: "/tmp/test.log"

+           src: "{{ item }}"

            flat: yes

+         with_items:

+           - /tmp/test.log

+           - /tmp/results.yml

  ----

  

  All tests have an artifacts directory where they place their output.

Include results.yml file creation in examples showing how to
write and wrap tests. Is part of fixing #3.

Thanks for the review, Bruno. Merging.

Pull-Request has been merged by psss

4 years ago
Metadata