*** Variables ***
${CONFIG} ${TESTDIR}/configs/password.conf
+${CONTROLLER_ERRORS} False
${RSPAMD_SCOPE} Test
${PBKDF_PASSWORD} "$1$rhzzahtm8a5homdhh7z4qiiy7j8pzp4u$k5toro136brshjjuy9t39r785td69qodmd39qzygxuyehn9tqauy"
${CATENA_PASSWORD} "$2$xu1581gidj5cyp4yjgo68qbj6jz1j8o3$j9yg4k58jy3fj8suijxx9d7pea6a6obtufq9kfenosyq8erm87ky"
Check Rspamc ${result} BAYES_HAM
Redis Statistics Setup
- Generic Setup
+ ${tmpdir} = Make Temporary Directory
+ Set Suite Variable ${TMPDIR} ${tmpdir}
Run Redis
+ Generic Setup TMPDIR=${tmpdir}
Redis Statistics Teardown
Normal Teardown
Resource lib.robot
*** Variables ***
+${CONTROLLER_ERRORS} False
${STATS_BACKEND} sqlite3
${STATS_PATH_CACHE} path = "/does/not/exist/bayes-cache.sqlite";
${STATS_PATH_HAM} path = "/does/not/exist/bayes-ham.sqlite";
Fuzzy Setup Generic ${algorithm} ${EMPTY} ${check_settings}
Fuzzy Setup Generic
- [Arguments] ${algorithm} ${worker_settings} ${check_settings}
+ [Arguments] ${algorithm} ${worker_settings} ${check_settings} &{kwargs}
+ ${has_TMPDIR} = Evaluate 'TMPDIR' in $kwargs
Set Suite Variable ${SETTINGS_FUZZY_WORKER} ${worker_settings}
Set Suite Variable ${SETTINGS_FUZZY_CHECK} ${check_settings}
Set Suite Variable ${ALGORITHM} ${algorithm}
- Generic Setup
+ Run Keyword If '${has_TMPDIR}' == 'True' Generic Setup TMPDIR=&{kwargs}[TMPDIR]
+ ... ELSE Generic Setup
Fuzzy Setup Plain Fasthash
Fuzzy Setup Plain fasthash
*** Keywords ***
Fuzzy Redis General Setup
- Fuzzy Setup Generic siphash backend = "redis"; ${EMPTY}
+ ${tmpdir} = Make Temporary Directory
+ Set Suite Variable ${TMPDIR} ${tmpdir}
Run Redis
+ Fuzzy Setup Generic siphash backend \= "redis"; ${EMPTY} TMPDIR=${TMPDIR}
Fuzzy Redis General Teardown
Normal Teardown
task_timeout = 60s;
}
+worker {
+ type = controller
+ bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER}
+ count = 1
+ secure_ip = ["127.0.0.1", "::1"];
+ stats_path = "${TMPDIR}/stats.ucl"
+}
+
dkim {
sign_condition =<<EOD
count = 1
task_timeout = 60s;
}
+worker {
+ type = controller
+ bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER}
+ count = 1
+ secure_ip = ["127.0.0.1", "::1"];
+ stats_path = "${TMPDIR}/stats.ucl"
+}
modules {
path = "${TESTDIR}/../../src/plugins/lua/"
}
count = 1
task_timeout = 60s;
}
+worker {
+ type = controller
+ bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER}
+ count = 1
+ secure_ip = ["127.0.0.1", "::1"];
+ stats_path = "${TMPDIR}/stats.ucl"
+}
modules {
path = "${TESTDIR}/../../src/plugins/lua/"
}
}
task_timeout = 60s;
}
+
+worker {
+ type = controller
+ bind_socket = ${LOCAL_ADDR}:${PORT_CONTROLLER}
+ count = 1
+ secure_ip = ["127.0.0.1", "::1"];
+ stats_path = "${TMPDIR}/stats.ucl"
+}
import os.path
import psutil
import pwd
+import re
import shutil
import signal
import socket
except:
import httplib
+ignore_message = [
+ re.compile("^cannot load controller stats from .*/stats\\.ucl: No such file or directory$"),
+ re.compile("^regexp module enabled, but no rules are defined$"),
+ re.compile("^cannot find dependency on symbol FREEMAIL_FROM$"),
+ re.compile("^cannot find dependency on symbol FREEMAIL_REPLYTO$"),
+ re.compile("^cannot register delayed condition for DMARC_POLICY_ALLOW$"),
+ re.compile("^failed to scan: Socket error detected: Connection refused$"),
+]
+
+def Check_Errors_JSON(j):
+ d = demjson.decode(j, strict=True)
+ assert type(d) is list, j
+ e = []
+ for c in d:
+ filtered = False
+ for r in ignore_message:
+ if r.match(c['message']):
+ filtered = True
+ break
+ if not filtered:
+ e.append(c)
+ assert len(e) == 0, str(e)
+
def Check_JSON(j):
d = demjson.decode(j, strict=True)
assert len(d) > 0
r = s.recv(2048)
return r.decode('utf-8')
+def TCP_Connect(addr, port):
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((addr, port))
+
def update_dictionary(a, b):
a.update(b)
return a
Library Process
*** Keywords ***
+Check Controller Errors
+ @{result} = HTTP GET ${LOCAL_ADDR} ${PORT_CONTROLLER} /errors
+ Check Errors JSON @{result}[1]
+ Should Be Equal As Integers @{result}[0] 200
+
Check Pidfile
[Arguments] ${pidfile}
Wait Until Created ${pidfile}
Generic Teardown
[Arguments] @{ports}
+ Run Keyword If '${CONTROLLER_ERRORS}' == 'True' Check Controller Errors
Shutdown Process With Children ${RSPAMD_PID}
Cleanup Temporary Directory ${TMPDIR}
: FOR ${i} IN @{ports}
Run Keyword If ${result.rc} != 0 Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Wait Until Keyword Succeeds 30 sec 1 sec Check Pidfile ${TMPDIR}/redis.pid
+ Wait Until Keyword Succeeds 30 sec 1 sec TCP Connect ${REDIS_ADDR} ${REDIS_PORT}
${REDIS_PID} = Get File ${TMPDIR}/redis.pid
Run Keyword If '${REDIS_SCOPE}' == 'Test' Set Test Variable ${REDIS_PID}
... ELSE IF '${REDIS_SCOPE}' == 'Suite' Set Suite Variable ${REDIS_PID}
import socket
+CONTROLLER_ERRORS = True
KEY_PVT1 = 'ekd3x36tfa5gd76t6pa8hqif3ott7n1siuux68exbkk7ukscte9y'
KEY_PUB1 = 'm8kneubpcjsb8sbsoj7jy7azj9fdd3xmj63txni86a8ye9ncomny'
LOCAL_ADDR = u'127.0.0.1'