Skip to content

Container PyTest suite for Postgresql-container#640

Open
phracek wants to merge 22 commits intosclorg:masterfrom
phracek:container_pytests
Open

Container PyTest suite for Postgresql-container#640
phracek wants to merge 22 commits intosclorg:masterfrom
phracek:container_pytests

Conversation

@phracek
Copy link
Copy Markdown
Member

@phracek phracek commented Jan 6, 2026

This pull request adds PyTest suite migrated from run_pytest scripts.

run_container_creation_tests -> test_container_configuration.py
run_general_tests -> test_container_general.py
run_change_password_test -> test_container_password.py
run_replication_test -> test_container_replication.py
run_s2i_test -> test_container_basics.py
run_test_cfg_hook -> test_container_configuration.py
run_s2i_bake_data_test -> test_container_ssl.py
run_s2i_enable_ssl_test -> test_container_ssl.py
run_pgaudit_test -> test_container_extensions.py
run_pgvector_test -> test_container_extensions.py
run_env_extension_load_test -> test_container_extensions.py
run_logging_test -> test_container_logging.py

All tests are migrated except run_migration_test and run_upgrade_test.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 6, 2026

Pull Request validation

Failed

🔴 Approval - missing or changes were requested

Success

🟢 CI - All checks have passed
🟢 Review - Reviewed by a member

@phracek
Copy link
Copy Markdown
Member Author

phracek commented Jan 6, 2026

Let's try first round
[test-pytest]

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 6, 2026

Testing Farm results

namecomposearchstatusstarted (UTC)timelogs
Fedora - PyTest - 16Fedora-latestx86_64✅ passed27.04.2026 14:19:089min 18stest pipeline
Fedora - PyTest - 15Fedora-latestx86_64✅ passed27.04.2026 14:19:009min 10stest pipeline
CentOS Stream 9 - PyTest - 13CentOS-Stream-9x86_64✅ passed27.04.2026 14:49:5314min 15stest pipeline
CentOS Stream 10 - PyTest - 16CentOS-Stream-10x86_64✅ passed27.04.2026 14:41:3515min 11stest pipeline
CentOS Stream 9 - PyTest - 15CentOS-Stream-9x86_64✅ passed27.04.2026 14:18:4416min 30stest pipeline
CentOS Stream 9 - PyTest - 16CentOS-Stream-9x86_64✅ passed27.04.2026 14:47:5016min 51stest pipeline
RHEL10 - Unsubscribed host - PyTest - 16RHEL-10.2-Nightlyx86_64✅ passed27.04.2026 14:45:2221min 31stest pipeline
RHEL8 - PyTest - 12RHEL-8.10.0-Nightlyx86_64✅ passed27.04.2026 14:18:4617min 51stest pipeline
RHEL8 - PyTest - 16RHEL-8.10.0-Nightlyx86_64✅ passed27.04.2026 14:18:4319min 57stest pipeline
RHEL9 - Unsubscribed host - PyTest - 13RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:18:4319min 58stest pipeline
RHEL9 - Unsubscribed host - PyTest - 16RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:50:0721min 18stest pipeline
RHEL9 - Unsubscribed host - PyTest - 15RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:29:1021min 19stest pipeline
RHEL9 - PyTest - 15RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:39:1232min 43stest pipeline
RHEL8 - PyTest - 15RHEL-8.10.0-Nightlyx86_64✅ passed27.04.2026 14:29:3619min 14stest pipeline
RHEL9 - PyTest - 13RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:29:3122min 34stest pipeline
RHEL9 - PyTest - 16RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:37:2235min 39stest pipeline
RHEL10 - PyTest - 16RHEL-10.2-Nightlyx86_64✅ passed27.04.2026 14:43:3920min 15stest pipeline
RHEL8 - PyTest - 13RHEL-8.10.0-Nightlyx86_64✅ passed27.04.2026 14:52:1632min 56stest pipeline
Fedora - PyTest - 18Fedora-latestx86_64✅ passed27.04.2026 14:54:0610min 17stest pipeline
CentOS Stream 9 - PyTest - 18CentOS-Stream-9x86_64✅ passed27.04.2026 14:18:5216min 4stest pipeline
RHEL9 - Unsubscribed host - PyTest - 18RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:19:0621min 45stest pipeline
RHEL10 - PyTest - 18RHEL-10.2-Nightlyx86_64✅ passed27.04.2026 14:39:3226min 43stest pipeline
RHEL10 - Unsubscribed host - PyTest - 18RHEL-10.2-Nightlyx86_64✅ passed27.04.2026 14:19:1022min 35stest pipeline
RHEL9 - PyTest - 18RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:19:0425min 44stest pipeline
CentOS Stream 10 - PyTest - 18CentOS-Stream-10x86_64✅ passed27.04.2026 14:57:0618min 16stest pipeline
Fedora - 16Fedora-latestx86_64✅ passed27.04.2026 14:52:427min 31stest pipeline
CentOS Stream 10 - 16CentOS-Stream-10x86_64✅ passed27.04.2026 14:37:1611min 51stest pipeline
CentOS Stream 9 - 13CentOS-Stream-9x86_64✅ passed27.04.2026 14:31:0312min 24stest pipeline
CentOS Stream 9 - 15CentOS-Stream-9x86_64✅ passed27.04.2026 14:20:2212min 38stest pipeline
RHEL10 - 16RHEL-10.2-Nightlyx86_64✅ passed27.04.2026 14:19:0918min 51stest pipeline
RHEL8 - 15RHEL-8.10.0-Nightlyx86_64✅ passed27.04.2026 14:19:0316min 25stest pipeline
RHEL10 - Unsubscribed host - 18RHEL-10.2-Nightlyx86_64✅ passed27.04.2026 14:18:4518min 32stest pipeline
RHEL9 - 13RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:45:3221min 4stest pipeline
RHEL9 - Unsubscribed host - 16RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:43:1921min 34stest pipeline
RHEL9 - 15RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:53:2324min 30stest pipeline
Fedora - 15Fedora-latestx86_64✅ passed27.04.2026 14:19:138min 11stest pipeline
RHEL8 - 12RHEL-8.10.0-Nightlyx86_64✅ passed27.04.2026 14:33:0018min 17stest pipeline
CentOS Stream 9 - 16CentOS-Stream-9x86_64✅ passed27.04.2026 14:37:2612min 28stest pipeline
Fedora - 18Fedora-latestx86_64✅ passed27.04.2026 14:18:428min 22stest pipeline
RHEL9 - Unsubscribed host - 13RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:34:4421min 29stest pipeline
RHEL9 - 18RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:18:5322min 40stest pipeline
CentOS Stream 9 - 18CentOS-Stream-9x86_64✅ passed27.04.2026 14:18:4312min 58stest pipeline
RHEL10 - Unsubscribed host - 16RHEL-10.2-Nightlyx86_64✅ passed27.04.2026 14:29:3017min 4stest pipeline
RHEL9 - Unsubscribed host - 18RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:39:3725min 46stest pipeline
RHEL8 - 13RHEL-8.10.0-Nightlyx86_64✅ passed27.04.2026 14:37:0920min 50stest pipeline
RHEL9 - 16RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:39:0325min 55stest pipeline
RHEL8 - 16RHEL-8.10.0-Nightlyx86_64✅ passed27.04.2026 14:18:4217min 22stest pipeline
RHEL10 - 18RHEL-10.2-Nightlyx86_64✅ passed27.04.2026 14:37:0723min 47stest pipeline
RHEL9 - Unsubscribed host - 15RHEL-9.8.0-Nightlyx86_64✅ passed27.04.2026 14:58:1720min 58stest pipeline
CentOS Stream 10 - 18CentOS-Stream-10x86_64✅ passed27.04.2026 14:18:4311min 54stest pipeline

