Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tests are based on pytest#192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
41 commits
Select commitHold shift + click to select a range
f37c299
Using pytest [pytest.raises]
dmitry-lipetskFeb 23, 2025
53e468e
Using pytest [pytest.skip]
dmitry-lipetskFeb 23, 2025
12d702a
Using pytest [assertIsNotNone]
dmitry-lipetskFeb 23, 2025
1cb664e
Using pytest [assertFalse]
dmitry-lipetskFeb 23, 2025
e2e7e8b
Using pytest [assertTrue]
dmitry-lipetskFeb 23, 2025
89784a8
Using pytest [assertEqual]
dmitry-lipetskFeb 23, 2025
2252d60
Using pytest [assertNotEqual]
dmitry-lipetskFeb 23, 2025
e8aad3d
Using pytest [assertGreaterEqual]
dmitry-lipetskFeb 23, 2025
eaaa276
Using pytest [assertGreater]
dmitry-lipetskFeb 23, 2025
4afbe00
Using pytest [assertIn]
dmitry-lipetskFeb 23, 2025
a8e57ae
Using pytest [assertListEqual]
dmitry-lipetskFeb 23, 2025
df199b9
unittest is not used
dmitry-lipetskFeb 23, 2025
a82cf3d
Code style (flake8)
dmitry-lipetskFeb 23, 2025
9745bc4
Merge commit '38b3dc3697d229b6668217f2f57825379c7f2e23' into D2025022…
dmitry-lipetskFeb 23, 2025
27c4f40
Execution signature is removed
dmitry-lipetskFeb 24, 2025
ae41d16
run_tests.sh installs pytest
dmitry-lipetskFeb 24, 2025
a14b3d7
run_tests.sh is updated
dmitry-lipetskFeb 24, 2025
e6f4448
Total refactoring of tests
dmitry-lipetskFeb 24, 2025
842bc08
Code style (flake8)
dmitry-lipetskFeb 24, 2025
d9afdcc
Merge commit 'de738f9fd8d52345677903bface575d41cbe539c' into D2025022…
dmitry-lipetskFeb 24, 2025
027d2ea
Merge branch 'D20250224_002--os_ops-in-free_utilities' into D20250223…
dmitry-lipetskFeb 24, 2025
969e49d
Root __init__.py is added
dmitry-lipetskFeb 24, 2025
6e2820d
Code style (flake8)
dmitry-lipetskFeb 24, 2025
588b28b
Merge remote-tracking branch 'origin/D20250224_002--os_ops-in-free_ut…
dmitry-lipetskFeb 24, 2025
e4e8909
pytest.ini is added
dmitry-lipetskFeb 24, 2025
66860d0
TestgresTests::test_ports_management is corrected
dmitry-lipetskFeb 24, 2025
aaaa677
coding: utf-8
dmitry-lipetskFeb 24, 2025
60bb4c5
Cleanup
dmitry-lipetskFeb 24, 2025
2d2532c
CI runs all the tests of testgres.
dmitry-lipetskFeb 24, 2025
537a9ac
Add install ssh
Feb 24, 2025
1f99813
Revert "Add install ssh"
dmitry-lipetskFeb 25, 2025
41455d6
Revert "CI runs all the tests of testgres."
dmitry-lipetskFeb 25, 2025
1c43810
Merge commit '669e134ff65b99cd285500e5f362633fc8d50e4e' into D2025022…
dmitry-lipetskFeb 25, 2025
47a51a8
Test of probackup plugin is restored
dmitry-lipetskFeb 25, 2025
f7f163d
The test suite of a probackup plugin is based on pytest
dmitry-lipetskFeb 25, 2025
ed7b187
Probackup plugin is updated
dmitry-lipetskFeb 25, 2025
8af4a49
CI test use 4 cores
dmitry-lipetskFeb 25, 2025
d35ca43
testgres.plugins.probackup2.Init was restored [thanks to Yuri Sokolov]
dmitry-lipetskFeb 25, 2025
181126b
pytest.ini is updated [testpaths]
dmitry-lipetskFeb 25, 2025
d08f659
test_child_pids (local, remote) is updated
dmitry-lipetskFeb 25, 2025
e803146
test_child_process_dies is updated
dmitry-lipetskFeb 25, 2025
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
PrevPrevious commit
NextNext commit
Using pytest [pytest.skip]
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedFeb 23, 2025
commit53e468e28b2851b42c90c5886bf89f6528b62c9b
52 changes: 45 additions & 7 deletionstests/test_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@
import unittest
import pytest
import psutil
import platform

import logging.config

Expand DownExpand Up@@ -144,10 +145,13 @@ def test_init_after_cleanup(self):
node.cleanup()
node.init().start().execute('select 1')

@unittest.skipUnless(util_exists('pg_resetwal.exe' if os.name == 'nt' else 'pg_resetwal'), 'pgbench might be missing')
@unittest.skipUnless(pg_version_ge('9.6'), 'requires 9.6+')
#@unittest.skipUnless(util_exists('pg_resetwal.exe' if os.name == 'nt' else 'pg_resetwal'), 'pgbench might be missing')
#@unittest.skipUnless(pg_version_ge('9.6'), 'requires 9.6+')
def test_init_unique_system_id(self):
# this function exists in PostgreSQL 9.6+
__class__.helper__skip_test_if_util_not_exist("pg_resetwal")
__class__.helper__skip_test_if_pg_version_is_not_ge("9.6")

query = 'select system_identifier from pg_control_system()'

with scoped_config(cache_initdb=False):
Expand DownExpand Up@@ -453,8 +457,10 @@ def test_replicate(self):
res = node.execute('select * from test')
self.assertListEqual(res, [])

@unittest.skipUnless(pg_version_ge('9.6'), 'requires 9.6+')
#@unittest.skipUnless(pg_version_ge('9.6'), 'requires 9.6+')
def test_synchronous_replication(self):
__class__.helper__skip_test_if_pg_version_is_not_ge("9.6")

with get_new_node() as master:
old_version = not pg_version_ge('9.6')

Expand DownExpand Up@@ -494,8 +500,10 @@ def test_synchronous_replication(self):
res = standby1.safe_psql('select count(*) from abc')
self.assertEqual(rm_carriage_returns(res), b'1000000\n')

@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
#@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
def test_logical_replication(self):
__class__.helper__skip_test_if_pg_version_is_not_ge("10")

with get_new_node() as node1, get_new_node() as node2:
node1.init(allow_logical=True)
node1.start()
Expand DownExpand Up@@ -563,9 +571,11 @@ def test_logical_replication(self):
res = node2.execute('select * from test2')
self.assertListEqual(res, [('a', ), ('b', )])

@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
#@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
def test_logical_catchup(self):
""" Runs catchup for 100 times to be sure that it is consistent """
__class__.helper__skip_test_if_pg_version_is_not_ge("10")

with get_new_node() as node1, get_new_node() as node2:
node1.init(allow_logical=True)
node1.start()
Expand All@@ -589,8 +599,10 @@ def test_logical_catchup(self):
)])
node1.execute('delete from test')

@unittest.skipIf(pg_version_ge('10'), 'requires <10')
#@unittest.skipIf(pg_version_ge('10'), 'requires <10')
def test_logical_replication_fail(self):
__class__.helper__skip_test_if_pg_version_is_ge("10")

with get_new_node() as node:
with pytest.raises(expected_exception=InitNodeException):
node.init(allow_logical=True)
Expand DownExpand Up@@ -766,8 +778,10 @@ def test_logging(self):
master.restart()
self.assertTrue(master._logger.is_alive())

@unittest.skipUnless(util_exists('pgbench.exe' if os.name == 'nt' else 'pgbench'), 'pgbench might be missing')
#@unittest.skipUnless(util_exists('pgbench.exe' if os.name == 'nt' else 'pgbench'), 'pgbench might be missing')
def test_pgbench(self):
__class__.helper__skip_test_if_util_not_exist("pgbench")

with get_new_node().init().start() as node:

# initialize pgbench DB and run benchmarks
Expand DownExpand Up@@ -1312,6 +1326,30 @@ def test_set_auto_conf(self):
x[0] + " stored wrong"
)

@staticmethod
def helper__skip_test_if_util_not_exist(name: str):
assert type(name) == str # noqa: E721

if platform.system().lower() == "windows":
name2 = name + ".exe"
else:
name2 = name

if not util_exists(name2):
pytest.skip('might be missing')

@staticmethod
def helper__skip_test_if_pg_version_is_not_ge(version: str):
assert type(version) == str # noqa: E721
if not pg_version_ge(version):
pytest.skip('requires {0}+'.format(version))

@staticmethod
def helper__skip_test_if_pg_version_is_ge(version: str):
assert type(version) == str # noqa: E721
if pg_version_ge(version):
pytest.skip('requires <{0}'.format(version))


