Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sl 396 #462

Closed
wants to merge 121 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
d33c2fb
fix #396
Mar 31, 2016
7fe35aa
Merge branch 'master' of github.com:natsys/tempesta into sl_396
Mar 31, 2016
2c8584e
fix #396 test_frang
Apr 6, 2016
7c6e022
fix #375 hdr_timeout
Apr 8, 2016
6645f01
fix #375 conn_rate
Apr 12, 2016
d90005d
fix #375 conn_rate + uri
Apr 12, 2016
e646774
fix #375 rework
Apr 12, 2016
8a41916
fix #375 rework
Apr 12, 2016
3b43511
fix #375 copyright
Apr 12, 2016
a772e3b
fix #375 + req_rate
Apr 12, 2016
906ec68
Merge branch 'master' of github.com:natsys/tempesta into sl_396
Apr 13, 2016
1b539a9
fix #375 more tests
Apr 13, 2016
8d5cfa8
fix #375 methods
Apr 13, 2016
c9dfa26
fix #375 ct_required
Apr 13, 2016
996d56f
fix #375 + tests
Apr 13, 2016
94a2a9e
fix #375 + body_len
Apr 14, 2016
3ac0c80
fix #375 field_len
Apr 14, 2016
4c58b5c
fix #375 body_timeout
Apr 14, 2016
4d6dbdb
fix #375 + req_burst
Apr 19, 2016
bf570bc
Merge branch 'master' of github.com:natsys/tempesta into sl_396
Apr 19, 2016
a2071ae
fix #375 conn_burst
Apr 20, 2016
5e8db4b
Merge branch 'master' of github.com:natsys/tempesta into sl_396
Apr 20, 2016
2c004ea
Merge branch 'master' of github.com:natsys/tempesta into sl_396
Apr 20, 2016
2aa991c
fix #375 header_chunks
Apr 20, 2016
bb64fb3
fix #375 body_chunks
Apr 20, 2016
fdfb764
fix #375 -all tests
Apr 22, 2016
68a1965
fix #375 style
Apr 22, 2016
56ddb9b
Merge branch 'master' of github.com:natsys/tempesta into sl_396
Apr 25, 2016
00fe90d
fix #396
Mar 31, 2016
9fd32aa
fix #396 test_frang
Apr 6, 2016
23d08aa
fix #375 hdr_timeout
Apr 8, 2016
6299a3d
fix #375 conn_rate
Apr 12, 2016
b12c23f
fix #375 conn_rate + uri
Apr 12, 2016
d45c428
fix #375 rework
Apr 12, 2016
39b0c66
fix #375 rework
Apr 12, 2016
9e06957
fix #375 copyright
Apr 12, 2016
3b07727
fix #375 + req_rate
Apr 12, 2016
06a1613
fix #375 more tests
Apr 13, 2016
40aa77a
fix #375 methods
Apr 13, 2016
a1b2936
fix #375 ct_required
Apr 13, 2016
47b9675
fix #375 + tests
Apr 13, 2016
4edcdbf
fix #375 + body_len
Apr 14, 2016
0c64bac
fix #375 field_len
Apr 14, 2016
698efc2
fix #375 body_timeout
Apr 14, 2016
c4076d8
fix #375 + req_burst
Apr 19, 2016
66f18d2
fix #375 conn_burst
Apr 20, 2016
6e573eb
fix #375 header_chunks
Apr 20, 2016
88ce8f8
fix #375 body_chunks
Apr 20, 2016
a512a8e
fix #375 -all tests
Apr 22, 2016
3b4f800
fix #375 style
Apr 22, 2016
98537ed
Merge branch 'sl_396' of github.com:tempesta-tech/tempesta into sl_396
Jul 14, 2016
5027ecd
fix #490
Jul 14, 2016
1b9e6ef
fix #490 start
Jul 14, 2016
b7668ce
fix #490 class
Jul 15, 2016
664954f
fix #396 edit
Jul 15, 2016
17c9794
fix #490
Jul 18, 2016
de34ee0
fix #490
Jul 18, 2016
90920bb
fix #490
Jul 18, 2016
acbf73f
copyright
Sep 5, 2016
230ce68
Merge branch 'master' into sl_396
Sep 5, 2016
80fa900
Merge branch 'master' into sl_396
Sep 5, 2016
14a8c21
Merge branch 'sl_396' of github.com:tempesta-tech/tempesta into sl_396
Sep 5, 2016
12e494a
test result
Sep 5, 2016
b9c5bc9
result and var
Sep 5, 2016
e1868db
unused
Sep 5, 2016
74a7d8c
unused
Sep 5, 2016
3caa71c
indentation
Sep 5, 2016
db24112
dots
Sep 5, 2016
58ccbf9
apache conf
Sep 7, 2016
1625561
indent
Sep 7, 2016
b7ea137
class
Sep 19, 2016
a07b3bb
fragmentize
Sep 19, 2016
c33e988
Merge branch 'master' into sl_396
Sep 20, 2016
1a04818
class
Sep 20, 2016
1277a5f
Merge branch 'master' into sl_396
Sep 20, 2016
1a234a8
lines
Sep 20, 2016
ddbb0d2
Merge branch 'master' into sl_396
Sep 21, 2016
94607c0
was crash on stop
Sep 22, 2016
8b6e5b1
copyright
Sep 22, 2016
4883f0b
line more 80 ch
Sep 22, 2016
1f67a6c
copyright
Sep 22, 2016
0263056
line
Sep 22, 2016
709c0b0
copyright
Sep 22, 2016
1cb29e9
copyright move
Sep 22, 2016
98035a4
lines
Sep 22, 2016
33ccbc6
line
Sep 22, 2016
abe1083
lines
Sep 23, 2016
a3a0154
python lines
Sep 23, 2016
297fee4
unused
Sep 23, 2016
a756e6c
line
Sep 23, 2016
15a1d1d
fix #619 start
Oct 10, 2016
a1886cd
content
Oct 13, 2016
e2eb66c
Merge branch 'master' into sl_396
Oct 14, 2016
aef0eb5
#319 - ok
Oct 17, 2016
5f6732d
html parser
Oct 18, 2016
2009674
handle request
Oct 20, 2016
f5fcbcf
ret 5
Oct 25, 2016
470786e
resp
Oct 31, 2016
1244600
resp -Ok
Nov 1, 2016
126ba2c
unlim
Nov 2, 2016
c258f6c
resp
Nov 3, 2016
50bc2f0
div tests
Nov 7, 2016
7a9c666
err log
Nov 7, 2016
3866246
date
Nov 8, 2016
856211d
tfwparser
Nov 8, 2016
53fc8ed
start stop with pid file
Nov 11, 2016
4a6f36d
dbg print
Nov 11, 2016
b9abd98
style
Nov 11, 2016
13dae08
comments
Nov 11, 2016
3d0d102
Merge branch 'master' into sl_396
Nov 14, 2016
6671f84
compare cached resp
Nov 14, 2016
28a8e2c
Merge branch 'master' into sl_396
Nov 14, 2016
53983dc
timeout
Nov 14, 2016
69ae1c1
be name
Nov 14, 2016
d72a7ed
test result print
Nov 15, 2016
bf7188c
status call
Nov 16, 2016
8ce422a
redundant import
Nov 16, 2016
aa69524
line
Nov 16, 2016
cd14687
not used code
Nov 16, 2016
9a30acf
messages
Nov 16, 2016
5eefe32
Server in all tests
Nov 16, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 0 additions & 96 deletions tempesta_fw/t/functional/fragmented_requests.py

This file was deleted.

1 change: 0 additions & 1 deletion tempesta_fw/t/functional/helpers/__init__.py

This file was deleted.

122 changes: 0 additions & 122 deletions tempesta_fw/t/functional/helpers/be.py

This file was deleted.

42 changes: 0 additions & 42 deletions tempesta_fw/t/functional/helpers/tfw.py

This file was deleted.

5 changes: 2 additions & 3 deletions tempesta_fw/t/functional/run_all_tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# 2014. Written by NatSys Lab. ([email protected]).
# 2014-2016. Tempesta Technologies Inc. ([email protected]).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use full licensing headers like in tempesta/tempesta_fw/t/unit/run_all_tests.sh . Also we don't use NatSys Lab. mail as Tempesta Technologeis contact. The same issue with all other Python files.


function run() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename the script to something like run_tests.sh and add option specifying which test modules must be run (e.g. bomber is not working now, so we want to exclude it from running test modules). Next the script must have help message describing the option and possibly added new options in future.

echo run: $1
Expand All @@ -18,5 +18,4 @@ echo ------------------------------------------------------------------
echo Running functional tests...
echo ------------------------------------------------------------------

# Doesn't pass yet.
# run fragmented_requests.py
run tests.py
22 changes: 22 additions & 0 deletions tempesta_fw/t/functional/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python

__author__ = 'Tempesta Technologies Inc.'
__copyright__ = 'Copyright (C) 2016 Tempesta Technologies Inc. ([email protected]).'
__license__ = 'GPL2'

import pkgutil
import tests
import subprocess
import sys
from os.path import dirname, realpath, sep

sys.path.append((dirname(realpath(__file__))+ sep + "tests" + sep + "helpers"))

for loader, name, ispkg in pkgutil.iter_modules(path = tests.__path__,
prefix = ''):
if not ispkg:
print(name)
test = loader.find_module(name).load_module(name)
tclass = getattr(test, 'Test')
print("test:", tclass().get_name())
tclass().run()
6 changes: 6 additions & 0 deletions tempesta_fw/t/functional/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__author__ = 'Tempesta Technologies Inc.'
__copyright__ = 'Copyright (C) 2016 Tempesta Technologies Inc. ([email protected]).'
__license__ = 'GPL2'

__all__ = [ "bomber", "fragmented_requests", "test_frang", "test_cache",
"test_parser" ]
25 changes: 25 additions & 0 deletions tempesta_fw/t/functional/tests/bomber.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python
__author__ = 'Tempesta Technologies Inc.'
__copyright__ = 'Copyright (C) 20115-2016 Tempesta Technologies Inc. ([email protected]).'
__license__ = 'GPL2'

import conf
import tfw

c = conf.Config("etc/tempesta_fw.conf")

class Test:
def get_name(self):
return 'bomber'

def run(self):
c.add_option('cache', '0')
c.add_option('listen', '8081')
c.add_option('server', '127.0.0.1:80')
tfw.start()
print("tfw started\n")
tfw.start_bomber()
print("bomber started\n")
tfw.stop()
print("tfw stoped\n")

39 changes: 39 additions & 0 deletions tempesta_fw/t/functional/tests/fragmented_requests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python

__author__ = 'Temesta Technologies Inc.'
__copyright__ = 'Copyright (C) 2016 Tempesta Technologies Inc. ([email protected]).'
__license__ = 'GPL2'

import conf
import tfw
import socket
class Test:
def fragmentize_str(self, s, frag_size):
"""
Split a string into a list of equal N-sized fragmen.
>>> fragmentize_str("foo12bar34baz", 3)
['foo', '12b', 'ar3', '4ba', 'z']
"""
return [s[i:i+frag_size] for i in range(0, len(s), frag_size)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good use more complex splitting strategy as used in split_and_parse_n() from tempesta_fw/t/unit/test_http_parser.c : do cycle for splitting the message to chunks with size from 1 byte to length of the message.


def run(self):
c = conf.Config('etc/tempesta_fw.conf')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you pass path to configuration file to conf.Config()? It seems it's the same for all modules and should be internal for config module. (I see at the below that you use the same class and method for Tempesta ans Apache configs, but as I mention at the below it's better to use inherited classes for the purpose.)

c.add_option('cache', '0')
c.add_option('listen', '8081')
c.add_option('server', '127.0.0.1:80')
vs_get = b"GET / HTTP/1.0\r\nhost: localhost\r\n\r\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request is too short. It's better to use much more complex request as in original fragmented_requests.py.

tfw.start()
print("tfw start\n")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1",8081))
for fs in self.fragmentize_str(vs_get, 3):
s.sendall(fs)
data = s.recv(1024)
tfw.stop()
s.close()
if len(data) > 0:
print("Res:{}\n".format(True))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The verification is absolutely inadequate. I believe there should be separate function which verifies response. It must at least check response status code and body length and/or md5 hash. Basically, you do this for example in run_test() from test_parser.py.


def get_name(self):
return 'fragmented request'

5 changes: 5 additions & 0 deletions tempesta_fw/t/functional/tests/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__author__ = 'Tempesta Technologies Inc.'
__copyright__ = 'Copyright (C) 2016 Tempesta Technologies. ([email protected]).'
__license__ = 'GPL2'

__all__ = [ 'be', 'cli', 'tfw','conf', 'apache', 'tfwparser' ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it is? It seems this is the list of all available testing modules and if one wants to add a new test, he must adjust the list. Please write t/functional/README or comment somewhere in source files describing what one should do if he wants to add a new test.

10 changes: 10 additions & 0 deletions tempesta_fw/t/functional/tests/helpers/apache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

__author__ = 'Tempesta Technologies Inc.'
__copyright__ = 'Copyright (C) 2016 Tempesta Technologies. ([email protected]).'
__license__ = 'GPL2'

import subprocess

def start():
subprocess.call("service apache2 start", shell = True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I have no installed Apache HTTPD? The script must check whether it is installed and report human friendly error suggesting to install Appache HTTPD.

Moreover, we support CentOS as well as Debian and while I have Apache HTTPD installed in my CentOS, the command doesn't work:

     # service apache2 start
     Redirecting to /bin/systemctl start  apache2.service
     Failed to issue method call: Unit apache2.service failed to load: No such file or directory.

So please test the script suite on Debian as well as on CentOS.

Loading