Skip to content

Commit d269eda

Browse files
vEpiphyteCisphyx
andauthored
Bug: Fix flakey test in test_lib_storm_basics (SYN-6804) (#3517)
Co-authored-by: Cisphyx <[email protected]>
1 parent a0885db commit d269eda

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

synapse/tests/test_cortex.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8005,6 +8005,9 @@ async def test_cortex_query_offload(self):
80058005
self.true(core01.isactive)
80068006
self.false(core00.isactive)
80078007

8008+
# Let the mirror reconnect
8009+
self.true(await asyncio.wait_for(core01.stormpool.ready.wait(), 12))
8010+
80088011
with self.getLoggerStream('synapse') as stream:
80098012
self.true(await core01.callStorm('inet:asn=0 return($lib.true)'))
80108013

synapse/tests/test_lib_storm.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,15 +914,28 @@ async def test_lib_storm_basics(self):
914914
with self.raises(s_exc.CantMergeView):
915915
await core.callStorm('inet:ipv4=11.22.33.44 | merge')
916916

917-
# test printing a merge that the node was created in the top layer
917+
# test printing a merge that the node was created in the top layer. We also need to make sure the layer
918+
# is in a steady state for layer merge --diff tests.
919+
920+
real_layer = core.layers.get(layr) # type: s_layer.Layer
921+
if real_layer.dirty:
922+
waiter = real_layer.layrslab.waiter(1, 'commit')
923+
await waiter.wait(timeout=12)
924+
925+
waiter = real_layer.layrslab.waiter(1, 'commit')
918926
msgs = await core.stormlist('[ inet:fqdn=mvmnasde.com ] | merge', opts=opts)
927+
919928
self.stormIsInPrint('3496c02183961db4fbc179f0ceb5526347b37d8ff278279917b6eb6d39e1e272 inet:fqdn = mvmnasde.com', msgs)
920929
self.stormIsInPrint('3496c02183961db4fbc179f0ceb5526347b37d8ff278279917b6eb6d39e1e272 inet:fqdn:host = mvmnasde', msgs)
921930
self.stormIsInPrint('3496c02183961db4fbc179f0ceb5526347b37d8ff278279917b6eb6d39e1e272 inet:fqdn:domain = com', msgs)
922931
self.stormIsInPrint('3496c02183961db4fbc179f0ceb5526347b37d8ff278279917b6eb6d39e1e272 inet:fqdn:issuffix = false', msgs)
923932
self.stormIsInPrint('3496c02183961db4fbc179f0ceb5526347b37d8ff278279917b6eb6d39e1e272 inet:fqdn:iszone = true', msgs)
924933
self.stormIsInPrint('3496c02183961db4fbc179f0ceb5526347b37d8ff278279917b6eb6d39e1e272 inet:fqdn:zone = mvmnasde.com', msgs)
925934

935+
# Ensure that the layer has sync()'d to avoid getting data from
936+
# dirty sodes in the merge --diff tests.
937+
self.len(1, await waiter.wait(timeout=12))
938+
926939
# test that a user without perms can diff but not apply
927940
await visi.addRule((True, ('view', 'read')))
928941

0 commit comments

Comments
 (0)