Skip to content

Commit b7d795c

Browse files
authored
Feat/integrated ops count util (holochain#305)
* refactor: extract common logic of retry until complete or timeout into separate function, use in and * feat: util function integratedOpsCount to wait until the number of integrated Ops matches a target number, or else wait until timeout * feat: add 'PrivateContent' entry type and create_private fn to fixture zome * test: integratedOpsCount tests * docs: rebuild docs * chore: changelog * chore: fn description comment * chore: note breaking in changelog * chore: cleanup test scenario * chore: changelog accuracy * chore: comment grammer * chore: comment accuracy * fix: op assertion numbers and clarifying comment * chore: lint * test: clarify workaround in integrateOpsCount test after reviewing again * chore: changelog clobber * feat: use 40s timeouts by default on utils fns * test: ensure scenarios are cleaned up on failure * test: bump flake lock, remove workaround that was fixed in holochain * test: ensure scenario cleaned up
1 parent 89b2033 commit b7d795c

9 files changed

Lines changed: 472 additions & 309 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
66

77
### Added
88
- A new optional field `label` was added to the types `AppWithOptions`, `ConductorOptions`, `CreateConductorOptions`, and to the function `addConductor`. It allows overriding the default label which will prefix log messages of that Conductor instance.
9+
- A new method `integratedOpsCount` that polls for integrated ops and checks if the number of integrated ops is equal to the desired number for a given dna hash. (#[305](https://github.com/holochain/tryorama/pull/305))
910

1011
### Removed
12+
- **BREAKING**: Utility function `conductorCellsDhtSync` has been removed. Use `dhtSync` directly instead. (#[305](https://github.com/holochain/tryorama/pull/305))
13+
1114
### Changed
1215
- Log messages from Conductors that were created with `addPlayers` functions are now prefixed by `Tryorama - Player #` where "#" is the Player index. This makes it easier to distinguish log messages from different conductors. ([#302](https://github.com/holochain/tryorama/pull/302))
1316

docs/tryorama.conductorcellsdhtsync.md

Lines changed: 0 additions & 83 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@holochain/tryorama](./tryorama.md) &gt; [integratedOpsCount](./tryorama.integratedopscount.md)
4+
5+
## integratedOpsCount() function
6+
7+
A utility function to wait until a player's integrated Ops count equals a desired count for a DNA
8+
9+
**Signature:**
10+
11+
```typescript
12+
integratedOpsCount: (player: PlayerApp, cellId: CellId, targetIntegratedOpsCount: number, intervalMs?: number, timeoutMs?: number) => Promise<void>
13+
```
14+
15+
## Parameters
16+
17+
<table><thead><tr><th>
18+
19+
Parameter
20+
21+
22+
</th><th>
23+
24+
Type
25+
26+
27+
</th><th>
28+
29+
Description
30+
31+
32+
</th></tr></thead>
33+
<tbody><tr><td>
34+
35+
player
36+
37+
38+
</td><td>
39+
40+
[PlayerApp](./tryorama.playerapp.md)
41+
42+
43+
</td><td>
44+
45+
A Player.
46+
47+
48+
</td></tr>
49+
<tr><td>
50+
51+
cellId
52+
53+
54+
</td><td>
55+
56+
CellId
57+
58+
59+
</td><td>
60+
61+
The Cell to check the integrated Ops count for.
62+
63+
64+
</td></tr>
65+
<tr><td>
66+
67+
targetIntegratedOpsCount
68+
69+
70+
</td><td>
71+
72+
number
73+
74+
75+
</td><td>
76+
77+
The desired integrated Ops count to wait for.
78+
79+
80+
</td></tr>
81+
<tr><td>
82+
83+
intervalMs
84+
85+
86+
</td><td>
87+
88+
number
89+
90+
91+
</td><td>
92+
93+
_(Optional)_ Interval between comparisons in milliseconds (default 500).
94+
95+
96+
</td></tr>
97+
<tr><td>
98+
99+
timeoutMs
100+
101+
102+
</td><td>
103+
104+
number
105+
106+
107+
</td><td>
108+
109+
_(Optional)_ Timeout in milliseconds (default 40\_000).
110+
111+
112+
</td></tr>
113+
</tbody></table>
114+
**Returns:**
115+
116+
Promise&lt;void&gt;
117+
118+
A promise that resolves when the player's integrated ops count matches; rejects on timeout.
119+

docs/tryorama.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,6 @@ A utility function to compare conductors' integrated DhtOps.
101101
Run the `hc` command to delete all conductor data.
102102

103103

104-
</td></tr>
105-
<tr><td>
106-
107-
[conductorCellsDhtSync(conductorCells, intervalMs, timeoutMs)](./tryorama.conductorcellsdhtsync.md)
108-
109-
110-
</td><td>
111-
112-
A utility function to wait until all conductors' integrated DhtOps are identical for a DNA.
113-
114-
115104
</td></tr>
116105
<tr><td>
117106

@@ -178,6 +167,17 @@ A utility function to get the storage arc for a given player and dna hash.
178167
Get a shorthand function to call a cell's zome.
179168

180169

170+
</td></tr>
171+
<tr><td>
172+
173+
[integratedOpsCount(player, cellId, targetIntegratedOpsCount, intervalMs, timeoutMs)](./tryorama.integratedopscount.md)
174+
175+
176+
</td><td>
177+
178+
A utility function to wait until a player's integrated Ops count equals a desired count for a DNA
179+
180+
181181
</td></tr>
182182
<tr><td>
183183

0 commit comments

Comments
 (0)