def setUp(self) -> None: super().setUp() self.uris = tmpfile_uris() os.environ["INFRASTRUCTURE_FACTORY"] = "eventsourcing.postgres:Factory" os.environ["POSTGRES_DBNAME"] = "eventsourcing" os.environ["POSTGRES_HOST"] = "127.0.0.1" os.environ["POSTGRES_PORT"] = "5432" os.environ["POSTGRES_USER"] = "******" os.environ["POSTGRES_PASSWORD"] = "******" db = PostgresDatastore( os.getenv("POSTGRES_DBNAME"), os.getenv("POSTGRES_HOST"), os.getenv("POSTGRES_PORT"), os.getenv("POSTGRES_USER"), os.getenv("POSTGRES_PASSWORD"), ) drop_postgres_table(db, "worlds_events") del os.environ["INFRASTRUCTURE_FACTORY"] del os.environ["POSTGRES_DBNAME"] del os.environ["POSTGRES_HOST"] del os.environ["POSTGRES_PORT"] del os.environ["POSTGRES_USER"] del os.environ["POSTGRES_PASSWORD"]
def test_sets_wal_journal_mode_if_not_memory(self): # Check datastore for in-memory database. with self.datastore.transaction(): pass self.assertFalse(self.datastore.is_journal_mode_wal) self.assertFalse(self.datastore.journal_mode_was_changed_to_wal) # Create datastore for non-existing file database. self.uris = tmpfile_uris() self.db_uri = next(self.uris) datastore = SQLiteDatastore(self.db_uri) with datastore.transaction(): pass self.assertTrue(datastore.is_journal_mode_wal) self.assertTrue(datastore.journal_mode_was_changed_to_wal) datastore.close_all_connections() del datastore # Recreate datastore for existing database. datastore = SQLiteDatastore(self.db_uri) with datastore.transaction(): pass self.assertTrue(datastore.is_journal_mode_wal) self.assertFalse(datastore.journal_mode_was_changed_to_wal)
def setUp(self) -> None: super().setUp() self.uris = tmpfile_uris() # self.db_uri = next(self.uris) os.environ["INFRASTRUCTURE_FACTORY"] = "eventsourcing.sqlite:Factory" os.environ["CREATE_TABLE"] = "y" os.environ["SQLITE_DBNAME"] = next(self.uris)
def create_recorder(self) -> ApplicationRecorder: self.uris = tmpfile_uris() self.db_uri = next(self.uris) recorder = SQLiteApplicationRecorder( SQLiteDatastore(db_name=self.db_uri)) recorder.create_table() return recorder
def setUp(self) -> None: super().setUp() self.uris = tmpfile_uris() db = PostgresDatastore( "eventsourcing", "127.0.0.1", "5432", "eventsourcing", "eventsourcing", ) drop_postgres_table(db, "universe_events")
def setUp(self) -> None: super().setUp() self.uris = tmpfile_uris() os.environ["INFRASTRUCTURE_FACTORY"] = "eventsourcing.postgres:Factory" os.environ["CREATE_TABLE"] = "y" os.environ["POSTGRES_DBNAME"] = "eventsourcing" os.environ["POSTGRES_HOST"] = "127.0.0.1" os.environ["POSTGRES_USER"] = "******" os.environ["POSTGRES_PASSWORD"] = "******" db = PostgresDatastore( os.getenv("POSTGRES_DBNAME"), os.getenv("POSTGRES_HOST"), os.getenv("POSTGRES_USER"), os.getenv("POSTGRES_PASSWORD"), ) drop_postgres_table(db, "bankaccounts_events") drop_postgres_table(db, "bankaccounts_snapshots")
def setUp(self): os.environ["INFRASTRUCTURE_FACTORY"] = "eventsourcing.sqlite:Factory" uris = tmpfile_uris() os.environ["BANKACCOUNTS_SQLITE_DBNAME"] = next(uris) os.environ["EMAILNOTIFICATIONS_SQLITE_DBNAME"] = next(uris) os.environ["BROKENPROCESSING_SQLITE_DBNAME"] = next(uris)
def test_concurrent_throughput(self): self.uris = tmpfile_uris() self.db_uri = next(self.uris) super().test_concurrent_throughput()
def test_concurrent_no_conflicts(self): self.uris = tmpfile_uris() self.db_uri = next(self.uris) super().test_concurrent_no_conflicts()
def create_recorder(self) -> ApplicationRecorder: self.uris = tmpfile_uris() self.db_uri = next(self.uris) recorder = PostgresApplicationRecorder(self.datastore) recorder.create_table() return recorder