Skip to content

refactor nixos tests to use our config, build, migrations, init etc #2038

Merged
samrose merged 3 commits into
developfrom
supabase-nixos-tests
Feb 13, 2026
Merged

refactor nixos tests to use our config, build, migrations, init etc #2038
samrose merged 3 commits into
developfrom
supabase-nixos-tests

Conversation

@samrose
Copy link
Copy Markdown
Collaborator

@samrose samrose commented Feb 6, 2026

Started with refactor of pg_repack to use this new module. Will then use this as basis to refactor/add the rest.

Will then update this PR description with the outcome

@samrose samrose force-pushed the supabase-nixos-tests branch 2 times, most recently from a213177 to 502973e Compare February 8, 2026 02:23
@samrose samrose force-pushed the supabase-nixos-tests branch from 7646240 to fb2478f Compare February 12, 2026 20:25
@samrose samrose marked this pull request as ready for review February 12, 2026 20:25
@samrose samrose requested review from a team as code owners February 12, 2026 20:25
@encima
Copy link
Copy Markdown
Member

encima commented Feb 13, 2026

Could we also update the documents for the running of the tests and how they currently work with this PR?

Comment thread nix/ext/tests/lib.nix
'';

# Source paths for ansible config files and migrations
ansibleConfigDir = builtins.path {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is very cool (unifying nix with ansible more closely) but it does mean that changes from ansible have to be incorporated here and vice-versa; is there a way to unify it ? Maybe pulling in from the Ansible files?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes, because we're using ansible config files as source of truth if someone reorganized where they live path-wise, would need to update this too. However they were made uniform fairly recently, and so we should not have a need to move them around. The alternative would be to turn them into a nix module, which we can't get into doing in this PR, as it would greatly increase the scope of it.

Comment thread nix/ext/tests/lib.nix

# Version-specific adjustments (mirroring run-server.sh.in:250-295)
${
if majorVersion == "17" || majorVersion == "orioledb-17" then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also like this handling of the config based on major version in a single place! Could be useful to do this outside of tests as well maybe?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We definitely do this, although I may be missing specifics that you are thinking about.

Comment thread nix/ext/tests/vault.nix

test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory, support_upgrade)
with subtest("Verify PostgreSQL 15 is our custom build"):
pg_version = server.succeed(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you can also check in the data dir under PG_VERSION which saves a connection

Comment thread nix/ext/tests/vault.nix
f"Expected version ${testLib.expectedVersions."17"}, got: {pg_version}"
)

postgres_pid = server.succeed(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Most extensions have the same boilerplate for "check version" and "check is running", it seems like these would be better as "pre tests" and the extensions themselves would just specify the PG versions they should run on (as they currently do)

@samrose samrose added this pull request to the merge queue Feb 13, 2026
Merged via the queue into develop with commit 21338c8 Feb 13, 2026
34 checks passed
@samrose samrose deleted the supabase-nixos-tests branch February 13, 2026 21:21
encima pushed a commit that referenced this pull request Feb 23, 2026
…2038)

* feat: custom module for nixos test of postgres

* fix: include orioledb in vm test

* feat: updating tests to use lib.nix supabase settings
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.

3 participants