synapse 2.199.0__py311-none-any.whl → 2.200.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/cortex.py CHANGED
@@ -20,7 +20,6 @@ import synapse.lib.base as s_base
20
20
  import synapse.lib.cell as s_cell
21
21
  import synapse.lib.chop as s_chop
22
22
  import synapse.lib.coro as s_coro
23
- import synapse.lib.hive as s_hive
24
23
  import synapse.lib.view as s_view
25
24
  import synapse.lib.cache as s_cache
26
25
  import synapse.lib.const as s_const
@@ -855,7 +854,6 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
855
854
  cellapi = CoreApi
856
855
  viewapi = s_view.ViewApi
857
856
  layerapi = s_layer.LayerApi
858
- hiveapi = s_hive.HiveApi
859
857
 
860
858
  viewctor = s_view.View.anit
861
859
  layrctor = s_layer.Layer.anit
@@ -4656,10 +4654,6 @@ class Cortex(s_oauth.OAuthMixin, s_cell.Cell): # type: ignore
4656
4654
  if not path:
4657
4655
  return await self.cellapi.anit(self, link, user)
4658
4656
 
4659
- if path[0] == 'hive' and user.isAdmin():
4660
- s_common.deprecated('Cortex /hive telepath path', curv='2.198.0', eolv='2.199.0')
4661
- return await self.hiveapi.anit(self.hive, user)
4662
-
4663
4657
  if path[0] == 'layer':
4664
4658
 
4665
4659
  if len(path) == 1:
synapse/datamodel.py CHANGED
@@ -1,6 +1,7 @@
1
1
  '''
2
2
  An API to assist with the creation and enforcement of cortex data models.
3
3
  '''
4
+ import sys
4
5
  import asyncio
5
6
  import logging
6
7
  import collections
@@ -15,6 +16,7 @@ import synapse.lib.cache as s_cache
15
16
  import synapse.lib.types as s_types
16
17
  import synapse.lib.dyndeps as s_dyndeps
17
18
  import synapse.lib.grammar as s_grammar
19
+ import synapse.lib.msgpack as s_msgpack
18
20
 
19
21
  logger = logging.getLogger(__name__)
20
22
 
@@ -142,6 +144,9 @@ class Prop:
142
144
  async def depfunc(node, oldv):
143
145
  mesg = f'The property {self.full} is deprecated or using a deprecated type and will be removed in 3.0.0'
144
146
  await node.snap.warnonce(mesg)
147
+ if __debug__:
148
+ sys.audit('synapse.datamodel.Prop.deprecated', mesg, self.full)
149
+
145
150
  self.onSet(depfunc)
146
151
 
147
152
  def __repr__(self):
@@ -306,6 +311,8 @@ class Form:
306
311
  async def depfunc(node):
307
312
  mesg = f'The form {self.full} is deprecated or using a deprecated type and will be removed in 3.0.0'
308
313
  await node.snap.warnonce(mesg)
314
+ if __debug__:
315
+ sys.audit('synapse.datamodel.Form.deprecated', mesg, self.full)
309
316
  self.onAdd(depfunc)
310
317
 
311
318
  def getStorNode(self, form):
@@ -1107,7 +1114,7 @@ class Model:
1107
1114
 
1108
1115
  def _prepFormIface(self, form, iface):
1109
1116
 
1110
- template = iface.get('template', {})
1117
+ template = s_msgpack.deepcopy(iface.get('template', {}))
1111
1118
  template.update(form.type.info.get('template', {}))
1112
1119
 
1113
1120
  def convert(item):
synapse/lib/hive.py CHANGED
@@ -86,7 +86,7 @@ class Node(s_base.Base):
86
86
  for name, node in self.kids.items():
87
87
  yield name, node
88
88
 
