Commit 408e8f8
authored
fix(test): make TestDropNamespaceErr resilient to async namespace operations (#9589)
## Summary
- Fixed flaky `TestDropNamespaceErr` in `edgraph/namespace_test.go`
- `DropAll` and `DropNamespace` are asynchronous operations, but the
test was asserting namespace count immediately after calling them
- Added a local `waitForNamespaceCount` polling helper that retries
`ListNamespaces` until the expected count is reached or a timeout occurs
## Root Cause
The test intermittently failed with:
```
"map[0: 11:id:11]" should have 1 item(s), but has 2
```
This happened because `DropNamespace` returns before the schema state
has fully propagated. The immediate `ListNamespaces` call would
sometimes see stale data.
## Test plan
- [ ] CI `dgraph-core-tests` passes (previously flaky test should now be
stable)
- [ ] Verify no regressions in other namespace-related tests1 parent 1d4b617 commit 408e8f8
1 file changed
Lines changed: 32 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
20 | 47 | | |
21 | 48 | | |
22 | 49 | | |
| |||
85 | 112 | | |
86 | 113 | | |
87 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
88 | 118 | | |
89 | 119 | | |
90 | 120 | | |
| |||
94 | 124 | | |
95 | 125 | | |
96 | 126 | | |
97 | | - | |
98 | | - | |
99 | | - | |
| 127 | + | |
| 128 | + | |
100 | 129 | | |
0 commit comments