limbo/testing/cli_tests/mvcc.py
Pekka Enberg edd45ff7b8 Improve MVCC DX by dropping --experimental-mvcc flag
The DX is right now pretty terrible:

```
penberg@vonneumann turso % cargo run -- hello.db
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/tursodb hello.db`
Turso v0.4.0-pre.18
Enter ".help" for usage hints.
Did you know that Turso supports live materialized views? Type .manual materialized-views to learn more.
This software is in BETA, use caution with production data and ensure you have backups.
turso> PRAGMA journal_mode = 'experimental_mvcc';
  × Invalid argument supplied: MVCC is not enabled. Enable it with `--experimental-mvcc` flag in the CLI or by setting the MVCC option in `DatabaseOpts`

turso>
```

To add insult to the injury, many SDKs don't even have a way to enable
MVCC via database options. Therefore, let's remove the flag altogether.
2025-12-19 12:59:42 +02:00

30 lines
900 B
Python
Executable file

#!/usr/bin/env python3
from cli_tests import console
from cli_tests.test_turso_cli import TestTursoShell
from pydantic import BaseModel
# This tests verify that experimental MVCC feature works as expected. The test
# suite will go away once the feature becomes more stable because we will just
# run the TCL tests, for example, with MVCC enabled.
class MVCCTest(BaseModel):
pass
def test_create_table_with_mvcc():
"""Test CREATE TABLE t(x) with MVCC journal mode"""
shell = TestTursoShell(init_commands="PRAGMA journal_mode = 'experimental_mvcc';")
shell.run_test("create-table-mvcc", "CREATE TABLE t(x);", "")
shell.run_test("insert-mvcc", "INSERT INTO t(x) VALUES (1);", "")
shell.quit()
def main():
console.info("Running MVCC CLI tests...")
test_create_table_with_mvcc()
console.info("All MVCC tests have passed")
if __name__ == "__main__":
main()