89
- class Hive(s_nexus.Pusher, s_telepath.Aware):
89
+ class Hive(s_nexus.Pusher):
90
90
  '''
91
91
  An optionally persistent atomically accessed tree which implements
92
92
  primitives for use in making distributed/clustered services.
@@ -95,8 +95,6 @@ class Hive(s_nexus.Pusher, s_telepath.Aware):
95
95
 
96
96
  await s_nexus.Pusher.__anit__(self, 'hive', nexsroot=nexsroot)
97
97
 
98
- s_telepath.Aware.__init__(self)
99
-
100
98
  if conf is None:
101
99
  conf = {}
102
100
 
@@ -161,24 +159,6 @@ class Hive(s_nexus.Pusher, s_telepath.Aware):
161
159
  for cullname in culls:
162
160
  await node.pop((cullname,))
163
161
 
164
- async def getHiveAuth(self):
165
- '''
166
- Retrieve a HiveAuth for hive standalone or non-cell uses.
167
-
168
- Note:
169
- This is for the hive's own auth, or for non-cell auth. It isn't the same auth as for a cell
170
- '''
171
- import synapse.lib.hiveauth as s_hiveauth
172
- if self.auth is None:
173
-
174
- path = tuple(self.conf.get('auth:path').split('/'))
175
-
176
- node = await self.open(path)
177
- self.auth = await s_hiveauth.Auth.anit(node, nexsroot=self.nexsroot)
178
- self.onfini(self.auth.fini)
179
-
180
- return self.auth
181
-
182
162
  async def _onHiveFini(self):
183
163
  await self.root.fini()
184
164
 
@@ -423,27 +403,6 @@ class Hive(s_nexus.Pusher, s_telepath.Aware):
423
403
 
424
404
  return node.valu
425
405
 
426
- async def getTeleApi(self, link, mesg, path):
427
- s_common.deprecated('Hive.getTeleApi', curv='2.198.0', eolv='2.199.0')
428
- auth = await self.getHiveAuth()
429
-
430
- if not self.conf.get('auth:en'):
431
- user = await auth.getUserByName('root')
432
- return await HiveApi.anit(self, user)
433
-
434
- name, info = mesg[1].get('auth')
435
-
436
- user = await auth.getUserByName(name)
437
- if user is None:
438
- raise s_exc.NoSuchUser(name=name)
439
-
440
- # passwd None always fails...
441
- passwd = info.get('passwd')
442
- if not await user.tryPasswd(passwd):
443
- raise s_exc.AuthDeny(mesg='Invalid password', user=user.iden, username=user.name)
444
-
445
- return await HiveApi.anit(self, user)
446
-
447
406
  async def _storLoadHive(self):
448
407
  pass
449
408
 
@@ -480,224 +439,6 @@ class SlabHive(Hive):
480
439
  lkey = '\x00'.join(full).encode('utf8')
481
440
  self.slab.pop(lkey, db=self.db)
482
441
 
483
- class HiveApi(s_base.Base):
484
-
485
- async def __anit__(self, hive, user):
486
-
487
- await s_base.Base.__anit__(self)
488
-
489
- self.hive = hive
490
- self.user = user
491
-
492
- self.msgq = asyncio.Queue(maxsize=10000)
493
-
494
- self.onfini(self._onHapiFini)
495
-
496
- async def loadHiveTree(self, tree, path=(), trim=False):
497
- s_common.deprecated('HiveApi.loadHiveTree', curv='2.167.0')
498
- return await self.hive.loadHiveTree(tree, path=path, trim=trim)
499
-
500
- async def saveHiveTree(self, path=()):
501
- s_common.deprecated('HiveApi.saveHiveTree', curv='2.167.0')
502
- return await self.hive.saveHiveTree(path=path)
503
-
504
- async def treeAndSync(self, path, iden):
505
- s_common.deprecated('HiveApi.treeAndSync', curv='2.167.0')
506
-
507
- node = await self.hive.open(path)
508
-
509
- # register handlers...
510
- node.on('hive:add', self._onHiveEdit, base=self)
511
- node.on('hive:set', self._onHiveEdit, base=self)
512
- node.on('hive:pop', self._onHiveEdit, base=self)
513
-
514
- # serialize the subtree into a message and return
515
- # via the mesg queue so there is no get/update race
516
- root = (node.valu, {})
517
-
518
- todo = collections.deque([(node, root)])
519
-
520
- # breadth first generator
521
- while todo:
522
-
523
- node, pode = todo.popleft()
524
-
525
- for name, kidn in node.kids.items():
526
-
527
- kidp = (kidn.valu, {})
528
- pode[1][name] = kidp
529
-
530
- todo.append((kidn, kidp))
531
-
532
- await self.msgq.put(('hive:tree', {'path': path, 'tree': root}))
533
- await self.msgq.put(('hive:sync', {'iden': iden}))
534
- return
535
-
536
- async def setAndSync(self, path, valu, iden, nexs=False):
537
- s_common.deprecated('HiveApi.setAndSync', curv='2.167.0')
538
-
539
- valu = await self.hive.set(path, valu, nexs=nexs)
540
- await self.msgq.put(('hive:sync', {'iden': iden}))
541
- return valu
542
-
543
- async def addAndSync(self, path, valu, iden):
544
- s_common.deprecated('HiveApi.addAndSync', curv='2.167.0')
545
-
546
- valu = await self.hive.add(path, valu)
547
- await self.msgq.put(('hive:sync', {'iden': iden}))
548
- return valu
549
-
550
- async def popAndSync(self, path, iden, nexs=False):
551
- s_common.deprecated('HiveApi.popAndSync', curv='2.167.0')
552
-
553
- valu = await self.hive.pop(path, nexs=nexs)
554
- await self.msgq.put(('hive:sync', {'iden': iden}))
555
- return valu
556
-
557
- async def _onHapiFini(self):
558
- await self.msgq.put(None)
559
-
560
- async def _onHiveEdit(self, mesg):
561
- self.msgq.put_nowait(mesg)
562
-
563
- async def get(self, full):
564
- s_common.deprecated('HiveApi.get', curv='2.167.0')
565
- return await self.hive.get(full)
566
-
567
- async def edits(self):
568
- s_common.deprecated('HiveApi.edits', curv='2.167.0')
569
-
570
- while not self.isfini:
571
-
572
- item = await self.msgq.get()
573
- if item is None:
574
- return
575
-
576
- yield item
577
-
578
- class TeleHive(Hive):
579
- '''
580
- A Hive that acts as a consistent read cache for a telepath proxy Hive
581
- '''
582
-
583
- async def __anit__(self, proxy):
584
-
585
- self.proxy = proxy
586
-
587
- await Hive.__anit__(self)
588
-
589
- self.lock = asyncio.Lock()
590
-
591
- self.syncevents = {} # iden: asyncio.Event()
592
-
593
- # fire a task to sync the sections of the tree we open
594
- self.schedCoro(self._runHiveLoop())
595
-
596
- self.mesgbus = await s_base.Base.anit()
597
- self.mesgbus.on('hive:set', self._onHiveSet)
598
- self.mesgbus.on('hive:pop', self._onHivePop)
599
- self.mesgbus.on('hive:tree', self._onHiveTree)
600
- self.mesgbus.on('hive:sync', self._onHiveSync)
601
-
602
- self.onfini(self.mesgbus.fini)
603
-
604
- self.onfini(proxy.fini)
605
-
606
- async def _onHiveSync(self, mesg):
607
-
608
- iden = mesg[1].get('iden')
609
- evnt = self.syncevents.pop(iden, None)
610
- if evnt is None:
611
- return
612
-
613
- evnt.set()
614
-
615
- def _getSyncIden(self):
616
- iden = s_common.guid()
617
- evnt = asyncio.Event()
618
- self.syncevents[iden] = evnt
619
- return iden, evnt
620
-
621
- async def _runHiveLoop(self):
622
- while not self.isfini:
623
- async for mesg in self.proxy.edits():
624
- await self.mesgbus.dist(mesg)
625
-
626
- async def _onHiveSet(self, mesg):
627
- path = mesg[1].get('path')
628
- valu = mesg[1].get('valu')
629
- await Hive.set(self, path, valu)
630
-
631
- async def _onHivePop(self, mesg):
632
- path = mesg[1].get('path')
633
- await Hive.pop(self, path)
634
-
635
- async def _onHiveTree(self, mesg):
636
-
637
- # get an entire tree update at once
638
- path = mesg[1].get('path')
639
- tree = mesg[1].get('tree')
640
-
641
- node = await Hive.open(self, path)
642
-
643
- todo = collections.deque([(node, path, tree)])
644
-
645
- while todo:
646
-
647
- node, path, (valu, kids) = todo.popleft()
648
-
649
- # do *not* go through the set() API
650
- node.valu = valu
651
- for name, kidt in kids.items():
652
-
653
- kidp = path + (name,)
654
- kidn = await Hive.open(self, kidp)
655
-
656
- todo.append((kidn, kidp, kidt))
657
-
658
- async def set(self, path, valu, nexs=False):
659
- iden, evnt = self._getSyncIden()
660
- valu = await self.proxy.setAndSync(path, valu, iden, nexs=nexs)
661
- await evnt.wait()
662
- return valu
663
-
664
- async def add(self, path, valu):
665
- iden, evnt = self._getSyncIden()
666
- valu = await self.proxy.addAndSync(path, valu, iden)
667
- await evnt.wait()
668
- return valu
669
-
670
- async def pop(self, path, nexs=False):
671
- iden, evnt = self._getSyncIden()
672
- valu = await self.proxy.popAndSync(path, iden, nexs=nexs)
673
- await evnt.wait()
674
- return valu
675
-
676
- async def get(self, path):
677
- return await self.proxy.get(path)
678
-
679
- async def open(self, path):
680
-
681
- # try once pre-lock for speed
682
- node = self.nodes.get(path)
683
- if node is not None:
684
- return node
685
-
686
- async with self.lock:
687
-
688
- # try again with lock to avoid race
689
- node = self.nodes.get(path)
690
- if node is not None:
691
- return node
692
-
693
- iden, evnt = self._getSyncIden()
694
-
695
- await self.proxy.treeAndSync(path, iden)
696
-
697
- await evnt.wait()
698
-
699
- return self.nodes.get(path)
700
-
701
442
  class HiveDict(s_base.Base):
702
443
  '''
