Skip to content

Commit a43e243

Browse files
committed
test: update lint 22
1 parent 6b6e4ea commit a43e243

File tree

2 files changed

+47
-14
lines changed

2 files changed

+47
-14
lines changed

test/expected/0022_extension_versions_outdated.out

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,40 @@ begin;
55
------+-------+-------+--------+------------+-------------+--------+-------------+----------+-----------
66
(0 rows)
77

8-
-- Note: We cannot easily create a test that shows outdated extensions
9-
-- because we cannot install older versions of extensions in a test environment.
10-
-- Our test image doesn't have multiple extension versions available.
11-
-- The test will primarily verify that the query executes without error
12-
-- and returns the expected column structure.
13-
-- This lint was tested manually with real outdated extensions.
8+
create extension amcheck version '1.0';
149
-- Verify the query structure and column names
1510
select
1611
count(*) as total_outdated_extensions
1712
from lint."0022_extension_versions_outdated";
1813
total_outdated_extensions
1914
---------------------------
20-
0
15+
1
2116
(1 row)
2217

2318
-- Test that the query returns proper column structure
2419
-- This will help ensure the lint is properly formed
20+
select
21+
name,
22+
title,
23+
level,
24+
facing,
25+
categories,
26+
description,
27+
detail,
28+
remediation,
29+
metadata,
30+
cache_key
31+
from lint."0022_extension_versions_outdated";
32+
name | title | level | facing | categories | description | detail | remediation | metadata | cache_key
33+
-----------------------------+-----------------------------+-------+----------+------------+--------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+-----------------------------------------
34+
extension_versions_outdated | Extension Versions Outdated | WARN | EXTERNAL | {SECURITY} | Detects extensions that are not using the default (recommended) version. | Extension `amcheck` is using version `1.0` but version `1.3` is available. Using outdated extension versions may expose the database to security vulnerabilities. | https://supabase.com/docs/guides/database/database-linter?lint=0022_extension_versions_outdated | {"extension_name": "amcheck", "default_version": "1.3", "installed_version": "1.0"} | extension_versions_outdated_amcheck_1.0
35+
(1 row)
36+
37+
drop extension amcheck;
38+
39+
-- Versions that aren't in pg_available_extension_versions are ignored
40+
create extension amcheck;
41+
update pg_extension set extversion = 'foo' where extname = 'amcheck';
2542
select
2643
name,
2744
title,
@@ -38,4 +55,5 @@ begin;
3855
------+-------+-------+--------+------------+-------------+--------+-------------+----------+-----------
3956
(0 rows)
4057

58+
drop extension amcheck;
4159
rollback;

test/sql/0022_extension_versions_outdated.sql

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ begin;
33
-- 0 issues initially (all extensions should be up to date)
44
select * from lint."0022_extension_versions_outdated";
55

6-
-- Note: We cannot easily create a test that shows outdated extensions
7-
-- because we cannot install older versions of extensions in a test environment.
8-
-- Our test image doesn't have multiple extension versions available.
9-
-- The test will primarily verify that the query executes without error
10-
-- and returns the expected column structure.
11-
-- This lint was tested manually with real outdated extensions.
6+
create extension amcheck version '1.0';
127

138
-- Verify the query structure and column names
149
select
@@ -30,4 +25,24 @@ begin;
3025
cache_key
3126
from lint."0022_extension_versions_outdated";
3227

33-
rollback;
28+
drop extension amcheck;
29+
30+
-- Versions that aren't in pg_available_extension_versions are ignored
31+
create extension amcheck;
32+
update pg_extension set extversion = 'foo' where extname = 'amcheck';
33+
34+
select
35+
name,
36+
title,
37+
level,
38+
facing,
39+
categories,
40+
description,
41+
detail,
42+
remediation,
43+
metadata,
44+
cache_key
45+
from lint."0022_extension_versions_outdated";
46+
47+
drop extension amcheck;
48+
rollback;

0 commit comments

Comments
 (0)