-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Postgres commit sha to Postgres version (#4603)
## Problem Ref https://neondb.slack.com/archives/C036U0GRMRB/p1688122168477729 ## Summary of changes - Add sha from postgres repo into postgres version string (via `--with-extra-version`) - Add a test that Postgres version matches the expected one - Remove build-time hard check and allow only related tests to fail
- Loading branch information
Showing
5 changed files
with
46 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import json | ||
import re | ||
from pathlib import Path | ||
|
||
from fixtures.neon_fixtures import PgBin | ||
from fixtures.pg_version import PgVersion | ||
|
||
|
||
def test_postgres_version(base_dir: Path, pg_bin: PgBin, pg_version: PgVersion): | ||
"""Test that Postgres version matches the one we expect""" | ||
|
||
with (base_dir / "vendor" / "revisions.json").open() as f: | ||
expected_revisions = json.load(f) | ||
|
||
output_prefix = pg_bin.run_capture(["postgres", "--version"], with_command_header=False) | ||
stdout = Path(f"{output_prefix}.stdout") | ||
assert stdout.exists(), "postgres --version didn't print anything to stdout" | ||
|
||
with stdout.open() as f: | ||
output = f.read().strip() | ||
|
||
# `postgres --version` prints something like "postgres (PostgreSQL) 15.6 (85d809c124a898847a97d66a211f7d5ef4f8e0cb)". | ||
pattern = r"postgres \(PostgreSQL\) (?P<version>\d+\.\d+) \((?P<commit>[0-9a-f]{40})\)" | ||
match = re.search(pattern, output, re.IGNORECASE) | ||
assert match is not None, f"Can't parse {output} with {pattern}" | ||
|
||
version = match.group("version") | ||
commit = match.group("commit") | ||
|
||
assert ( | ||
pg_version.v_prefixed in expected_revisions | ||
), f"Version `{pg_version.v_prefixed}` doesn't exist in `vendor/revisions.json`, please update it if these changes are intentional" | ||
|
||
msg = f"Unexpected Postgres {pg_version} version: `{output}`, please update `vendor/revisions.json` if these changes are intentional" | ||
assert [version, commit] == expected_revisions[pg_version.v_prefixed], msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"postgres-v16": "8ef3c33aa01631e17cb24a122776349fcc777b46", | ||
"postgres-v15": "f0d6b0ef7581bd78011832e23d8420a7d2c8a83a", | ||
"postgres-v14": "d6f7e2c604bfc7cbc4c46bcea0a8e800f4bc778a" | ||
"v16": ["16.2", "8ef3c33aa01631e17cb24a122776349fcc777b46"], | ||
"v15": ["15.6", "f0d6b0ef7581bd78011832e23d8420a7d2c8a83a"], | ||
"v14": ["14.11", "d6f7e2c604bfc7cbc4c46bcea0a8e800f4bc778a"] | ||
} |
51376ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3051 tests run: 2907 passed, 4 failed, 140 skipped (full report)
Failures on Postgres 14
test_pgbench_intensive_init_workload[neon_off-github-actions-selfhosted-1000]
: releasetest_heavy_write_workload[neon_on-github-actions-selfhosted-10-5-5]
: releasetest_storage_controller_many_tenants[github-actions-selfhosted]
: releasetest_bulk_tenant_create[github-actions-selfhosted-5]
: releaseCode coverage* (full report)
functions
:31.3% (6246 of 19976 functions)
lines
:46.7% (46762 of 100097 lines)
* collected from Rust tests only
51376ef at 2024-05-07T16:59:49.466Z :recycle: