mirror of
https://github.com/maxkratz/edgedb.git
synced 2024-09-16 18:59:05 +00:00
Support pgvector in CI for different pg versions (#5660)
This commit is contained in:
parent
865f77b4a6
commit
e8a1093245
7 changed files with 24 additions and 3 deletions
|
@ -46,7 +46,7 @@ jobs:
|
|||
remote-compiler: ''
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:${{ matrix.postgres-version }}-alpine
|
||||
image: fantix/pgvector:${{ matrix.postgres-version }}
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
options: >-
|
||||
|
|
2
.github/workflows/tests-pg-versions.yml
vendored
2
.github/workflows/tests-pg-versions.yml
vendored
|
@ -335,7 +335,7 @@ jobs:
|
|||
remote-compiler: ''
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:${{ matrix.postgres-version }}-alpine
|
||||
image: fantix/pgvector:${{ matrix.postgres-version }}
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
options: >-
|
||||
|
|
|
@ -640,7 +640,11 @@ class ClusterTestCase(BaseHTTPTestCase):
|
|||
)
|
||||
cls.has_create_database = cls.cluster.has_create_database()
|
||||
cls.has_create_role = cls.cluster.has_create_role()
|
||||
cls.is_superuser = cls.has_create_database and cls.has_create_role
|
||||
cls.backend_dsn = os.environ.get('EDGEDB_TEST_BACKEND_DSN')
|
||||
if getattr(cls, 'BACKEND_SUPERUSER', False):
|
||||
if not cls.is_superuser:
|
||||
raise unittest.SkipTest('skipped due to lack of superuser')
|
||||
|
||||
@classmethod
|
||||
async def tearDownSingleDB(cls):
|
||||
|
@ -1155,6 +1159,11 @@ class DatabaseTestCase(ClusterTestCase, ConnectedTestCaseMixin):
|
|||
if cls.INTERNAL_TESTMODE:
|
||||
script += '\nCONFIGURE SESSION SET __internal_testmode := true;'
|
||||
|
||||
if getattr(cls, 'BACKEND_SUPERUSER', False):
|
||||
is_superuser = getattr(cls, 'is_superuser', True)
|
||||
if not is_superuser:
|
||||
raise unittest.SkipTest('skipped due to lack of superuser')
|
||||
|
||||
schema = []
|
||||
# Incude the extensions before adding schemas.
|
||||
for ext in cls.EXTENSIONS:
|
||||
|
@ -1704,7 +1713,11 @@ def get_test_cases_setup(
|
|||
if not hasattr(case, 'get_setup_script'):
|
||||
continue
|
||||
|
||||
setup_script = case.get_setup_script()
|
||||
try:
|
||||
setup_script = case.get_setup_script()
|
||||
except unittest.SkipTest:
|
||||
continue
|
||||
|
||||
if not setup_script:
|
||||
continue
|
||||
|
||||
|
|
|
@ -924,6 +924,10 @@ class ParallelTextTestRunner:
|
|||
if not cluster.has_create_database():
|
||||
return []
|
||||
|
||||
if not cluster.has_create_role():
|
||||
for case in cases:
|
||||
case.is_superuser = False
|
||||
|
||||
stats = await tb.setup_test_cases(
|
||||
cases,
|
||||
conn,
|
||||
|
|
|
@ -57,6 +57,7 @@ class DumpTestCaseMixin:
|
|||
|
||||
class TestDumpV4(tb.StableDumpTestCase, DumpTestCaseMixin):
|
||||
EXTENSIONS = ["pgvector"]
|
||||
BACKEND_SUPERUSER = True
|
||||
|
||||
SCHEMA_DEFAULT = os.path.join(os.path.dirname(__file__), 'schemas',
|
||||
'dump_v4_default.esdl')
|
||||
|
|
|
@ -11935,6 +11935,8 @@ class TestEdgeQLDataMigrationNonisolated(EdgeQLDataMigrationTestCase):
|
|||
async def test_edgeql_migration_extension_01(self):
|
||||
# Test migrations getting from an array in integers to vector and then
|
||||
# revert to an array of floats.
|
||||
if not self.is_superuser:
|
||||
self.skipTest('the backend is not running with superuser')
|
||||
|
||||
await self.migrate('''
|
||||
module default {
|
||||
|
|
|
@ -27,6 +27,7 @@ from edb.tools import test
|
|||
|
||||
class TestEdgeQLVector(tb.QueryTestCase):
|
||||
EXTENSIONS = ['pgvector']
|
||||
BACKEND_SUPERUSER = True
|
||||
|
||||
SCHEMA = os.path.join(os.path.dirname(__file__), 'schemas',
|
||||
'pgvector.esdl')
|
||||
|
|
Loading…
Reference in a new issue