Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move ansible migration tests to nix flake check #1493

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

steve-chavez
Copy link
Member

@steve-chavez steve-chavez commented Mar 24, 2025

Problem

Currently the ansible migration tests are only done on CI, and this takes about 52 mins, which is terrible for development speed.

This is also needed for passing CI failures on #1489. Also related to #1492.

Solution

Migration tests are now run on nix flake check, which can be used locally and on CI.

  • tests for some extensions are adjusted to run conditionally on non-orioledb
    • preserves behavior from the ansible tests
  • ebssurrogate/files/unit-tests/unit-test-01.sql is deleted
    • the same behavior is tested already on nix/test/prime.sql

Also cleanup ansible/tasks/test-image.yml:

  • remove pg_prove since it's no longer used
  • remove migration tests since they're now tested with nix flake check
  • removed unit test run since unit-test-01.sql is no longer used (see above)

When running `flake check` there was an error:
```
error: undefined variable 'samrose'
```
Remove `maintainers = with maintainers; [ samrose ];` to solve this.
Comment on lines -91 to -108
- name: Remove specified extension files from extensions directory
ansible.builtin.find:
paths: /tmp/migrations/tests/extensions
patterns:
- '*timescaledb*.sql'
- '*plv8*.sql'
- '*postgis*.sql'
- '*pgrouting*.sql'
register: files_to_remove
when: is_psql_oriole

- name: Delete matched extension files
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
loop: "{{ files_to_remove.files }}"
when: is_psql_oriole
become: yes
Copy link
Member Author

@steve-chavez steve-chavez Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These exceptions from orioledb are now done properly using SQL on each test by checking if the orioledb extension is loaded. (there's no file removal needed)


BEGIN;
-- address standardizer creates a table in extensions schema, owned by supabase_admin
create extension if not exists address_standardizer_data_us with schema extensions;
Copy link
Member Author

@steve-chavez steve-chavez Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This create extension was removed because it's already included on

create extension if not exists address_standardizer_data_us;

but the logic that tests the postgres role is able to select us_lex is still preserved on the following lines.

migration tests are now run on `nix flake check`:

- tests for some extensions are adjusted to run conditionally on non-orioledb
  + preserves behavior from the ansible tests
- ebssurrogate/files/unit-tests/unit-test-01.sql are deleted
  + these tests are already included nix/test/prime.sql

cleanup ansible/tasks/test-image.yml:

- remove pg_prove since it's no longer used
- remove unit tests since the same logic is already included
  nix/tests/prime.sql
- remove migration tests since it's now tested with nix flake check
@steve-chavez steve-chavez changed the title chore: mv ansible migration test to nix flake check chore: move ansible migration tests to nix flake check Mar 25, 2025
@steve-chavez steve-chavez marked this pull request as ready for review March 25, 2025 01:17
@steve-chavez steve-chavez requested review from a team as code owners March 25, 2025 01:17
@samrose samrose self-requested a review March 25, 2025 11:24
@steve-chavez steve-chavez merged commit 868691f into develop Mar 25, 2025
12 checks passed
@steve-chavez steve-chavez deleted the migtests-nix branch March 25, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants