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

View File

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

View File

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

View File

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

View File

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