|
1 |
| -- name: install pg_prove |
2 |
| - apt: |
3 |
| - pkg: |
4 |
| - - libtap-parser-sourcehandler-pgtap-perl |
5 |
| - |
6 | 1 | - name: Temporarily disable PG Sodium references in config
|
7 | 2 | become: yes
|
8 | 3 | become_user: postgres
|
|
22 | 17 | LC_CTYPE: en_US.UTF-8
|
23 | 18 | LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
|
24 | 19 |
|
| 20 | + |
| 21 | +- name: check contents of unit test file |
| 22 | + become: yes |
| 23 | + become_user: postgres |
| 24 | + shell: cat /home/postgres/unit-test-01.sql && ls -l /home/postgres/unit-test-01.sql |
| 25 | + |
| 26 | +- name: verify postgres server is running |
| 27 | + become: yes |
| 28 | + become_user: postgres |
| 29 | + shell: psql -U postgres -h localhost -c "SELECT version();" |
| 30 | + register: pg_isready |
| 31 | + failed_when: pg_isready.rc != 0 |
| 32 | + args: |
| 33 | + executable: /bin/bash |
| 34 | + environment: |
| 35 | + LANG: en_US.UTF-8 |
| 36 | + LANGUAGE: en_US.UTF-8 |
| 37 | + LC_ALL: en_US.UTF-8 |
| 38 | + LC_CTYPE: en_US.UTF-8 |
| 39 | + LOCALE_ARCHIVE: /usr/lib/locale/locale-archive |
| 40 | + PATH: /home/postgres/.nix-profile/bin:$PATH |
| 41 | + |
25 | 42 | - name: Run Unit tests (with filename unit-test-*) on Postgres Database
|
26 |
| - shell: /usr/bin/pg_prove -U postgres -h localhost -d postgres -v /tmp/unit-tests/unit-test-01.sql |
| 43 | + become: yes |
| 44 | + become_user: postgres |
| 45 | + shell: source /home/postgres/.bashrc && /home/postgres/.nix-profile/bin/pg_prove -U postgres -h localhost -d postgres -f /home/postgres/unit-test-01.sql |
27 | 46 | register: retval
|
28 | 47 | failed_when: retval.rc != 0
|
| 48 | + args: |
| 49 | + executable: /bin/bash |
| 50 | + environment: |
| 51 | + LANG: en_US.UTF-8 |
| 52 | + LANGUAGE: en_US.UTF-8 |
| 53 | + LC_ALL: en_US.UTF-8 |
| 54 | + LC_CTYPE: en_US.UTF-8 |
| 55 | + LOCALE_ARCHIVE: /usr/lib/locale/locale-archive |
| 56 | + PATH: /home/postgres/.nix-profile/bin:$PATH |
29 | 57 |
|
30 | 58 | - name: Run migrations tests
|
31 |
| - shell: /usr/bin/pg_prove -U supabase_admin -h localhost -d postgres -v tests/test.sql |
| 59 | + shell: /home/postgres/.nix-profile/bin/pg_prove -U supabase_admin -h localhost -d postgres -v tests/test.sql |
32 | 60 | register: retval
|
33 | 61 | failed_when: retval.rc != 0
|
34 | 62 | args:
|
| 63 | + executable: /bin/bash |
35 | 64 | chdir: /tmp/migrations
|
| 65 | + environment: |
| 66 | + LANG: en_US.UTF-8 |
| 67 | + LANGUAGE: en_US.UTF-8 |
| 68 | + LC_ALL: en_US.UTF-8 |
| 69 | + LC_CTYPE: en_US.UTF-8 |
| 70 | + LOCALE_ARCHIVE: /usr/lib/locale/locale-archive |
| 71 | + PATH: /home/postgres/.nix-profile/bin:$PATH |
36 | 72 |
|
37 | 73 | - name: Re-enable PG Sodium references in config
|
38 | 74 | become: yes
|
|
55 | 91 | LC_CTYPE: en_US.UTF-8
|
56 | 92 | LOCALE_ARCHIVE: /usr/lib/locale/locale-archive
|
57 | 93 |
|
58 |
| -- name: remove pg_prove |
59 |
| - apt: |
60 |
| - pkg: |
61 |
| - - libtap-parser-sourcehandler-pgtap-perl |
62 |
| - state: absent |
63 |
| - autoremove: yes |
| 94 | +# - name: remove pg_prove |
| 95 | +- name: Remove pg_prove |
| 96 | + become: yes |
| 97 | + shell: | |
| 98 | + sudo -u postgres bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile remove pg_prove" |
64 | 99 |
|
65 | 100 | - name: Stop Postgres Database
|
66 | 101 | become: yes
|
|
0 commit comments