35 lines
1.5 KiB
Python
Raw Normal View History

import pytest
from src.libs.custom_logger import get_custom_logger
from src.steps.store import StepsStore
from src.env_vars import PG_PASS, PG_USER
logger = get_custom_logger(__name__)
class TestExternalDb(StepsStore):
postgress_url = f"postgres://{PG_USER}:{PG_PASS}@postgres:5432/postgres"
@pytest.fixture(scope="function", autouse=True)
def node_postgres_setup(self, store_setup, start_postgres_container):
self.setup_first_publishing_node(store="true", relay="true", store_message_db_url=self.postgress_url)
self.setup_first_store_node(store="false", relay="true")
self.subscribe_to_pubsub_topics_via_relay()
CI_RUNNERS (#88) * Change number of threads for CI runners to 8 * change number of threads to 12 * Change number of threads to auto select * change number of threads to logical instead of auto * change number of threads to 150 * change total workers to 40 * Adding workflow_call in on section * remove "remove_unwanted_software" from yml * change path of requirements.txt * modify path of .txt file again * Change repo name * Create docker volume * Merge master to branch * Revert changes done in the branch * try the sharding option * Add pytest-shard 0.1.2 to requirements.txt * reduce shards to 2 * Fix max number of shards error * Modify pytest run command * change number of shards to =1 * increase shards to 4 * Modify pytest command * Change shards to 4 * skip 3 tests * skip rln tests * skip test metric * skip rln tests * fix skipif mark * Fix linters * Fix linters 2 * run pre-commit command to fix linters * Make each shard upload seperate report using artifacts * Change number of shards to 5 * CHange artifacts version to 4 * increase shards to 8 * Increase shards to 11 * Make test_get_multiple_2000_store_messages run in seperate shard * Mark test_get_multiple_2000_store_messages to run in shard 1 * using logic in yml file to run test_cursor.py in seperate file * Fix logic to run test_cursor.py in seperate shard * Adding path of file instead of file name in yml file * Fix error in pytest command * rerun test test_get_multiple_2000_store_messages * run test_get_multiple_2000_store_messages in separate shard * Fix error in pytest command * Fix command again by using -k instead of test name * Add test_rln.py again to job and increase shards to 13 * Run test_rln.py in single shard * Fix pytest command * Fix syntax error in pytest command * Increase workers to 4 * Create new test file for test_get_multiple_2000_store_messages * Collect reports into 1 report * Modify aggregate reports * Make changes to reports collecting * Add more reporting ways * Add send reports to discord again * Fix command syntax error * Revert changes * Make changes to fix not executed tests issue * remove 12 from matrix shards * Try to fix missing test issue by adding collect-only * Modify pytest command " remove collect only " * Increate timeout for test test_get_multiple_2000_store_messages * Reduce shards again to 8 * remove loadfile option * Increase shards to 22 * increase shards to 42 * Increase shards to 49 * Increase shards to 63 * Modify test command to have 16 shards * Change shards to 9 * Fix command of pytest * Using ignore instead of -m * Fix syntax error * Modify test file path * Increase shards to 16 * Modify test command * fix: add multiple machines * fix: prevent fail fast * Remove multiple skips * Revert changes in test_rln file * Modify test command fix: add multiple machines fix: prevent fail fast checkout on smoke_tests tag (#96) * checkout on smoke_tests tag * MOdify pytest command * Update README.md Add steps on how to use new tag for PR tests in readme file Remove multiple skips Revert changes in test_rln file * Adding timeout to test test_on_empty_postgress_db * Add comments in workflow for shards --------- Co-authored-by: fbarbu15 <florin@status.im> Co-authored-by: Florin Barbu <barbu_florin_adrian@yahoo.com>
2025-01-06 16:29:33 +03:00
@pytest.mark.timeout(60)
def test_on_empty_postgress_db(self):
message = self.create_message()
self.publish_message(message=message)
self.check_published_message_is_stored(page_size=5, ascending="true")
assert len(self.store_response.messages) >= 1
2025-03-28 09:40:41 +02:00
@pytest.mark.flaky(reruns=6)
def test_on_postgress_db_with_one_message(self):
self.test_on_empty_postgress_db()
self.setup_first_publishing_node(store="true", relay="true", store_message_db_url=self.postgress_url)
self.setup_first_store_node(store="false", relay="true")
self.subscribe_to_pubsub_topics_via_relay()
message = self.create_message()
self.publish_message(message=message)
self.check_published_message_is_stored(page_size=5, ascending="true")
assert len(self.store_response.messages) >= 2