if __name__ == '__main__':
if os.environ.get('ALT_CONFIG'):
Expand Down
45 changes: 38 additions & 7 deletionstests/test_simple_remote.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -205,10 +205,13 @@ def test_init_after_cleanup(self):
node.cleanup()
node.init().start().execute('select 1')

@unittest.skipUnless(util_exists('pg_resetwal'), 'might be missing')
@unittest.skipUnless(pg_version_ge('9.6'), 'requires 9.6+')
#@unittest.skipUnless(util_exists('pg_resetwal'), 'might be missing')
#@unittest.skipUnless(pg_version_ge('9.6'), 'requires 9.6+')
def test_init_unique_system_id(self):
# this function exists in PostgreSQL 9.6+
__class__.helper__skip_test_if_util_not_exist("pg_resetwal")
__class__.helper__skip_test_if_pg_version_is_not_ge('9.6')

query = 'select system_identifier from pg_control_system()'

with scoped_config(cache_initdb=False):
Expand DownExpand Up@@ -507,8 +510,10 @@ def test_replicate(self):
res = node.execute('select * from test')
self.assertListEqual(res, [])

@unittest.skipUnless(pg_version_ge('9.6'), 'requires 9.6+')
#@unittest.skipUnless(pg_version_ge('9.6'), 'requires 9.6+')
def test_synchronous_replication(self):
__class__.helper__skip_test_if_pg_version_is_not_ge("9.6")

with get_remote_node(conn_params=conn_params) as master:
old_version = not pg_version_ge('9.6')

Expand DownExpand Up@@ -548,8 +553,10 @@ def test_synchronous_replication(self):
res = standby1.safe_psql('select count(*) from abc')
self.assertEqual(res, b'1000000\n')

@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
#@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
def test_logical_replication(self):
__class__.helper__skip_test_if_pg_version_is_not_ge("10")

with get_remote_node(conn_params=conn_params) as node1, get_remote_node(conn_params=conn_params) as node2:
node1.init(allow_logical=True)
node1.start()
Expand DownExpand Up@@ -617,9 +624,11 @@ def test_logical_replication(self):
res = node2.execute('select * from test2')
self.assertListEqual(res, [('a',), ('b',)])

@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
#@unittest.skipUnless(pg_version_ge('10'), 'requires 10+')
def test_logical_catchup(self):
""" Runs catchup for 100 times to be sure that it is consistent """
__class__.helper__skip_test_if_pg_version_is_not_ge("10")

with get_remote_node(conn_params=conn_params) as node1, get_remote_node(conn_params=conn_params) as node2:
node1.init(allow_logical=True)
node1.start()
Expand All@@ -643,8 +652,10 @@ def test_logical_catchup(self):
)])
node1.execute('delete from test')

@unittest.skipIf(pg_version_ge('10'), 'requires <10')
#@unittest.skipIf(pg_version_ge('10'), 'requires <10')
def test_logical_replication_fail(self):
__class__.helper__skip_test_if_pg_version_is_ge("10")

with get_remote_node(conn_params=conn_params) as node:
with pytest.raises(expected_exception=InitNodeException):
node.init(allow_logical=True)
Expand DownExpand Up@@ -820,8 +831,10 @@ def test_logging(self):
master.restart()
self.assertTrue(master._logger.is_alive())

@unittest.skipUnless(util_exists('pgbench'), 'might be missing')
#@unittest.skipUnless(util_exists('pgbench'), 'might be missing')
def test_pgbench(self):
__class__.helper__skip_test_if_util_not_exist("pgbench")

with get_remote_node(conn_params=conn_params).init().start() as node:
# initialize pgbench DB and run benchmarks
node.pgbench_init(scale=2, foreign_keys=True,
Expand DownExpand Up@@ -1077,6 +1090,24 @@ def helper__restore_envvar(name, prev_value):
else:
os.environ[name] = prev_value

@staticmethod
def helper__skip_test_if_util_not_exist(name: str):
assert type(name) == str # noqa: E721
if not util_exists(name):
pytest.skip('might be missing')

@staticmethod
def helper__skip_test_if_pg_version_is_not_ge(version: str):
assert type(version) == str # noqa: E721
if not pg_version_ge(version):
pytest.skip('requires {0}+'.format(version))

@staticmethod
def helper__skip_test_if_pg_version_is_ge(version: str):
assert type(version) == str # noqa: E721
if pg_version_ge(version):
pytest.skip('requires <{0}'.format(version))


if __name__ == '__main__':
if os_ops.environ('ALT_CONFIG'):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp