Browse Source

[Test] Add nginx setup test

tags/1.7.6
Vsevolod Stakhov 6 years ago
parent
commit
d133232f34
3 changed files with 40 additions and 1 deletions
  1. 21
    0
      test/functional/configs/nginx.conf
  2. 17
    1
      test/functional/lib/rspamd.robot
  3. 2
    0
      test/functional/lib/vars.py

+ 21
- 0
test/functional/configs/nginx.conf View File

@@ -0,0 +1,21 @@
events {
}
worker_processes 1;
pid ${TMPDIR}/nginx.pid;
error_log ${TMPDIR}/error.log;
http {
include mime.types;
default_type application/octet-stream;
sendfile on;

server {
# no need for root privileges
listen ${NGINX_ADDR}:${NGINX_PORT};
server_name localhost

location / {
root ${TMPDIR}
autoindex on;
}
}
}

+ 17
- 1
test/functional/lib/rspamd.robot View File

@@ -108,6 +108,22 @@ Run Redis
${redis_log} = Get File ${TMPDIR}/redis.log
Log ${redis_log}

Run Nginx
${template} = Get File ${TESTDIR}/configs/nginx.conf
${config} = Replace Variables ${template}
Create File ${TMPDIR}/nginx.conf ${config}
Log ${config}
${result} = Run Process nginx -c ${TMPDIR}/nginx.conf
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}/nginx.pid
Wait Until Keyword Succeeds 30 sec 1 sec TCP Connect ${NGINX_ADDR} ${NGINX_PORT}
${NGINX_PID} = Get File ${TMPDIR}/nginx.pid
Run Keyword If '${NGINX_SCOPE}' == 'Test' Set Test Variable ${NGINX_PID}
... ELSE IF '${NGINX_SCOPE}' == 'Suite' Set Suite Variable ${NGINX_PID}
${nginx_log} = Get File ${TMPDIR}/nginx.log
Log ${nginx_log}

Run Rspamc
[Arguments] @{args}
${result} = Run Process ${RSPAMC} -t 60 @{args} env:LD_LIBRARY_PATH=${TESTDIR}/../../contrib/aho-corasick
@@ -158,5 +174,5 @@ Sync Fuzzy Storage
... ELSE Run Process ${RSPAMADM} control -s @{vargs}[0]/rspamd.sock fuzzy_sync
Log ${result.stdout}
Run Keyword If $len == 0 Follow Rspamd Log
... ELSE Custom Follow Rspamd Log @{vargs}[0]/rspamd.log @{vargs}[1] @{vargs}[2] @{vargs}[3]
... ELSE Custom Follow Rspamd Log @{vargs}[0]/rspamd.log @{vargs}[1] @{vargs}[2] @{vargs}[3]
Sleep 0.1s Try give fuzzy storage time to sync

+ 2
- 0
test/functional/lib/vars.py View File

@@ -17,6 +17,8 @@ PORT_FPROT = 56797
PORT_FPROT_DUPLICATE = 56798
REDIS_ADDR = u'127.0.0.1'
REDIS_PORT = 56379
NGINX_ADDR = u'127.0.0.1'
NGINX_PORT = 56380
RSPAMD_GROUP = 'nogroup'
RSPAMD_USER = 'nobody'
SOCK_DGRAM = socket.SOCK_DGRAM

Loading…
Cancel
Save