cleanups, tests adaption

This commit is contained in:
Axel Kittenberger 2018-06-30 20:42:53 +02:00
parent 62517c2922
commit b030d4b898
5 changed files with 28 additions and 46 deletions

View File

@ -15,20 +15,11 @@
-- --
-- --
if not default if not default then error( 'default not loaded' ); end
then
error( 'default not loaded' );
end
if not default.rsync if not default.rsync then error( 'default.rsync not loaded' ); end
then
error( 'default.rsync not loaded' );
end
if default.rsyncssh if default.rsyncssh then error( 'default-rsyncssh already loaded' ); end
then
error( 'default-rsyncssh already loaded' );
end
-- --
-- rsyncssh extends default.rsync -- rsyncssh extends default.rsync
@ -360,7 +351,7 @@ rsyncssh.collect = function
if not agent.isList and agent.etype == 'Init' if not agent.isList and agent.etype == 'Init'
then then
local rc = config.rsyncExitCodes[exitcode] local rc = config.rsyncExitCodes[ exitcode ]
if rc == 'ok' if rc == 'ok'
then then
@ -570,7 +561,7 @@ rsyncssh.exitcodes = false
-- --
-- rsync exit codes -- rsync exit codes
-- --
rsyncssh.rsyncExitCodes = default.rsync.exitCodes rsyncssh.rsyncExitCodes = default.rsync.exitcodes
-- --
-- Exitcodes of ssh and what to do. -- Exitcodes of ssh and what to do.

View File

@ -36,8 +36,6 @@ local assignable =
{ {
dpos = true, dpos = true,
etype = true, etype = true,
path = true,
path2 = true,
status = true, status = true,
} }

View File

@ -183,15 +183,9 @@ local function collect
alarm = now() + alarm alarm = now() + alarm
for _, d in ipairs( delay ) for _, d in ipairs( delay ) do d:wait( alarm ) end
do
d:wait( alarm )
end
else else
for _, d in ipairs( delay ) for _, d in ipairs( delay ) do removeDelay( self, d ) end
do
removeDelay( self, d )
end
end end
log( 'Delay','Finished list = ',exitcode ) log( 'Delay','Finished list = ',exitcode )
@ -368,10 +362,7 @@ local function delay
' event.' ' event.'
) )
if #self.delays > 0 if #self.delays > 0 then stack( self.delays:last( ), nd ) end
then
stack( self.delays:last( ), nd )
end
nd.dpos = self.delays:push( nd ) nd.dpos = self.delays:push( nd )
@ -528,10 +519,7 @@ local function getDelays
do do
local tr = true local tr = true
if test if test then tr = test( InletFactory.d2e( d ) ) end
then
tr = test( InletFactory.d2e( d ) )
end
if tr == 'break' then break end if tr == 'break' then break end
@ -860,10 +848,10 @@ local function new
-- since this way it will raise any issues of mindelay or delay -- since this way it will raise any issues of mindelay or delay
-- not being numbers as well -- not being numbers as well
if not ( config.mindelay >= config.delay ) if not ( config.mindelay <= config.delay )
then then
error( error(
'mindelay (= '..config.mindelay.. ') must be larger '.. 'mindelay (= '..config.mindelay.. ') must be smaller '..
'or equal than delay (= '..config.delay..')', 'or equal than delay (= '..config.delay..')',
level level
) )

View File

@ -16,9 +16,13 @@ churn( srcdir, 100, true )
local logs = { } local logs = { }
local pid = spawn( local pid = spawn(
'./lsyncd', './lsyncd',
'-nodaemon', '-c',
'-delay', '5', 'sync{ '
'-rsync', srcdir, trgdir, .. 'default.rsync, '
.. 'delay = 5, '
.. 'source = "'..srcdir..'", '
.. 'target = "'..trgdir..'" '
.. '}',
table.unpack( logs ) table.unpack( logs )
) )
@ -26,7 +30,7 @@ cwriteln( 'waiting for Lsyncd to startup' )
posix.sleep( 1 ) posix.sleep( 1 )
churn( srcdir, 500, false ) churn( srcdir, 100, false )
cwriteln( 'waiting for Lsyncd to finish its jobs.' ) cwriteln( 'waiting for Lsyncd to finish its jobs.' )

View File

@ -21,20 +21,21 @@ logs = { '-log', 'Delay' }
local pid = spawn( local pid = spawn(
'./lsyncd', './lsyncd',
'-nodaemon', '-c',
'-delay', 'sync{ '
'5', .. 'default.rsyncssh, '
'-rsyncssh', .. 'delay = 5, '
srcdir, .. 'source = "'..srcdir..'", '
'localhost', .. 'host = "localhost", '
trgdir, .. 'targetdir = "'..trgdir..'" '
.. '}',
table.unpack(logs) table.unpack(logs)
) )
cwriteln( 'waiting for Lsyncd to startup' ) cwriteln( 'waiting for Lsyncd to startup' )
posix.sleep( 1 ) posix.sleep( 1 )
churn( srcdir, 150, false ) churn( srcdir, 100, false )
cwriteln( 'waiting for Lsyncd to finish its jobs.' ) cwriteln( 'waiting for Lsyncd to finish its jobs.' )
posix.sleep( 10 ) posix.sleep( 10 )