@phracek
Copy link
Copy Markdown
Member Author

phracek commented Jan 7, 2026

Let's try next round
[test-pytest]

Comment thread test/test_container_configuration.py
Copy link
Copy Markdown
Contributor

@pkhartsk pkhartsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some things and included proposed fixes for both

Comment thread test/test_container_ssl.py Outdated
Comment thread test/test_container_configuration.py Outdated
@phracek
Copy link
Copy Markdown
Member Author

phracek commented Mar 18, 2026

I will rewrite it so that each commit will represent each test suite and ocp_renaming will be a part of another PR.

@phracek
Copy link
Copy Markdown
Member Author

phracek commented Mar 31, 2026

@fila43 Please review parts test_container_upgrade.py and test_container_migration.py. The pagila is now part of this repo. In case you would like to download it e.g. from https://github.com/devrimgunduz/pagila, then please let me know. Thanks.

Comment thread test/conftest.py Outdated
@phracek phracek force-pushed the container_pytests branch from 6ae07ed to 5217d9d Compare April 1, 2026 11:11
@phracek
Copy link
Copy Markdown
Member Author

phracek commented Apr 1, 2026

Rebased against 'master' branch

[test-pytest][test]

Copy link
Copy Markdown
Member

@frenzymadness frenzymadness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First few ideas.

Also, there are typos in commit messages: propoer instead of proper and test_container_generall.py instead of test_container_general.py

