Przeglądaj źródła

[Test] Check controller's error buffer

tags/1.6.0
Andrew Lewis 7 lat temu
rodzic
commit
c07a20097f

+ 1
- 0
test/functional/cases/103_password.robot Wyświetl plik

@@ -6,6 +6,7 @@ Variables ${TESTDIR}/lib/vars.py

*** Variables ***
${CONFIG} ${TESTDIR}/configs/password.conf
${CONTROLLER_ERRORS} False
${RSPAMD_SCOPE} Test
${PBKDF_PASSWORD} "$1$rhzzahtm8a5homdhh7z4qiiy7j8pzp4u$k5toro136brshjjuy9t39r785td69qodmd39qzygxuyehn9tqauy"
${CATENA_PASSWORD} "$2$xu1581gidj5cyp4yjgo68qbj6jz1j8o3$j9yg4k58jy3fj8suijxx9d7pea6a6obtufq9kfenosyq8erm87ky"

+ 3
- 1
test/functional/cases/110_statistics/lib.robot Wyświetl plik

@@ -43,8 +43,10 @@ Relearn Test
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

+ 1
- 0
test/functional/cases/110_statistics/sqlite-broken-stats-dir.robot Wyświetl plik

@@ -5,6 +5,7 @@ Resource ${TESTDIR}/lib/rspamd.robot
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";

+ 4
- 2
test/functional/cases/120_fuzzy/lib.robot Wyświetl plik

@@ -91,11 +91,13 @@ Fuzzy Setup Keyed
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

+ 3
- 1
test/functional/cases/120_fuzzy/redis-general.robot Wyświetl plik

@@ -21,8 +21,10 @@ Fuzzy Overwrite

*** 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

+ 8
- 0
test/functional/configs/dkim.conf Wyświetl plik

@@ -30,6 +30,14 @@ worker {
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

+ 7
- 0
test/functional/configs/plugins.conf Wyświetl plik

@@ -27,6 +27,13 @@ worker {
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/"
}

+ 7
- 0
test/functional/configs/pluginsplus.conf Wyświetl plik

@@ -27,6 +27,13 @@ worker {
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/"
}

+ 8
- 0
test/functional/configs/trivial.conf Wyświetl plik

@@ -30,3 +30,11 @@ worker {
}
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"
}

+ 28
- 0
test/functional/lib/rspamd.py Wyświetl plik

@@ -5,6 +5,7 @@ import os
import os.path
import psutil
import pwd
import re
import shutil
import signal
import socket
@@ -24,6 +25,29 @@ try:
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
@@ -139,6 +163,10 @@ def spamc(addr, port, filename):
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

+ 7
- 0
test/functional/lib/rspamd.robot Wyświetl plik

@@ -4,6 +4,11 @@ Library OperatingSystem
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}
@@ -63,6 +68,7 @@ Generic Setup

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}
@@ -97,6 +103,7 @@ Run Redis
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}

+ 1
- 0
test/functional/lib/vars.py Wyświetl plik

@@ -1,5 +1,6 @@
import socket

CONTROLLER_ERRORS = True
KEY_PVT1 = 'ekd3x36tfa5gd76t6pa8hqif3ott7n1siuux68exbkk7ukscte9y'
KEY_PUB1 = 'm8kneubpcjsb8sbsoj7jy7azj9fdd3xmj63txni86a8ye9ncomny'
LOCAL_ADDR = u'127.0.0.1'

Ładowanie…
Anuluj
Zapisz