|
1 | 1 | @needs-postgres |
2 | 2 | Feature: SQLAlchemy Atomic Transactions |
3 | 3 |
|
4 | | - Background: |
5 | | - Given the application database is initialized |
| 4 | + Scenario Outline: Create and retrieve entity in atomic transaction |
| 5 | + Given the application database is initialized for <db_type> |
6 | 6 | And test entities are defined |
7 | | - |
8 | | - Scenario: Create and retrieve entity in atomic transaction |
9 | 7 | When a new entity is created in an atomic transaction |
10 | 8 | Then the entity should be retrievable |
11 | 9 |
|
12 | | - Scenario: Handle transaction rollback on exception |
| 10 | + Examples: |
| 11 | + | db_type | |
| 12 | + | postgres| |
| 13 | + | sqlite | |
| 14 | + |
| 15 | + Scenario Outline: Handle transaction rollback on exception |
| 16 | + Given the application database is initialized for <db_type> |
| 17 | + And test entities are defined |
13 | 18 | When a new entity creation fails within an atomic transaction |
14 | 19 | Then no entity should exist in the database |
15 | 20 | And the database session should remain usable |
16 | 21 |
|
17 | | - Scenario: Support nested atomic transactions |
| 22 | + Examples: |
| 23 | + | db_type | |
| 24 | + | postgres| |
| 25 | + | sqlite | |
| 26 | + |
| 27 | + Scenario Outline: Support nested atomic transactions |
| 28 | + Given the application database is initialized for <db_type> |
| 29 | + And test entities are defined |
18 | 30 | When nested atomic transactions are executed |
19 | | - Then operations from successful nested transactions should not be committed |
| 31 | + Then operations from successful nested transactions should be visible within outer transaction |
20 | 32 | And operations from failed nested transactions should be rolled back |
21 | 33 |
|
22 | | - Scenario: Update entities in atomic transaction |
23 | | - Given an entity exists in the database |
| 34 | + Examples: |
| 35 | + | db_type | |
| 36 | + | postgres| |
| 37 | + | sqlite | |
| 38 | + |
| 39 | + Scenario Outline: Update entities in atomic transaction |
| 40 | + Given the application database is initialized for <db_type> |
| 41 | + And test entities are defined |
| 42 | + And an entity exists in the database |
24 | 43 | When the entity is updated within an atomic transaction |
25 | 44 | Then the entity properties should reflect the updates |
26 | 45 |
|
27 | | - Scenario: Create entities with relationships in atomic transaction |
| 46 | + Examples: |
| 47 | + | db_type | |
| 48 | + | postgres| |
| 49 | + | sqlite | |
| 50 | + |
| 51 | + Scenario Outline: Create entities with relationships in atomic transaction |
| 52 | + Given the application database is initialized for <db_type> |
| 53 | + And test entities are defined |
28 | 54 | When an entity with relationships is created in an atomic transaction |
29 | 55 | Then the entity and its relationships should be retrievable |
30 | 56 |
|
31 | | - Scenario: Support different entity types in atomic transactions |
| 57 | + Examples: |
| 58 | + | db_type | |
| 59 | + | postgres| |
| 60 | + | sqlite | |
| 61 | + |
| 62 | + Scenario Outline: Support different entity types in atomic transactions |
| 63 | + Given the application database is initialized for <db_type> |
| 64 | + And test entities are defined |
32 | 65 | When different types of entities are created in an atomic transaction |
33 | 66 | Then all entity types should be retrievable |
34 | 67 |
|
35 | | - Scenario: Test error handling in atomic transactions |
| 68 | + Examples: |
| 69 | + | db_type | |
| 70 | + | postgres| |
| 71 | + | sqlite | |
| 72 | + |
| 73 | + Scenario Outline: Test error handling in atomic transactions |
| 74 | + Given the application database is initialized for <db_type> |
| 75 | + And test entities are defined |
36 | 76 | When an error is triggered within an atomic transaction |
37 | 77 | Then the appropriate error should be raised |
38 | 78 | And the transaction should be rolled back |
39 | 79 |
|
40 | | - Scenario: Verify session consistency across multiple atomic blocks |
| 80 | + Examples: |
| 81 | + | db_type | |
| 82 | + | postgres| |
| 83 | + | sqlite | |
| 84 | + |
| 85 | + Scenario Outline: Verify session consistency across multiple atomic blocks |
| 86 | + Given the application database is initialized for <db_type> |
| 87 | + And test entities are defined |
41 | 88 | When operations are performed across multiple atomic blocks |
42 | 89 | Then session should maintain consistency across atomic blocks |
43 | 90 |
|
| 91 | + Examples: |
| 92 | + | db_type | |
| 93 | + | postgres| |
| 94 | + | sqlite | |
| 95 | + |
44 | 96 | @async |
45 | | - Scenario: Create and retrieve entity in async atomic transaction |
| 97 | + Scenario Outline: Create and retrieve entity in async atomic transaction |
| 98 | + Given the application database is initialized for <db_type> |
| 99 | + And test entities are defined |
46 | 100 | When a new entity is created in an async atomic transaction |
47 | 101 | Then the async entity should be retrievable |
48 | 102 |
|
| 103 | + Examples: |
| 104 | + | db_type | |
| 105 | + | postgres| |
| 106 | + | sqlite | |
| 107 | + |
49 | 108 | @async |
50 | | - Scenario: Handle transaction rollback in async atomic transaction |
| 109 | + Scenario Outline: Handle transaction rollback in async atomic transaction |
| 110 | + Given the application database is initialized for <db_type> |
| 111 | + And test entities are defined |
51 | 112 | When a new async entity creation fails within an atomic transaction |
52 | 113 | Then no async entity should exist in the database |
53 | 114 | And the async database session should remain usable |
54 | 115 |
|
| 116 | + Examples: |
| 117 | + | db_type | |
| 118 | + | postgres| |
| 119 | + | sqlite | |
| 120 | + |
55 | 121 | @async |
56 | | - Scenario: Create multiple entities in async atomic transaction |
| 122 | + Scenario Outline: Create multiple entities in async atomic transaction |
| 123 | + Given the application database is initialized for <db_type> |
| 124 | + And test entities are defined |
57 | 125 | When multiple entities are created in an async atomic transaction |
58 | 126 | Then all async entities should be retrievable |
59 | 127 |
|
| 128 | + Examples: |
| 129 | + | db_type | |
| 130 | + | postgres| |
| 131 | + | sqlite | |
| 132 | + |
60 | 133 | @async |
61 | | - Scenario: Create and manage complex entity relationships asynchronously |
| 134 | + Scenario Outline: Create and manage complex entity relationships asynchronously |
| 135 | + Given the application database is initialized for <db_type> |
| 136 | + And test entities are defined |
62 | 137 | When complex async operations are performed in a transaction |
63 | 138 | Then all related entities should be accessible |
| 139 | + |
| 140 | + Examples: |
| 141 | + | db_type | |
| 142 | + | postgres| |
| 143 | + | sqlite | |
0 commit comments