Comment thread test/conftest.py Outdated
Comment thread test/test_container_password.py Outdated
Comment thread test/conftest.py Outdated
Comment thread test/test_container_configuration.py Outdated
Comment thread test/test_container_extensions.py Outdated
@phracek phracek force-pushed the container_pytests branch from 5217d9d to a116509 Compare April 8, 2026 13:46
Copy link
Copy Markdown
Member

@frenzymadness frenzymadness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more points.

Comment thread test/conftest.py Outdated
Comment thread test/test_container_extensions.py Outdated
Comment thread test/test_container_basics.py Outdated
@phracek
Copy link
Copy Markdown
Member Author

phracek commented Apr 13, 2026

@frenzymadness Thanks for the second round of review.

@phracek
Copy link
Copy Markdown
Member Author

phracek commented Apr 14, 2026

[test][test-pytest]

Copy link
Copy Markdown
Member

@frenzymadness frenzymadness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another run. If you know you are copy-pasting code or using the same patterns in multiple places, it would be nice to fix the issues I point out in a single place across all instances.

Comment thread test/conftest.py Outdated
Comment thread test/conftest.py Outdated
Comment thread test/conftest.py
Comment thread test/test_container_password.py Outdated
Comment thread test/test_container_extensions.py Outdated
Comment thread test/test_container_ssl.py Outdated
Comment thread test/test_container_upgrade.py Outdated
Comment thread test/test_container_general.py Outdated
Comment thread test/conftest.py Outdated
Comment thread test/test_container_configuration.py Outdated
phracek and others added 21 commits April 23, 2026 09:51
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
run_s2i_test -> test_container_basics.py

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
run_container_creation_tests -> test_container_configuration.py
run_test_cfg_hook -> test_container_configuration.py

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
run_pgaudit_test -> test_container_extensions.py
run_pgvector_test -> test_container_extensions.py
run_env_extension_load_test -> test_container_extensions.py

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
run_general_tests -> test_container_general.py

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
run_logging_test -> test_container_logging.py

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
run_change_password_test -> test_container_password

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
run_replication_test -> test_container_replication.py

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
run_s2i_bake_data_test -> test_container_ssl.py
run_s2i_enable_ssl_test -> test_container_ssl.py

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Test summary for version 16

```
=========================== short test summary info ============================
PASSED test_container_migrate.py::TestPostgreSQLMigration::test_migration_functionality[13]
PASSED test_container_migrate.py::TestPostgreSQLMigration::test_migration_functionality[15]
SKIPPED [1] test_container_migrate.py:55: registry.redhat.io/rhel9/postgresql-12 image not found in registry so skipping migration test..
SKIPPED [1] test_container_migrate.py:51: Migration path from 16 -> 16 is not valid so skipping.
SKIPPED [1] test_container_migrate.py:51: Migration path from 18 -> 16 is not valid so skipping.
```

Test summary for version 18
```
=========================== short test summary info ============================
PASSED test_container_migrate.py::TestPostgreSQLMigration::test_migration_functionality[13]
PASSED test_container_migrate.py::TestPostgreSQLMigration::test_migration_functionality[15]
PASSED test_container_migrate.py::TestPostgreSQLMigration::test_migration_functionality[16]
SKIPPED [1] test_container_migrate.py:55: registry.redhat.io/rhel9/postgresql-12 image not found in registry so skipping migration test..
SKIPPED [1] test_container_migrate.py:51: Migration path from 18 -> 18 is not valid so skipping.

```

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Skip in case of previous version does not exist

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Sometimes /usr/libexec/check-container does not work
properly.
Let's check it by accepting connections by simple command

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Delete temporary directories at the end of each tests

We do not need SSL warnings at all.

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
We do not need 'none' in case 'version' exist in list
then return index - 1 otherwise return None

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Update comment 4 in test_container_basics.py

Remove obsoleted test, as it is not present in test/run_test bash
tests as well.

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
Do not duplication code in case it is used at least twice

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
@phracek phracek force-pushed the container_pytests branch from d7d1382 to 57e09bc Compare April 23, 2026 07:51
@phracek
Copy link
Copy Markdown
Member Author

phracek commented Apr 23, 2026

[test-pytest]

Copy link
Copy Markdown
Member

@frenzymadness frenzymadness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more round, and I hope we are done. This is mostly about comments and names, but the one about imports is important. There are also some open threads from previous rounds. I believe you can merge this once at least the imports are fixed.

Comment thread test/test_container_logging.py Outdated
Comment thread test/conftest.py Outdated
Comment thread test/conftest.py Outdated
Comment thread test/test_container_upgrade.py
Comment thread test/test_container_general.py Outdated
Comment thread test/test_container_general.py Outdated
Comment thread test/test_container_ssl.py
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
@phracek
Copy link
Copy Markdown
Member Author

phracek commented Apr 27, 2026

[test][test-pytest]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants