| Rev | Line | |
|---|
| [34] | 1 | # Test transactions. |
|---|
| 2 | |
|---|
| 3 | mkdir /test |
|---|
| 4 | |
|---|
| 5 | # Simple transaction: create a file inside transaction. |
|---|
| 6 | 1 start |
|---|
| 7 | 1 write /test/entry1 contents |
|---|
| 8 | 2 dir /test |
|---|
| 9 | expect 1:entry1 |
|---|
| 10 | 1 dir /test |
|---|
| 11 | 1 commit |
|---|
| 12 | expect 2:contents |
|---|
| 13 | 2 read /test/entry1 |
|---|
| 14 | |
|---|
| 15 | rm /test/entry1 |
|---|
| 16 | |
|---|
| 17 | # Create a file and abort transaction. |
|---|
| 18 | 1 start |
|---|
| 19 | 1 write /test/entry1 contents |
|---|
| 20 | 2 dir /test |
|---|
| 21 | expect 1:entry1 |
|---|
| 22 | 1 dir /test |
|---|
| 23 | 1 abort |
|---|
| 24 | 2 dir /test |
|---|
| 25 | |
|---|
| 26 | write /test/entry1 contents |
|---|
| 27 | # Delete in transaction, commit |
|---|
| 28 | 1 start |
|---|
| 29 | 1 rm /test/entry1 |
|---|
| 30 | expect 2:entry1 |
|---|
| 31 | 2 dir /test |
|---|
| 32 | 1 dir /test |
|---|
| 33 | 1 commit |
|---|
| 34 | 2 dir /test |
|---|
| 35 | |
|---|
| 36 | # Delete in transaction, abort. |
|---|
| 37 | write /test/entry1 contents |
|---|
| 38 | 1 start |
|---|
| 39 | 1 rm /test/entry1 |
|---|
| 40 | expect 2:entry1 |
|---|
| 41 | 2 dir /test |
|---|
| 42 | 1 dir /test |
|---|
| 43 | 1 abort |
|---|
| 44 | expect 2:entry1 |
|---|
| 45 | 2 dir /test |
|---|
| 46 | |
|---|
| 47 | # Events inside transactions don't trigger watches until (successful) commit. |
|---|
| 48 | mkdir /test/dir |
|---|
| 49 | 1 watch /test token |
|---|
| 50 | 2 start |
|---|
| 51 | 2 mkdir /test/dir/sub |
|---|
| 52 | expect 1: waitwatch failed: Connection timed out |
|---|
| 53 | 1 waitwatch |
|---|
| 54 | 2 close |
|---|
| 55 | 1 close |
|---|
| 56 | |
|---|
| 57 | 1 watch /test token |
|---|
| 58 | 2 start |
|---|
| 59 | 2 mkdir /test/dir/sub |
|---|
| 60 | 2 abort |
|---|
| 61 | expect 1: waitwatch failed: Connection timed out |
|---|
| 62 | 1 waitwatch |
|---|
| 63 | 1 close |
|---|
| 64 | |
|---|
| 65 | 1 watch /test token |
|---|
| 66 | 2 start |
|---|
| 67 | 2 mkdir /test/dir/sub |
|---|
| 68 | 2 commit |
|---|
| 69 | expect 1:/test/dir/sub:token |
|---|
| 70 | 1 waitwatch |
|---|
| 71 | 1 close |
|---|
| 72 | |
|---|
| 73 | # Rm inside transaction works like rm outside: children get notified. |
|---|
| 74 | 1 watch /test/dir/sub token |
|---|
| 75 | 2 start |
|---|
| 76 | 2 rm /test/dir |
|---|
| 77 | 2 commit |
|---|
| 78 | expect 1:/test/dir/sub:token |
|---|
| 79 | 1 waitwatch |
|---|
| 80 | 1 close |
|---|
| 81 | |
|---|
| 82 | # Multiple events from single transaction don't trigger assert |
|---|
| 83 | 1 watch /test token |
|---|
| 84 | 2 start |
|---|
| 85 | 2 write /test/1 contents |
|---|
| 86 | 2 write /test/2 contents |
|---|
| 87 | 2 commit |
|---|
| 88 | expect 1:/test/1:token |
|---|
| 89 | 1 waitwatch |
|---|
| 90 | expect 1:/test/2:token |
|---|
| 91 | 1 waitwatch |
|---|
| 92 | 1 close |
|---|
Note: See
TracBrowser
for help on using the repository browser.