Esempio n. 1
0
    def test_sets_wal_journal_mode_if_not_memory(self):
        # Check datastore for in-memory database.
        with self.datastore.transaction(commit=False):
            pass

        self.assertFalse(self.datastore.pool.is_journal_mode_wal)
        self.assertFalse(self.datastore.pool.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(commit=False):
            pass

        self.assertTrue(datastore.pool.is_journal_mode_wal)
        self.assertTrue(datastore.pool.journal_mode_was_changed_to_wal)

        datastore.close()
        del datastore

        # Recreate datastore for existing database.
        datastore = SQLiteDatastore(self.db_uri)
        with datastore.transaction(commit=False):
            pass
        self.assertTrue(datastore.pool.is_journal_mode_wal)
        self.assertFalse(datastore.pool.journal_mode_was_changed_to_wal)
Esempio n. 2
0
    def setUp(self) -> None:
        super().setUp()
        self.uris = tmpfile_uris()
        # self.db_uri = next(self.uris)

        os.environ["PERSISTENCE_MODULE"] = "eventsourcing.sqlite"
        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
Esempio n. 4
0
    def setUp(self) -> None:
        super().setUp()
        self.uris = tmpfile_uris()

        db = PostgresDatastore(
            "eventsourcing",
            "127.0.0.1",
            "5432",
            "eventsourcing",
            "eventsourcing",
        )
        drop_postgres_table(db, "dogschool_events")
Esempio n. 5
0
 def setUp(self):
     super().setUp()
     os.environ["PERSISTENCE_MODULE"] = "eventsourcing.sqlite"
     uris = tmpfile_uris()
     os.environ[f"{BankAccounts.name.upper()}_SQLITE_DBNAME"] = next(uris)
     os.environ[f"{EmailProcess.name.upper()}_SQLITE_DBNAME"] = next(uris)
     os.environ[f"{EmailProcess.name.upper()}2_SQLITE_DBNAME"] = next(uris)
     os.environ[f"MY{EmailProcess.name.upper()}_SQLITE_DBNAME"] = next(uris)
     os.environ["BROKENPROCESSING_SQLITE_DBNAME"] = next(uris)
     os.environ["BROKENCONVERTING_SQLITE_DBNAME"] = next(uris)
     os.environ["BROKENPULLING_SQLITE_DBNAME"] = next(uris)
     os.environ["COMMANDS_SQLITE_DBNAME"] = next(uris)
     os.environ["RESULTS_SQLITE_DBNAME"] = next(uris)
 def create_recorder(self) -> ApplicationRecorder:
     self.uris = tmpfile_uris()
     self.db_uri = next(self.uris)
     recorder = PostgresApplicationRecorder(self.datastore)
     recorder.create_table()
     return recorder
Esempio n. 7
0
 def test_concurrent_throughput(self):
     self.uris = tmpfile_uris()
     self.db_uri = next(self.uris)
     super().test_concurrent_throughput()
Esempio n. 8
0
 def test_concurrent_no_conflicts(self):
     self.uris = tmpfile_uris()
     self.db_uri = next(self.uris)
     super().test_concurrent_no_conflicts()
Esempio n. 9
0
 def setUp(self) -> None:
     self.tmp_urls = tmpfile_uris()
     self.db_name = next(self.tmp_urls)