Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Thank you!
-->

* **async_gaussdb version**:
* **PostgreSQL version**:
* **Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?**:
* **GaussDB version**:
* **Do you use a GaussDB SaaS? If so, which? Can you reproduce
the issue with a local GaussDB install?**:
* **Python version**:
* **Platform**:
* **Do you use pgbouncer?**:
Expand Down
62 changes: 0 additions & 62 deletions .github/workflows/install-postgres.sh

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
jobs:
test-platforms:
# NOTE: this matrix is for testing various combinations of Python and OS
# versions on the system-installed PostgreSQL version (which is usually
# fairly recent). For a PostgreSQL version matrix see the test-postgres
# versions on the system-installed GaussDB version (which is usually
# fairly recent). For a GaussDB version matrix see the test-gaussdb
# job.
strategy:
matrix:
Expand Down Expand Up @@ -100,11 +100,11 @@ jobs:
if: "!steps.release.outputs.is_release"
env:
LOOP_IMPL: ${{ matrix.loop }}
PGHOST: "127.0.0.1"
PGPORT: 5432
PGUSER: "testuser"
PGPASSWORD: "Test@123"
PGDATABASE: "test"
GAUSSDBHOST: "127.0.0.1"
GAUSSDBPORT: 5432
GAUSSDBUSER: "testuser"
GAUSSDBPASSWORD: "Test@123"
GAUSSDBDATABASE: "test"
run: |
if [ "${LOOP_IMPL}" = "uvloop" ]; then
env USE_UVLOOP=1 python -m unittest -v tests.suite
Expand Down
46 changes: 23 additions & 23 deletions async_gaussdb/_testbase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@


import async_gaussdb
from async_gaussdb import cluster as pg_cluster
from async_gaussdb import connection as pg_connection
from async_gaussdb import pool as pg_pool
from async_gaussdb import cluster as gaussdb_cluster
from async_gaussdb import connection as gaussdb_connection
from async_gaussdb import pool as gaussdb_pool

from . import fuzzer

Expand Down Expand Up @@ -234,7 +234,7 @@ def _get_initdb_options(initdb_options=None):

# Make the default superuser name stable.
if 'username' not in initdb_options:
initdb_options['username'] = 'postgres'
initdb_options['username'] = 'root'

return initdb_options

Expand All @@ -243,13 +243,13 @@ def _init_default_cluster(initdb_options=None):
global _default_cluster

if _default_cluster is None:
pg_host = os.environ.get('PGHOST')
if pg_host:
gaussdb_host = os.environ.get('GAUSSDBHOST')
if gaussdb_host:
# Using existing cluster, assuming it is initialized and running
_default_cluster = pg_cluster.RunningCluster()
_default_cluster = gaussdb_cluster.RunningCluster()
else:
_default_cluster = _init_cluster(
pg_cluster.TempCluster,
gaussdb_cluster.TempCluster,
cluster_kwargs={
"data_dir_suffix": ".apgtest",
},
Expand All @@ -275,8 +275,8 @@ def create_pool(dsn=None, *,
setup=None,
init=None,
loop=None,
pool_class=pg_pool.Pool,
connection_class=pg_connection.Connection,
pool_class=gaussdb_pool.Pool,
connection_class=gaussdb_connection.Connection,
record_class=async_gaussdb.Record,
**connect_kwargs):
return pool_class(
Expand All @@ -302,7 +302,7 @@ def get_server_settings(cls):
'log_connections': 'on'
}

if cls.cluster.get_pg_version() >= (11, 0):
if cls.cluster.get_gaussdb_version() >= (11, 0):
# JITting messes up timing tests, and
# is not essential for testing.
settings['jit'] = 'off'
Expand Down Expand Up @@ -349,17 +349,17 @@ def get_connection_spec(cls, kwargs={}):
if kwargs.get('dsn'):
conn_spec.pop('host')
conn_spec.update(kwargs)
if not os.environ.get('PGHOST') and not kwargs.get('dsn'):
if not os.environ.get('GAUSSDBHOST') and not kwargs.get('dsn'):
if 'database' not in conn_spec:
conn_spec['database'] = 'postgres'
if 'user' not in conn_spec:
conn_spec['user'] = 'postgres'
conn_spec['user'] = 'root'
return conn_spec

@classmethod
def connect(cls, **kwargs):
conn_spec = cls.get_connection_spec(kwargs)
return pg_connection.connect(**conn_spec, loop=cls.loop)
return gaussdb_connection.connect(**conn_spec, loop=cls.loop)

def setUp(self):
super().setUp()
Expand All @@ -371,8 +371,8 @@ def tearDown(self):
pool.terminate()
self._pools = []

def create_pool(self, pool_class=pg_pool.Pool,
connection_class=pg_connection.Connection, **kwargs):
def create_pool(self, pool_class=gaussdb_pool.Pool,
connection_class=gaussdb_connection.Connection, **kwargs):
conn_spec = self.get_connection_spec(kwargs)
pool = create_pool(loop=self.loop, pool_class=pool_class,
connection_class=connection_class, **conn_spec)
Expand Down Expand Up @@ -457,7 +457,7 @@ class HotStandbyTestCase(ClusterTestCase):

@classmethod
def setup_cluster(cls):
cls.master_cluster = cls.new_cluster(pg_cluster.TempCluster)
cls.master_cluster = cls.new_cluster(gaussdb_cluster.TempCluster)
cls.start_cluster(
cls.master_cluster,
server_settings={
Expand All @@ -471,7 +471,7 @@ def setup_cluster(cls):
try:
con = cls.loop.run_until_complete(
cls.master_cluster.connect(
database='postgres', user='postgres', loop=cls.loop))
database='postgres', user='root', loop=cls.loop))

cls.loop.run_until_complete(
con.execute('''
Expand All @@ -483,7 +483,7 @@ def setup_cluster(cls):
conn_spec = cls.master_cluster.get_connection_spec()

cls.standby_cluster = cls.new_cluster(
pg_cluster.HotStandbyCluster,
gaussdb_cluster.HotStandbyCluster,
cluster_kwargs={
'master': conn_spec,
'replication_user': 'replication'
Expand All @@ -506,11 +506,11 @@ def get_cluster_connection_spec(cls, cluster, kwargs={}):
if kwargs.get('dsn'):
conn_spec.pop('host')
conn_spec.update(kwargs)
if not os.environ.get('PGHOST') and not kwargs.get('dsn'):
if not os.environ.get('GAUSSDBHOST') and not kwargs.get('dsn'):
if 'database' not in conn_spec:
conn_spec['database'] = 'postgres'
if 'user' not in conn_spec:
conn_spec['user'] = 'postgres'
conn_spec['user'] = 'root'
return conn_spec

@classmethod
Expand All @@ -532,12 +532,12 @@ def get_connection_spec(cls, kwargs={}):
@classmethod
def connect_primary(cls, **kwargs):
conn_spec = cls.get_cluster_connection_spec(cls.master_cluster, kwargs)
return pg_connection.connect(**conn_spec, loop=cls.loop)
return gaussdb_connection.connect(**conn_spec, loop=cls.loop)

@classmethod
def connect_standby(cls, **kwargs):
conn_spec = cls.get_cluster_connection_spec(
cls.standby_cluster,
kwargs
)
return pg_connection.connect(**conn_spec, loop=cls.loop)
return gaussdb_connection.connect(**conn_spec, loop=cls.loop)
2 changes: 1 addition & 1 deletion async_gaussdb/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

import typing

__version__: typing.Final = '0.30.2'
__version__: typing.Final = '0.30.3'
Loading