cluster-story Pub

Cluster testing

NOTE that in cloud some of these fail because of built-in delays. So diesel.isLocalhost

TODO <=> so remote answers with ask pattern

0 $mock:: test.diesel.cluster.sendspawnremote
   testdiesel.cluster.spawn.other
   . (payload=dieselRef)

send::  msg test.diesel.cluster.sendspawnremote 

val x:Array=([1 .. 10] map x=>test.diesel.cluster.sendspawnremote(x)())

This will kick just once based on time

send::  msg diesel.cron.cancel  (name="clusterSingleton1")

send::  msg diesel.cron.set  (name="clusterSingleton1", time, schedule="1s", singleton="yes", cronMsg="$msg ctx.log()", count:Number=1)

Wait for it to kick before continuing - it will also dissapear:

send::  msg ctx.sleep  (duration:Number=2500)

send::  msg diesel.cron.list 

expect::  ( (sizeOf(payload) is 0))$ifc:: diesel[="isLocalhost"]

TODO check on other nodes too

create and cancel

send::  msg diesel.cron.cancel  (name="clustercron1")

This will start in 1 sec and tick every 1 sec for at most 2 occurences (counts)

send::  msg diesel.cron.set  (name="clustercron1", schedule="1s", time, singleton="yes", collect:Number=5, cronMsg="$msg ctx.log()", count:Number=2)

send::  msg diesel.cron.list 

expect::  ( (sizeOf(payload) is 1))$ifc:: diesel[="isLocalhost"]
expect::  ( ((payload as string) contains "clustercron1"))

send::  msg diesel.cron.cancel  (name="clustercron1")

send::  msg diesel.cron.list 

expect::  ( (sizeOf(payload) is 0))$ifc:: diesel[="isLocalhost"]
expect:: NOT ( ((payload as string) contains "clustercron1"))

Distributed - remote put and done

send::  msg diesel.stream.new  (stream="stest95", timeoutMillis:Number=100000)

val stest95=dieselStream val stest95ref=dieselStreamRef

send::  msg testdiesel.please.streamremoteputdone  (streamRef)

send::  msg diesel.stream.consume  (stream="stest95")


Was this useful?    

By: Razie | 2023-02-14 .. 2023-06-05 | Tags: story , dsl


Viewed 204 times ( | History | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2024, all rights reserved.