-
Notifications
You must be signed in to change notification settings - Fork 105
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
Sl 396 #462
Changes from all commits
d33c2fb
7fe35aa
2c8584e
7c6e022
6645f01
d90005d
e646774
8a41916
3b43511
a772e3b
906ec68
1b539a9
8d5cfa8
c9dfa26
996d56f
94a2a9e
3ac0c80
4c58b5c
4d6dbdb
bf570bc
a2071ae
5e8db4b
2c004ea
2aa991c
bb64fb3
fdfb764
68a1965
56ddb9b
00fe90d
9fd32aa
23d08aa
6299a3d
b12c23f
d45c428
39b0c66
9e06957
3b07727
06a1613
40aa77a
a1b2936
47b9675
4edcdbf
0c64bac
698efc2
c4076d8
66f18d2
6e573eb
88ce8f8
a512a8e
3b4f800
98537ed
5027ecd
1b9e6ef
b7668ce
664954f
17c9794
de34ee0
90920bb
acbf73f
230ce68
80fa900
14a8c21
12e494a
b9c5bc9
e1868db
74a7d8c
3caa71c
db24112
58ccbf9
1625561
b7ea137
a07b3bb
c33e988
1a04818
1277a5f
1a234a8
ddbb0d2
94607c0
8b6e5b1
4883f0b
1f67a6c
0263056
709c0b0
1cb29e9
98035a4
33ccbc6
abe1083
a3a0154
297fee4
a756e6c
15a1d1d
a1886cd
e2eb66c
aef0eb5
5f6732d
2009674
f5fcbcf
470786e
1244600
126ba2c
c258f6c
50bc2f0
7a9c666
3866246
856211d
53fc8ed
4a6f36d
b9abd98
13dae08
3d0d102
6671f84
28a8e2c
53983dc
69ae1c1
d72a7ed
bf7188c
8ce422a
aa69524
cd14687
9a30acf
5eefe32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
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]). | ||
|
||
function run() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename the script to something like |
||
echo run: $1 | ||
|
@@ -18,5 +18,4 @@ echo ------------------------------------------------------------------ | |
echo Running functional tests... | ||
echo ------------------------------------------------------------------ | ||
|
||
# Doesn't pass yet. | ||
# run fragmented_requests.py | ||
run 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() |
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" ] |
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") | ||
|
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)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's good use more complex splitting strategy as used in |
||
|
||
def run(self): | ||
c = conf.Config('etc/tempesta_fw.conf') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you pass path to configuration file to |
||
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
def get_name(self): | ||
return 'fragmented request' | ||
|
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' ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
So please test the script suite on Debian as well as on CentOS. |
There was a problem hiding this comment.
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.