fix(coderd/database): sort template version variables and fix test flake (#21233)

Previously the GetTemplateVersionVariables query did not sort output,
relying on PostgreSQL on-disk ordering which is undeterministic.

Variables are now sorted by name because there is no alternative for
ordering.

Tests were adjusted to accommodate the new ordering, previously they
relied on data being written to disk in insert order.
This commit is contained in:
Mathias Fredriksson
2025-12-12 11:41:46 +00:00
committed by GitHub
parent 498c565fc7
commit 761dd55ee8
3 changed files with 111 additions and 128 deletions
@@ -23,4 +23,4 @@ VALUES
) RETURNING *;
-- name: GetTemplateVersionVariables :many
SELECT * FROM template_version_variables WHERE template_version_id = $1;
SELECT * FROM template_version_variables WHERE template_version_id = $1 ORDER BY name;