synapse 2.176.0__py311-none-any.whl → 2.177.0__py311-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of synapse might be problematic. Click here for more details.
- synapse/axon.py +24 -9
- synapse/cortex.py +329 -168
- synapse/cryotank.py +46 -37
- synapse/datamodel.py +17 -4
- synapse/exc.py +19 -0
- synapse/lib/agenda.py +7 -13
- synapse/lib/auth.py +1520 -0
- synapse/lib/cell.py +255 -53
- synapse/lib/grammar.py +5 -0
- synapse/lib/hive.py +24 -3
- synapse/lib/hiveauth.py +6 -32
- synapse/lib/layer.py +7 -4
- synapse/lib/link.py +21 -17
- synapse/lib/lmdbslab.py +149 -0
- synapse/lib/modelrev.py +1 -1
- synapse/lib/schemas.py +136 -0
- synapse/lib/storm.py +61 -29
- synapse/lib/stormlib/aha.py +1 -1
- synapse/lib/stormlib/auth.py +185 -10
- synapse/lib/stormlib/cortex.py +16 -5
- synapse/lib/stormlib/gen.py +80 -0
- synapse/lib/stormlib/model.py +55 -0
- synapse/lib/stormlib/modelext.py +60 -0
- synapse/lib/stormlib/tabular.py +212 -0
- synapse/lib/stormtypes.py +14 -1
- synapse/lib/trigger.py +1 -1
- synapse/lib/version.py +2 -2
- synapse/lib/view.py +55 -28
- synapse/models/base.py +7 -0
- synapse/models/biz.py +4 -0
- synapse/models/files.py +8 -1
- synapse/models/inet.py +8 -0
- synapse/tests/files/changelog/model_2.176.0_16ee721a6b7221344eaf946c3ab4602dda546b1a.yaml.gz +0 -0
- synapse/tests/files/changelog/model_2.176.0_2a25c58bbd344716cd7cbc3f4304d8925b0f4ef2.yaml.gz +0 -0
- synapse/tests/test_axon.py +7 -4
- synapse/tests/test_cortex.py +127 -82
- synapse/tests/test_cryotank.py +4 -4
- synapse/tests/test_datamodel.py +7 -0
- synapse/tests/test_lib_agenda.py +7 -0
- synapse/tests/{test_lib_hiveauth.py → test_lib_auth.py} +314 -11
- synapse/tests/test_lib_cell.py +161 -8
- synapse/tests/test_lib_httpapi.py +18 -14
- synapse/tests/test_lib_layer.py +33 -33
- synapse/tests/test_lib_link.py +42 -1
- synapse/tests/test_lib_lmdbslab.py +68 -0
- synapse/tests/test_lib_nexus.py +4 -4
- synapse/tests/test_lib_node.py +0 -7
- synapse/tests/test_lib_storm.py +45 -0
- synapse/tests/test_lib_stormlib_aha.py +1 -2
- synapse/tests/test_lib_stormlib_auth.py +21 -0
- synapse/tests/test_lib_stormlib_cortex.py +12 -12
- synapse/tests/test_lib_stormlib_gen.py +99 -0
- synapse/tests/test_lib_stormlib_model.py +108 -0
- synapse/tests/test_lib_stormlib_modelext.py +64 -0
- synapse/tests/test_lib_stormlib_tabular.py +226 -0
- synapse/tests/test_lib_stormsvc.py +4 -1
- synapse/tests/test_lib_stormtypes.py +10 -0
- synapse/tests/test_model_base.py +3 -0
- synapse/tests/test_model_biz.py +3 -0
- synapse/tests/test_model_files.py +12 -2
- synapse/tests/test_model_inet.py +24 -0
- synapse/tests/test_tools_changelog.py +196 -0
- synapse/tests/test_tools_healthcheck.py +4 -3
- synapse/tests/utils.py +1 -1
- synapse/tools/changelog.py +774 -15
- {synapse-2.176.0.dist-info → synapse-2.177.0.dist-info}/METADATA +3 -3
- {synapse-2.176.0.dist-info → synapse-2.177.0.dist-info}/RECORD +70 -64
- {synapse-2.176.0.dist-info → synapse-2.177.0.dist-info}/WHEEL +1 -1
- {synapse-2.176.0.dist-info → synapse-2.177.0.dist-info}/LICENSE +0 -0
- {synapse-2.176.0.dist-info → synapse-2.177.0.dist-info}/top_level.txt +0 -0
synapse/models/biz.py
CHANGED
|
@@ -89,6 +89,10 @@ class BizModule(s_module.CoreModule):
|
|
|
89
89
|
('requirements', ('array', {'type': 'ou:goal', 'uniq': True, 'sorted': True}), {}),
|
|
90
90
|
)),
|
|
91
91
|
('biz:deal', {}, (
|
|
92
|
+
('id', ('str', {'strip': True}), {
|
|
93
|
+
'doc': 'An identifier for the deal.',
|
|
94
|
+
}),
|
|
95
|
+
|
|
92
96
|
('title', ('str', {}), {
|
|
93
97
|
'doc': 'A title for the deal.',
|
|
94
98
|
}),
|
synapse/models/files.py
CHANGED
|
@@ -715,13 +715,15 @@ class FileModule(s_module.CoreModule):
|
|
|
715
715
|
('entry:extended', ('file:path', {}), {
|
|
716
716
|
'doc': 'The extended file path contained within the extended FileEntry structure of the LNK file.'}),
|
|
717
717
|
('entry:localized', ('file:path', {}), {
|
|
718
|
-
'doc': 'The localized file path
|
|
718
|
+
'doc': 'The localized file path reconstructed from references within the extended FileEntry structure of the LNK file.'}),
|
|
719
719
|
('entry:icon', ('file:path', {}), {
|
|
720
720
|
'doc': 'The icon file path contained within the StringData structure of the LNK file.'}),
|
|
721
721
|
('environment:path', ('file:path', {}), {
|
|
722
722
|
'doc': 'The target file path contained within the EnvironmentVariableDataBlock structure of the LNK file.'}),
|
|
723
723
|
('environment:icon', ('file:path', {}), {
|
|
724
724
|
'doc': 'The icon file path contained within the IconEnvironmentDataBlock structure of the LNK file.'}),
|
|
725
|
+
('iconindex', ('int', {}), {
|
|
726
|
+
'doc': 'A resource index for an icon within an icon location.'}),
|
|
725
727
|
('working', ('file:path', {}), {
|
|
726
728
|
'doc': 'The working directory used when activating the link target.'}),
|
|
727
729
|
('relative', ('str', {'strip': True}), {
|
|
@@ -741,6 +743,11 @@ class FileModule(s_module.CoreModule):
|
|
|
741
743
|
'doc': 'The access time of the target file according to the LNK header.'}),
|
|
742
744
|
('target:written', ('time', {}), {
|
|
743
745
|
'doc': 'The write time of the target file according to the LNK header.'}),
|
|
746
|
+
|
|
747
|
+
('driveserial', ('int', {}), {
|
|
748
|
+
'doc': 'The drive serial number of the volume the link target is stored on.'}),
|
|
749
|
+
('machineid', ('it:hostname', {}), {
|
|
750
|
+
'doc': 'The NetBIOS name of the machine where the link target was last located.'}),
|
|
744
751
|
)),
|
|
745
752
|
),
|
|
746
753
|
|
synapse/models/inet.py
CHANGED
|
@@ -1576,6 +1576,10 @@ class InetModule(s_module.CoreModule):
|
|
|
1576
1576
|
('inet:service:message:attachment', ('guid', {}), {
|
|
1577
1577
|
'doc': 'A file attachment included within a message.'}),
|
|
1578
1578
|
|
|
1579
|
+
('inet:service:message:type:taxonomy', ('taxonomy', {}), {
|
|
1580
|
+
'interfaces': ('meta:taxonomy',),
|
|
1581
|
+
'doc': 'A message type taxonomy.'}),
|
|
1582
|
+
|
|
1579
1583
|
('inet:service:access', ('guid', {}), {
|
|
1580
1584
|
'interfaces': ('inet:service:action',),
|
|
1581
1585
|
'doc': 'Represents a user access request to a service resource.'}),
|
|
@@ -3645,6 +3649,7 @@ class InetModule(s_module.CoreModule):
|
|
|
3645
3649
|
# TODO ndef based auth proto details
|
|
3646
3650
|
)),
|
|
3647
3651
|
|
|
3652
|
+
('inet:service:message:type:taxonomy', {}, ()),
|
|
3648
3653
|
('inet:service:message', {}, (
|
|
3649
3654
|
|
|
3650
3655
|
('account', ('inet:service:account', {}), {
|
|
@@ -3704,6 +3709,9 @@ class InetModule(s_module.CoreModule):
|
|
|
3704
3709
|
|
|
3705
3710
|
('file', ('file:bytes', {}), {
|
|
3706
3711
|
'doc': 'The raw file that the message was extracted from.'}),
|
|
3712
|
+
|
|
3713
|
+
('type', ('inet:service:message:type:taxonomy', {}), {
|
|
3714
|
+
'doc': 'The type of message.'}),
|
|
3707
3715
|
)),
|
|
3708
3716
|
|
|
3709
3717
|
('inet:service:message:link', {}, (
|
|
Binary file
|
|
Binary file
|
synapse/tests/test_axon.py
CHANGED
|
@@ -941,13 +941,13 @@ bar baz",vv
|
|
|
941
941
|
conf = {'http:proxy': 'socks5://user:pass@127.0.0.1:1'}
|
|
942
942
|
async with self.getTestAxon(conf=conf) as axon:
|
|
943
943
|
async with axon.getLocalProxy() as proxy:
|
|
944
|
-
resp = await proxy.wget('http://vertex.link')
|
|
944
|
+
resp = await proxy.wget('http://vertex.link/')
|
|
945
945
|
self.false(resp.get('ok'))
|
|
946
946
|
self.isin('connect to proxy 127.0.0.1:1', resp.get('mesg', ''))
|
|
947
947
|
|
|
948
948
|
resp = await proxy.wget('vertex.link')
|
|
949
949
|
self.false(resp.get('ok'))
|
|
950
|
-
self.isin('
|
|
950
|
+
self.isin('InvalidUrlClientError: vertex.link', resp.get('mesg', ''))
|
|
951
951
|
|
|
952
952
|
async def test_axon_wput(self):
|
|
953
953
|
|
|
@@ -1027,11 +1027,11 @@ bar baz",vv
|
|
|
1027
1027
|
|
|
1028
1028
|
resp = await proxy.wput(sha256, 'vertex.link')
|
|
1029
1029
|
self.false(resp.get('ok'))
|
|
1030
|
-
self.isin('
|
|
1030
|
+
self.isin('InvalidUrlClientError: vertex.link', resp.get('mesg', ''))
|
|
1031
1031
|
|
|
1032
1032
|
resp = await proxy.postfiles(fields, 'vertex.link')
|
|
1033
1033
|
self.false(resp.get('ok'))
|
|
1034
|
-
self.isin('
|
|
1034
|
+
self.isin('InvalidUrlClientError: vertex.link', resp.get('reason'))
|
|
1035
1035
|
|
|
1036
1036
|
# Bypass the Axon proxy configuration from Storm
|
|
1037
1037
|
url = axon.getLocalUrl()
|
|
@@ -1131,6 +1131,9 @@ bar baz",vv
|
|
|
1131
1131
|
bytslist = [b async for b in axon.get(sha256, 2, size=6)]
|
|
1132
1132
|
self.eq(b'dfqwer', b''.join(bytslist))
|
|
1133
1133
|
|
|
1134
|
+
metrics = await axon.metrics()
|
|
1135
|
+
self.eq(metrics, {'size:bytes': 12, 'file:count': 1})
|
|
1136
|
+
|
|
1134
1137
|
async def test_axon_mirror(self):
|
|
1135
1138
|
|
|
1136
1139
|
async with self.getTestAhaProv() as aha:
|
synapse/tests/test_cortex.py
CHANGED
|
@@ -396,7 +396,7 @@ class CortexTest(s_t_utils.SynTest):
|
|
|
396
396
|
with self.getTestDir() as dirn:
|
|
397
397
|
|
|
398
398
|
async with self.getTestCore(dirn=dirn) as core:
|
|
399
|
-
self.nn(
|
|
399
|
+
self.nn(core.cellinfo.pop('cortex:version'))
|
|
400
400
|
|
|
401
401
|
with self.raises(s_exc.BadStorageVersion):
|
|
402
402
|
async with self.getTestCore(dirn=dirn) as core:
|
|
@@ -2693,6 +2693,8 @@ class CortexTest(s_t_utils.SynTest):
|
|
|
2693
2693
|
self.len(1, await core.nodes('.hehe [ -.hehe ]'))
|
|
2694
2694
|
self.len(0, await core.nodes('.hehe'))
|
|
2695
2695
|
|
|
2696
|
+
self.none(await core._addUnivProp('hehe', None, None))
|
|
2697
|
+
|
|
2696
2698
|
# ensure that we can delete univ props in a authenticated setting
|
|
2697
2699
|
async with self.getTestCoreAndProxy() as (realcore, core):
|
|
2698
2700
|
|
|
@@ -3145,6 +3147,8 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
3145
3147
|
self.len(0, pkgs)
|
|
3146
3148
|
await self.asyncraises(s_exc.NoSuchPkg, proxy.delStormPkg('foosball'))
|
|
3147
3149
|
|
|
3150
|
+
self.none(await core._delStormPkg('foosball'))
|
|
3151
|
+
|
|
3148
3152
|
# This segfaults in regex < 2022.9.11
|
|
3149
3153
|
query = '''test:str~="(?(?<=A)|(?(?![^B])C|D))"'''
|
|
3150
3154
|
msgs = await core.stormlist(query)
|
|
@@ -3886,16 +3890,15 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
3886
3890
|
await core.addStormPkg(otherpkg)
|
|
3887
3891
|
|
|
3888
3892
|
visi = await core.auth.addUser('visi')
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
opts['vars']['useriden'] = visi.iden
|
|
3893
|
+
uopts = dict(opts)
|
|
3894
|
+
uopts['user'] = visi.iden
|
|
3895
|
+
opts['vars']['useriden'] = visi.iden
|
|
3893
3896
|
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
+
await self.asyncraises(s_exc.AuthDeny, core.nodes('$lib.graph.del($iden2)', opts=uopts))
|
|
3898
|
+
await core.nodes('$lib.graph.grant($iden2, users, $useriden, 3)', opts=opts)
|
|
3899
|
+
await core.nodes('$lib.graph.del($iden2)', opts=uopts)
|
|
3897
3900
|
|
|
3898
|
-
|
|
3901
|
+
self.len(2, await core.callStorm('return($lib.graph.list())', opts=opts))
|
|
3899
3902
|
|
|
3900
3903
|
q = '$lib.graph.del($lib.guid(graph.powerup, testgraph))'
|
|
3901
3904
|
await self.asyncraises(s_exc.AuthDeny, core.nodes(q))
|
|
@@ -5905,7 +5908,7 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
5905
5908
|
# nexus recover() previously failed on adding to the hive
|
|
5906
5909
|
# although the dmon would get successfully started
|
|
5907
5910
|
self.nn(await core.callStorm('return($lib.dmon.get($iden))', opts=asuser))
|
|
5908
|
-
self.nn(core.
|
|
5911
|
+
self.nn(core.stormdmondefs.get(iden))
|
|
5909
5912
|
|
|
5910
5913
|
async def test_cortex_storm_dmon_view(self):
|
|
5911
5914
|
|
|
@@ -5948,7 +5951,7 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
5948
5951
|
|
|
5949
5952
|
visi = await core.auth.addUser('visi')
|
|
5950
5953
|
await visi.setAdmin(True)
|
|
5951
|
-
await visi.
|
|
5954
|
+
await visi.setProfileValu('cortex:view', view2_iden)
|
|
5952
5955
|
|
|
5953
5956
|
await core.nodes('$q=$lib.queue.add(dmon2)')
|
|
5954
5957
|
q = '''
|
|
@@ -6000,6 +6003,8 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
6000
6003
|
with self.raises(s_exc.CantDelCmd):
|
|
6001
6004
|
await core.delStormCmd('sleep')
|
|
6002
6005
|
|
|
6006
|
+
self.none(await core._delStormCmd('newp'))
|
|
6007
|
+
|
|
6003
6008
|
async def test_cortex_storm_lib_dmon_cmds(self):
|
|
6004
6009
|
async with self.getTestCore() as core:
|
|
6005
6010
|
await core.nodes('''
|
|
@@ -6115,12 +6120,22 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
6115
6120
|
await core.addFormProp('_hehe:haha', 'visi', ('str', {}), {})
|
|
6116
6121
|
self.len(1, await core.nodes('_hehe:haha [ :visi=lolz ]'))
|
|
6117
6122
|
|
|
6118
|
-
|
|
6119
|
-
await core.
|
|
6123
|
+
await core.addEdge(('test:int', '_goes', None), {})
|
|
6124
|
+
await core._addEdge(('test:int', '_goes', None), {})
|
|
6125
|
+
|
|
6126
|
+
with self.raises(s_exc.DupEdgeType):
|
|
6127
|
+
await core.addEdge(('test:int', '_goes', None), {})
|
|
6128
|
+
|
|
6129
|
+
# manually edit in borked entries
|
|
6130
|
+
core.extforms.set('_hehe:bork', ('_hehe:bork', None, None, None))
|
|
6131
|
+
core.extedges.set(s_common.guid('newp'), ((None, '_does', 'newp'), {}))
|
|
6120
6132
|
|
|
6121
6133
|
async with self.getTestCore(dirn=dirn) as core:
|
|
6122
6134
|
|
|
6123
6135
|
self.none(core.model.form('_hehe:bork'))
|
|
6136
|
+
self.none(core.model.edge((None, '_does', 'newp')))
|
|
6137
|
+
|
|
6138
|
+
self.nn(core.model.edge(('test:int', '_goes', None)))
|
|
6124
6139
|
|
|
6125
6140
|
self.len(1, await core.nodes('_hehe:haha=10'))
|
|
6126
6141
|
self.len(1, await core.nodes('_hehe:haha:visi=lolz'))
|
|
@@ -6173,6 +6188,11 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
6173
6188
|
with self.raises(s_exc.BadFormDef):
|
|
6174
6189
|
await core.delForm('hehe:haha')
|
|
6175
6190
|
|
|
6191
|
+
with self.raises(s_exc.NoSuchEdge):
|
|
6192
|
+
await core.delEdge(('newp', 'newp', 'newp'))
|
|
6193
|
+
|
|
6194
|
+
await core._delEdge(('newp', 'newp', 'newp'))
|
|
6195
|
+
|
|
6176
6196
|
await core.nodes('_hehe:haha [ -:visi ]')
|
|
6177
6197
|
await core.delFormProp('_hehe:haha', 'visi')
|
|
6178
6198
|
|
|
@@ -6301,100 +6321,121 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
6301
6321
|
await core.axon.metrics())
|
|
6302
6322
|
|
|
6303
6323
|
async def test_cortex_delLayerView(self):
|
|
6304
|
-
async with self.getTestCore() as core:
|
|
6305
6324
|
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
await self.asyncraises(s_exc.SynErr, core._delViewWithLayer(core.view.iden, None, None))
|
|
6325
|
+
with self.getTestDir() as dirn:
|
|
6326
|
+
async with self.getTestCore(dirn=dirn) as core:
|
|
6309
6327
|
|
|
6310
|
-
|
|
6311
|
-
|
|
6328
|
+
# Can't delete the default view
|
|
6329
|
+
await self.asyncraises(s_exc.SynErr, core.delView(core.view.iden))
|
|
6330
|
+
await self.asyncraises(s_exc.SynErr, core._delViewWithLayer(core.view.iden, None, None))
|
|
6312
6331
|
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
await self.asyncraises(s_exc.NoSuchView, core.delViewWithLayer('XXX'))
|
|
6332
|
+
# Can't delete a layer in a view
|
|
6333
|
+
await self.asyncraises(s_exc.SynErr, core.delLayer(core.view.layers[0].iden))
|
|
6316
6334
|
|
|
6317
|
-
|
|
6318
|
-
|
|
6335
|
+
# Can't delete a nonexistent view
|
|
6336
|
+
await self.asyncraises(s_exc.NoSuchView, core.delView('XXX'))
|
|
6337
|
+
await self.asyncraises(s_exc.NoSuchView, core.delViewWithLayer('XXX'))
|
|
6319
6338
|
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
view2_iden = vdef2.get('iden')
|
|
6339
|
+
# Can't delete a nonexistent layer
|
|
6340
|
+
await self.asyncraises(s_exc.NoSuchLayer, core.delLayer('XXX'))
|
|
6323
6341
|
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6342
|
+
# Fork the main view
|
|
6343
|
+
vdef2 = await core.view.fork()
|
|
6344
|
+
view2_iden = vdef2.get('iden')
|
|
6327
6345
|
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
view3_iden = (await core.addView(vdef3)).get('iden')
|
|
6346
|
+
# Can't delete a view twice
|
|
6347
|
+
await core.delView(view2_iden)
|
|
6348
|
+
await self.asyncraises(s_exc.NoSuchView, core.delView(view2_iden))
|
|
6332
6349
|
|
|
6333
|
-
|
|
6334
|
-
|
|
6350
|
+
layr = await core.addLayer()
|
|
6351
|
+
layriden = layr['iden']
|
|
6352
|
+
vdef3 = {'layers': (layriden,)}
|
|
6353
|
+
view3_iden = (await core.addView(vdef3)).get('iden')
|
|
6335
6354
|
|
|
6336
|
-
|
|
6355
|
+
opts = {'view': view3_iden}
|
|
6356
|
+
await core.callStorm('$lib.view.get().set(protected, $lib.true)', opts=opts)
|
|
6337
6357
|
|
|
6338
|
-
|
|
6358
|
+
await self.asyncraises(s_exc.CantDelView, core.delViewWithLayer(view3_iden))
|
|
6339
6359
|
|
|
6340
|
-
|
|
6341
|
-
vdef4 = await view3.fork()
|
|
6360
|
+
await core.callStorm('$lib.view.get().set(protected, $lib.false)', opts=opts)
|
|
6342
6361
|
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
view4 = core.getView(view4_iden)
|
|
6362
|
+
view3 = core.getView(view3_iden)
|
|
6363
|
+
vdef4 = await view3.fork()
|
|
6346
6364
|
|
|
6347
|
-
|
|
6348
|
-
|
|
6365
|
+
deadlayr = view3.layers[0].iden
|
|
6366
|
+
view4_iden = vdef4.get('iden')
|
|
6367
|
+
view4 = core.getView(view4_iden)
|
|
6349
6368
|
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
layr2 = await core.callStorm('$layer=$lib.layer.add() return($layer)')
|
|
6353
|
-
varz = {'iden': layriden, 'tgt': layr2.get('iden'), 'port': port}
|
|
6354
|
-
opts = {'vars': varz, 'view': view3_iden}
|
|
6355
|
-
|
|
6356
|
-
pullq = '$layer=$lib.layer.get($iden).addPull(`tcp://root:secret@127.0.0.1:{$port}/*/layer/{$tgt}`)'
|
|
6357
|
-
pushq = '$layer=$lib.layer.get($iden).addPush(`tcp://root:secret@127.0.0.1:{$port}/*/layer/{$tgt}`)'
|
|
6358
|
-
msgs = await core.stormlist(pullq, opts=opts)
|
|
6359
|
-
self.stormHasNoWarnErr(msgs)
|
|
6369
|
+
self.eq(view4.parent, view3)
|
|
6370
|
+
self.len(2, view4.layers)
|
|
6360
6371
|
|
|
6361
|
-
|
|
6362
|
-
|
|
6372
|
+
await core.auth.rootuser.setPasswd('secret')
|
|
6373
|
+
host, port = await core.dmon.listen('tcp://127.0.0.1:0/')
|
|
6374
|
+
layr2 = await core.callStorm('$layer=$lib.layer.add() return($layer)')
|
|
6375
|
+
varz = {'iden': layriden, 'tgt': layr2.get('iden'), 'port': port}
|
|
6376
|
+
opts = {'vars': varz, 'view': view3_iden}
|
|
6363
6377
|
|
|
6364
|
-
|
|
6378
|
+
pullq = '$layer=$lib.layer.get($iden).addPull(`tcp://root:secret@127.0.0.1:{$port}/*/layer/{$tgt}`)'
|
|
6379
|
+
pushq = '$layer=$lib.layer.get($iden).addPush(`tcp://root:secret@127.0.0.1:{$port}/*/layer/{$tgt}`)'
|
|
6380
|
+
msgs = await core.stormlist(pullq, opts=opts)
|
|
6381
|
+
self.stormHasNoWarnErr(msgs)
|
|
6365
6382
|
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
]
|
|
6371
|
-
task = core.schedCoro(s_t_utils.waitForBehold(core, events))
|
|
6383
|
+
msgs = await core.stormlist(pushq, opts=opts)
|
|
6384
|
+
self.stormHasNoWarnErr(msgs)
|
|
6385
|
+
|
|
6386
|
+
coros = len(core.activecoros)
|
|
6372
6387
|
|
|
6373
|
-
|
|
6388
|
+
layridens = [lyr.iden for lyr in view4.layers if lyr.iden != view3.layers[0].iden]
|
|
6389
|
+
events = [
|
|
6390
|
+
{'event': 'view:setlayers', 'info': {'iden': view4.iden, 'layers': layridens}},
|
|
6391
|
+
{'event': 'view:set', 'info': {'iden': view4.iden, 'name': 'parent', 'valu': None}}
|
|
6392
|
+
]
|
|
6393
|
+
task = core.schedCoro(s_t_utils.waitForBehold(core, events))
|
|
6374
6394
|
|
|
6375
|
-
|
|
6395
|
+
await core.delViewWithLayer(view3_iden)
|
|
6376
6396
|
|
|
6377
|
-
|
|
6378
|
-
self.len(coros - 2, core.activecoros)
|
|
6397
|
+
await asyncio.wait_for(task, timeout=1)
|
|
6379
6398
|
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
self.none(core.getLayer(deadlayr))
|
|
6399
|
+
# push/pull activecoros have been deleted
|
|
6400
|
+
self.len(coros - 2, core.activecoros)
|
|
6383
6401
|
|
|
6384
|
-
|
|
6385
|
-
|
|
6402
|
+
self.none(view4.parent)
|
|
6403
|
+
self.len(1, view4.layers)
|
|
6404
|
+
self.none(core.getLayer(deadlayr))
|
|
6386
6405
|
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
view6 = core.getView((await core.addView(vdef6)).get('iden'))
|
|
6406
|
+
vdef5 = await view4.fork()
|
|
6407
|
+
view5 = core.getView(vdef5.get('iden'))
|
|
6390
6408
|
|
|
6391
|
-
|
|
6409
|
+
usedlayr = view4.layers[0].iden
|
|
6410
|
+
vdef6 = {'layers': (usedlayr,)}
|
|
6411
|
+
view6 = core.getView((await core.addView(vdef6)).get('iden'))
|
|
6392
6412
|
|
|
6393
|
-
|
|
6394
|
-
self.len(1, view5.layers)
|
|
6413
|
+
await core.delViewWithLayer(view4_iden)
|
|
6395
6414
|
|
|
6396
|
-
|
|
6397
|
-
|
|
6415
|
+
self.none(view5.parent)
|
|
6416
|
+
self.len(1, view5.layers)
|
|
6417
|
+
|
|
6418
|
+
self.nn(core.getLayer(usedlayr))
|
|
6419
|
+
self.eq([usedlayr], [lyr.iden for lyr in view6.layers])
|
|
6420
|
+
|
|
6421
|
+
layrs = list(core.layers.keys())
|
|
6422
|
+
viewdefs = {}
|
|
6423
|
+
for vdef in await core.getViewDefs():
|
|
6424
|
+
vdef['layers'] = [layr['iden'] for layr in vdef['layers']]
|
|
6425
|
+
viewdefs[vdef['iden']] = vdef
|
|
6426
|
+
|
|
6427
|
+
async with self.getTestCore(dirn=dirn) as core:
|
|
6428
|
+
self.sorteq(layrs, list(core.layers.keys()))
|
|
6429
|
+
|
|
6430
|
+
viewdefs2 = {}
|
|
6431
|
+
for vdef in await core.getViewDefs():
|
|
6432
|
+
vdef['layers'] = [layr['iden'] for layr in vdef['layers']]
|
|
6433
|
+
viewdefs2[vdef['iden']] = vdef
|
|
6434
|
+
|
|
6435
|
+
self.eq(len(viewdefs), len(viewdefs2))
|
|
6436
|
+
|
|
6437
|
+
for iden, vdef in viewdefs.items():
|
|
6438
|
+
self.eq(vdef, viewdefs2.get(iden))
|
|
6398
6439
|
|
|
6399
6440
|
async def test_cortex_view_opts(self):
|
|
6400
6441
|
'''
|
|
@@ -6675,7 +6716,7 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
6675
6716
|
await proxy.popStormVar('hehe')
|
|
6676
6717
|
|
|
6677
6718
|
async with core.getLocalProxy() as proxy:
|
|
6678
|
-
self.
|
|
6719
|
+
self.eq('haha', await proxy.setStormVar('hehe', 'haha'))
|
|
6679
6720
|
self.eq('haha', await proxy.getStormVar('hehe'))
|
|
6680
6721
|
self.eq('hoho', await proxy.getStormVar('lolz', default='hoho'))
|
|
6681
6722
|
self.eq('haha', await proxy.popStormVar('hehe'))
|
|
@@ -8134,6 +8175,10 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
8134
8175
|
with self.raises(s_exc.AuthDeny) as cm:
|
|
8135
8176
|
await core.nodes('[test:str=hello]', opts=aslow)
|
|
8136
8177
|
|
|
8178
|
+
# Coverage for nonexistent users/roles
|
|
8179
|
+
core.auth.stor.set('gate:cortex:user:newp', {'iden': 'newp'})
|
|
8180
|
+
core.auth.stor.set('gate:cortex:role:newp', {'iden': 'newp'})
|
|
8181
|
+
|
|
8137
8182
|
with self.getAsyncLoggerStream('synapse.cortex') as stream:
|
|
8138
8183
|
async with self.getTestCore(dirn=dirn) as core: # type: s_cortex.Cortex
|
|
8139
8184
|
# The cortex authgate still does nothing
|
synapse/tests/test_cryotank.py
CHANGED
|
@@ -119,14 +119,14 @@ class CryoTest(s_t_utils.SynTest):
|
|
|
119
119
|
# test passing conf data in through init directly
|
|
120
120
|
tank = await cryo.init('conftest', conf={'map_size': s_const.mebibyte * 64})
|
|
121
121
|
self.eq(tank.slab.mapsize, s_const.mebibyte * 64)
|
|
122
|
-
_, conf =
|
|
122
|
+
_, conf = cryo.names.get('conftest')
|
|
123
123
|
self.eq(conf, {'map_size': s_const.mebibyte * 64})
|
|
124
124
|
|
|
125
125
|
# And the data was persisted
|
|
126
126
|
async with self.getTestCryo(dirn) as cryo:
|
|
127
127
|
tank = cryo.tanks.get('conftest')
|
|
128
128
|
self.eq(tank.slab.mapsize, s_const.mebibyte * 64)
|
|
129
|
-
_, conf =
|
|
129
|
+
_, conf = cryo.names.get('conftest')
|
|
130
130
|
self.eq(conf, {'map_size': s_const.mebibyte * 64})
|
|
131
131
|
|
|
132
132
|
async def test_cryo_perms(self):
|
|
@@ -264,14 +264,14 @@ class CryoTest(s_t_utils.SynTest):
|
|
|
264
264
|
)
|
|
265
265
|
|
|
266
266
|
tank00 = await cryo.init('tank00')
|
|
267
|
-
self.true(tank00iden == cryo.names.get('tank00')
|
|
267
|
+
self.true(tank00iden == cryo.names.get('tank00')[0] == tank00.iden())
|
|
268
268
|
self.false(os.path.exists(os.path.join(tank00.dirn, 'guid')))
|
|
269
269
|
self.false(os.path.exists(os.path.join(tank00.dirn, 'cell.guid')))
|
|
270
270
|
self.false(os.path.exists(os.path.join(tank00.dirn, 'slabs', 'cell.lmdb')))
|
|
271
271
|
self.eq(0, s_slaboffs.SlabOffs(tank00.slab, 'offsets').get(seqniden))
|
|
272
272
|
|
|
273
273
|
tank01 = await cryo.init('tank01')
|
|
274
|
-
self.true(tank01iden == cryo.names.get('tank01')
|
|
274
|
+
self.true(tank01iden == cryo.names.get('tank01')[0] == tank01.iden())
|
|
275
275
|
self.false(os.path.exists(os.path.join(tank01.dirn, 'guid')))
|
|
276
276
|
self.false(os.path.exists(os.path.join(tank01.dirn, 'cell.guid')))
|
|
277
277
|
self.false(os.path.exists(os.path.join(tank01.dirn, 'slabs', 'cell.lmdb')))
|
synapse/tests/test_datamodel.py
CHANGED
|
@@ -321,3 +321,10 @@ class DataModelTest(s_t_utils.SynTest):
|
|
|
321
321
|
|
|
322
322
|
model = (await core.getModelDefs())[0][1]
|
|
323
323
|
self.isin(('meta:rule', 'matches', None), [e[0] for e in model['edges']])
|
|
324
|
+
|
|
325
|
+
self.nn(core.model.edge(('meta:rule', 'matches', None)))
|
|
326
|
+
|
|
327
|
+
core.model.delEdge(('meta:rule', 'matches', None))
|
|
328
|
+
self.none(core.model.edge(('meta:rule', 'matches', None)))
|
|
329
|
+
|
|
330
|
+
core.model.delEdge(('meta:rule', 'matches', None))
|
synapse/tests/test_lib_agenda.py
CHANGED
|
@@ -485,6 +485,13 @@ class AgendaTest(s_t_utils.SynTest):
|
|
|
485
485
|
|
|
486
486
|
await core.updateCronJob(guid3, '#bahhumbug')
|
|
487
487
|
|
|
488
|
+
# Add a job with invalid storage version
|
|
489
|
+
cdef = (await core.listCronJobs())[0]
|
|
490
|
+
guid = s_common.guid()
|
|
491
|
+
cdef['ver'] = 0
|
|
492
|
+
cdef['iden'] = guid
|
|
493
|
+
core.agenda.apptdefs.set(guid, cdef)
|
|
494
|
+
|
|
488
495
|
async with self.getTestCore(dirn=dirn) as core:
|
|
489
496
|
|
|
490
497
|
appts = await core.listCronJobs()
|