703
444
  '''
@@ -758,11 +499,6 @@ def iterpath(path):
758
499
  for i in range(len(path)):
759
500
  yield path[:i + 1]
760
501
 
761
- async def openurl(url, **opts):
762
- s_common.deprecated('synapse.lib.hive.openurl()', curv='2.198.0', eolv='2.199.0')
763
- prox = await s_telepath.openurl(url, **opts)
764
- return await TeleHive.anit(prox)
765
-
766
502
  async def opendir(dirn, conf=None):
767
503
  slab = await s_slab.Slab.anit(dirn, map_size=s_const.gibibyte)
768
504
  db = slab.initdb('hive')
synapse/lib/snap.py CHANGED
@@ -1,6 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import sys
4
3
  import types
5
4
  import asyncio
6
5
  import logging
@@ -12,14 +11,12 @@ import synapse.exc as s_exc
12
11
  import synapse.common as s_common
13
12
 
14
13
  import synapse.lib.base as s_base
15
- import synapse.lib.coro as s_coro
16
14
  import synapse.lib.node as s_node
17
15
  import synapse.lib.time as s_time
18
16
  import synapse.lib.cache as s_cache
19
17
  import synapse.lib.layer as s_layer
20
18
  import synapse.lib.storm as s_storm
21
19
  import synapse.lib.types as s_types
22
- import synapse.lib.spooled as s_spooled
23
20
 
24
21
  logger = logging.getLogger(__name__)
25
22
 
@@ -1606,7 +1603,8 @@ class Snap(s_base.Base):
1606
1603
  proptype = prop.type
1607
1604
  for prop in prop.getAlts():
1608
1605
  if prop.type.isarray and prop.type.arraytype == proptype:
1609
- if valu in node.get(prop.name):
1606
+ arryvalu = node.get(prop.name)
1607
+ if arryvalu is not None and valu in arryvalu:
1610
1608
  return True
1611
1609
  else:
1612
1610
  if node.get(prop.name) == valu:
@@ -1694,10 +1692,6 @@ class Snap(s_base.Base):
1694
1692
  return tagnode
1695
1693
 
1696
1694
  async def _raiseOnStrict(self, ctor, mesg, **info):
1697
- if __debug__:
1698
- if issubclass(ctor, s_exc.IsDeprLocked):
1699
- sys.audit('synapse.exc.IsDeprLocked', (mesg, info))
1700
-
1701
1695
  if self.strict:
1702
1696
  raise ctor(mesg=mesg, **info)
1703
1697
  await self.warn(mesg)
synapse/lib/storm.py CHANGED
@@ -2077,7 +2077,7 @@ class Runtime(s_base.Base):
2077
2077
 
2078
2078
  class Parser:
2079
2079
 
2080
- def __init__(self, prog=None, descr=None, root=None, model=None):
2080
+ def __init__(self, prog=None, descr=None, root=None, model=None, cdef=None):
2081
2081
 
2082
2082
  if root is None:
2083
2083
  root = self
@@ -2088,6 +2088,7 @@ class Parser:
2088
2088
 
2089
2089
  self.prog = prog
2090
2090
  self.descr = descr
2091
+ self.cdef = cdef
2091
2092
 
2092
2093
  self.exc = None
2093
2094
 
@@ -2365,6 +2366,21 @@ class Parser:
2365
2366
 
2366
2367
  self._printf(f'Usage: {self.prog} [options] {posargs}')
2367
2368
 
2369
+ if self.cdef is not None and (endpoints := self.cdef.get('endpoints')):
2370
+ self._printf('')
2371
+ self._printf('Endpoints:')
2372
+ self._printf('')
2373
+ base_w = 32
2374
+ wrap_w = 120 - base_w
2375
+ for endpoint in endpoints:
2376
+ path = endpoint['path']
2377
+ desc = endpoint.get('desc', '')
2378
+ base = f' {path}'
2379
+ wrap_desc = self._wrap_text(desc, wrap_w) if desc else ['']
2380
+ self._printf(f'{base:<{base_w-2}}: {wrap_desc[0]}')
2381
+ for ln in wrap_desc[1:]:
2382
+ self._printf(f'{"":<{base_w}}{ln}')
2383
+
2368
2384
  options = [x for x in self.allargs if x[0][0].startswith('-')]
2369
2385
 
2370
2386
  self._printf('')
@@ -2655,6 +2671,7 @@ class PureCmd(Cmd):
2655
2671
  if inputs:
2656
2672
  pars.set_inputs(inputs)
2657
2673
 
2674
+ pars.cdef = self.cdef
2658
2675
  return pars
2659
2676
 
2660
2677
  async def execStormCmd(self, runt, genr):
synapse/lib/version.py CHANGED
@@ -223,6 +223,6 @@ def reqVersion(valu, reqver,
223
223
  ##############################################################################
224
224
  # The following are touched during the release process by bumpversion.
225
225
  # Do not modify these directly.
226
- version = (2, 199, 0)
226
+ version = (2, 200, 0)
227
227
  verstring = '.'.join([str(x) for x in version])
228
- commit = 'c256bd46a9df8621fd05fd6a0f36ca476ad29942'
228
+ commit = 'ab9ca513fe33d52df7a3122c0bf4eab6951b53d3'
@@ -4629,12 +4629,6 @@ class CortexBasicTest(s_t_utils.SynTest):
4629
4629
  self.len(2, await core.nodes('[ inet:dns:a=(vertex.link,1.2.3.4) inet:dns:a=(woot.com,5.6.7.8)]'))
4630
4630
  self.len(4, await core.nodes('inet:dns:a inet:fqdn=:fqdn'))
4631
4631
 
4632
- async def test_cortex_hive(self):
4633
- async with self.getTestCore() as core:
4634
- await core.hive.set(('visi',), 200)
4635
- async with core.getLocalProxy(share='cortex/hive') as hive:
4636
- self.eq(200, await hive.get(('visi',)))
4637
-
4638
4632
  async def test_cortex_delnode_perms(self):
4639
4633
 
4640
4634
  async with self.getTestCore() as core:
@@ -44,6 +44,8 @@ class DataModelTest(s_t_utils.SynTest):
44
44
 
45
45
  async def test_datamodel_basics(self):
46
46
  async with self.getTestCore() as core:
47
+ iface = core.model.ifaces.get('phys:object')
48
+ self.eq('object', iface['template']['phys:object'])
47
49
  core.model.addType('woot:one', 'guid', {}, {
48
50
  'display': {
49
51
  'columns': (
@@ -1203,12 +1203,12 @@ class CellTest(s_t_utils.SynTest):
1203
1203
 
1204
1204
  async def test_cell_hiveapi(self):
1205
1205
 
1206
- async with self.getTestCore() as core:
1206
+ async with self.getTestCell() as cell:
1207
1207
 
1208
- await core.setHiveKey(('foo', 'bar'), 10)
1209
- await core.setHiveKey(('foo', 'baz'), 30)
1208
+ await cell.setHiveKey(('foo', 'bar'), 10)
1209
+ await cell.setHiveKey(('foo', 'baz'), 30)
1210
1210
 
1211
- async with core.getLocalProxy() as proxy:
1211
+ async with cell.getLocalProxy() as proxy:
1212
1212
  self.eq((), await proxy.getHiveKeys(('lulz',)))
1213
1213
  self.eq((('bar', 10), ('baz', 30)), await proxy.getHiveKeys(('foo',)))
1214
1214
 
@@ -1,12 +1,8 @@
1
- import asyncio
2
-
3
1
  import synapse.exc as s_exc
4
2
  import synapse.common as s_common
5
3
 
6
4
  import synapse.tests.utils as s_test
7
5
 
8
- import synapse.lib.hive as s_hive
9
-
10
6
  tree0 = {
11
7
  'kids': {
12
8
  'hehe': {'value': 'haha'},
@@ -73,40 +69,6 @@ class HiveTest(s_test.SynTest):
73
69
 
74
70
  self.none(await hive.get(('foo', 'bar', 'lulz')))
75
71
 
76
- async def test_hive_telepath(self):
77
-
78
- # confirm that the primitives used by higher level APIs
79
- # work using telepath remotes and property synchronize.
80
-
81
- async with self.getTestHiveDmon() as dmon:
82
-
83
- turl = self.getTestUrl(dmon, 'hive')
84
-
85
- async with await s_hive.openurl(turl) as hive0:
86
-
87
- path = ('foo', 'bar')
88
-
89
- evnt = asyncio.Event()
90
-
91
- def onedit(mesg):
92
- evnt.set()
93
-
94
- node0 = await hive0.open(path)
95
- node0.on('hive:set', onedit)
96
-
97
- async with await s_hive.openurl(turl) as hive1:
98
-
99
- node1 = await hive1.open(path)
100
- await node1.set(200)
101
-
102
- await evnt.wait()
103
-
104
- self.eq(200, node0.valu)
105
-
106
- self.eq(201, await node0.add(1))
107
- self.eq(202, await node1.add(1))
108
- self.eq(203, await node0.add(1))
109
-
110
72
  async def test_hive_dir(self):
111
73
 
112
74
  async with self.getTestHive() as hive:
@@ -163,6 +163,10 @@ class StormTest(s_t_utils.SynTest):
163
163
  with self.raises(s_exc.BadTypeValu):
164
164
  await core.nodes('inet:flow:from=({"name": "vertex", "type": "newp"})')
165
165
 
166
+ await core.nodes('[ ou:org=({"name": "origname"}) ]')
167
+ self.len(1, await core.nodes('ou:org=({"name": "origname"}) [ :name=newname ]'))
168
+ self.len(0, await core.nodes('ou:org=({"name": "origname"})'))
169
+
166
170
  async def test_lib_storm_jsonexpr(self):
167
171
  async with self.getTestCore() as core:
168
172
 
@@ -4121,6 +4125,9 @@ class StormTest(s_t_utils.SynTest):
4121
4125
  {'name': 'woot', 'cmdinputs': (
4122
4126
  {'form': 'hehe:haha'},
4123
4127
  {'form': 'hoho:lol', 'help': 'We know whats up'}
4128
+ ), 'endpoints': (
4129
+ {'path': '/v1/test/one', 'desc': 'My multi-line endpoint description which spans multiple lines and has a second line. This is the second line of the description.'},
4130
+ {'path': '/v1/test/two', 'host': 'vertex.link', 'desc': 'Single line endpoint description.'},
4124
4131
  )},
4125
4132
  ),
4126
4133
  }
@@ -4128,6 +4135,9 @@ class StormTest(s_t_utils.SynTest):
4128
4135
  msgs = await core.stormlist('woot --help')
4129
4136
  helptext = '\n'.join([m[1].get('mesg') for m in msgs if m[0] == 'print'])
4130
4137
  self.isin('Inputs:\n\n hehe:haha\n hoho:lol - We know whats up', helptext)
4138
+ self.isin('Endpoints:\n\n /v1/test/one : My multi-line endpoint description which spans multiple lines and has a second line.', helptext)
4139
+ self.isin('This is the second line of the description.', helptext)
4140
+ self.isin('/v1/test/two : Single line endpoint description.', helptext)
4131
4141
 
4132
4142
  async def test_storm_help_cmd(self):
4133
4143
 
@@ -37,8 +37,8 @@ class HiveLoadTest(s_test.SynTest):
37
37
  hivepath0 = os.path.join(dirn, 'hivesave0.mpk')
38
38
  s_msgpack.dumpfile(htree0, hivepath0)
39
39
 
40
- async with self.getTestHiveDmon() as dmon:
41
- hurl = self.getTestUrl(dmon, 'hive')
40
+ async with self.getTestCell() as cell:
41
+ hurl = cell.getLocalUrl()
42
42
 
43
43
  argv = [hurl, hivepath0]
44
44
 
@@ -64,43 +64,39 @@ class HiveLoadTest(s_test.SynTest):
64
64
  s_msgpack.dumpfile(htree1, hivepath1)
65
65
  s_common.yamlsave(htree0, yamlpath0)
66
66
 
67
- async with self.getTestHiveDmon() as dmon:
68
-
69
- hive = dmon.shared.get('hive')
70
- hurl = self.getTestUrl(dmon, 'hive')
67
+ async with self.getTestCell() as cell:
68
+ hurl = cell.getLocalUrl()
71
69
 
72
70
  retn = await s_hiveload.main([hurl, hivepath0])
73
71
  self.eq(0, retn)
74
72
 
75
- self.eq(20, await hive.get(('hehe',)))
76
- self.eq(30, await hive.get(('haha',)))
77
- self.eq('bar', await hive.get(('haha', 'foo')))
78
- self.eq('faz', await hive.get(('haha', 'baz')))
73
+ self.eq(20, await cell.hive.get(('hehe',)))
74
+ self.eq(30, await cell.hive.get(('haha',)))
75
+ self.eq('bar', await cell.hive.get(('haha', 'foo')))
76
+ self.eq('faz', await cell.hive.get(('haha', 'baz')))
79
77
 
80
78
  retn = await s_hiveload.main([hurl, hivepath1])
81
79
  self.eq(0, retn)
82
80
 
83
- self.eq(20, await hive.get(('hehe',)))
84
- self.eq(30, await hive.get(('haha',)))
85
- self.eq('bar', await hive.get(('haha', 'foo')))
86
- self.eq('faz', await hive.get(('haha', 'baz')))
81
+ self.eq(20, await cell.hive.get(('hehe',)))
82
+ self.eq(30, await cell.hive.get(('haha',)))
83
+ self.eq('bar', await cell.hive.get(('haha', 'foo')))
84
+ self.eq('faz', await cell.hive.get(('haha', 'baz')))
87
85
 
88
86
  retn = await s_hiveload.main(['--trim', hurl, hivepath1])
89
87
  self.eq(0, retn)
90
88
 
91
- self.eq(20, await hive.get(('hehe',)))
92
- self.eq(30, await hive.get(('haha',)))
93
- self.eq('faz', await hive.get(('haha', 'baz')))
94
-
95
- self.none(await hive.get(('haha', 'foo')))
89
+ self.eq(20, await cell.hive.get(('hehe',)))
90
+ self.eq(30, await cell.hive.get(('haha',)))
91
+ self.eq('faz', await cell.hive.get(('haha', 'baz')))
96
92
 
97
- async with self.getTestHiveDmon() as dmon:
93
+ self.none(await cell.hive.get(('haha', 'foo')))
98
94
 
99
- hive = dmon.shared.get('hive')
100
- hurl = self.getTestUrl(dmon, 'hive')
95
+ async with self.getTestCell() as cell:
96
+ hurl = cell.getLocalUrl()
101
97
 
102
98
  await s_hiveload.main(['--path', 'v/i/s/i', '--yaml', hurl, yamlpath0])
103
- self.eq('bar', await hive.get(('v', 'i', 's', 'i', 'haha', 'foo')))
99
+ self.eq('bar', await cell.hive.get(('v', 'i', 's', 'i', 'haha', 'foo')))
104
100
 
105
101
  path = os.path.join(dirn, 'cell')
106
102
  async with await s_cell.Cell.anit(path) as cell: