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

Sl 396 #462

wants to merge 121 commits into from

Conversation

sergsever
Copy link
Contributor

Fix #396 and #375.

Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

I also had a look at sl-490: there are many changes similar to the PR. So please incorporate sl-490 changes to the PR.

@@ -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.

@@ -1,6 +1,6 @@
#!/bin/bash
#
# 2014. Written by NatSys Lab. ([email protected]).
# 2014-2016. Tempesta Technologies Inc. ([email protected]).

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.

import os
import fileinput
class Config:
name = '/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.

It seems this is the reason for execution problem

    [root@localhost functional]# ./run_all_tests.sh 

    ------------------------------------------------------------------
    Running functional tests...
    ------------------------------------------------------------------
    run: tests.py
    bomber
    Traceback (most recent call last):
      File "./tests.py", line 19, in <module>
        test = loader.find_module(name).load_module(name)
      File "/usr/lib64/python2.7/pkgutil.py", line 246, in load_module
        mod = imp.load_module(fullname, self.file, self.filename, self.etc)
      File "/root/tempesta/tempesta_fw/t/functional/tests/bomber.py", line 9, in <module>
        c = conf.Config("etc/tempesta_fw.conf")
      File "/root/tempesta/tempesta_fw/t/functional/tests/helpers/conf.py", line 17, in __init__
        open(self.name, "w")
    IOError: [Errno 2] No such file or directory: 'etc/tempesta_fw.conf'
    FAILED: tests.py

it seems there is no etc directory and the script can't create the file. If I create directory like

     [root@localhost functional]# mkdir tests/etc

, then the problem is gone.

_functest_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
_tempesta_dir = os.path.realpath('.')
def start():
_sh(_tempesta_dir + '/scripts/tempesta.sh --start')
Copy link
Contributor

Choose a reason for hiding this comment

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

Something is wrong with the relative path retrieval. If I run the script from tempesta/tempesta_fw/t/functional, then the script can't find tempesta.sh script:

    [root@localhost functional]# pwd
    /root/tempesta/tempesta_fw/t/functional

    [root@localhost functional]# ./run_all_tests.sh 

    ------------------------------------------------------------------
    Running functional tests...
    ------------------------------------------------------------------
    run: tests.py
    bomber
    ('test:', 'bomber')
    /bin/sh: /root/tempesta/tempesta_fw/t/functional/scripts/tempesta.sh: No such file or directory
    Traceback (most recent call last):
      File "./tests.py", line 22, in <module>
        tclass().run()
      File "/root/tempesta/tempesta_fw/t/functional/tests/bomber.py", line 19, in run
        tfw.start()
      File "/root/tempesta/tempesta_fw/t/functional/tests/helpers/tfw.py", line 21, in start
        _sh(_tempesta_dir + '/scripts/tempesta.sh --start')
      File "/root/tempesta/tempesta_fw/t/functional/tests/helpers/tfw.py", line 30, in _sh
        return subprocess.check_output(command, shell=True, cwd=_tempesta_dir)
      File "/usr/lib64/python2.7/subprocess.py", line 575, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '/root/tempesta/tempesta_fw/t/functional/scripts/tempesta.sh --start' returned non-zero exit status 127
    FAILED: tests.py

# #10 -Oops on shutdown
# At this point it is not solved and Tempesta FW simply can't be stopped.
# TODO: un-comment it after the issue is fixed.
#teardown.register(_stop_if_started)
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 the same identation for comments as for code. In this case one tab must be used for the comment identation. The same for line 38.

self.s = socket(AF_INET, SOCK_STREAM)
self.s.connect(('127.0.0.1', 8081))
self.s.send(part1)
time.sleep(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

The same as above

i += 1
if len(data) > 0:
parser = tfwparser.TFWParser()
if len(parser.get_body(data)) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

Body is not necessary THML, so it's unclear why do you measure data length between <html> and </html> tags. Seems like some misconception... I believe you can just check full body length, w/o HTML parsing.


tfw.stop()
be.stop(be_pid)
print(self.res)
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, no empty line between different methods

self.run_test(1)
def run_test(self, num):

vs_get = b"GET / HTTP/1.0\nHost: loc\n" +\
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 use HTTP/1.0?

self.run_test(2)

# A response without the Content-Length header an without a body.
# For now (11.11.2016) tempesta's return status - 404.
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, this is test for #619. But the comment is very strange and it seems the subject for investigation. It seems you have some misconfiguration - Tempesta must just return response without body in this test. Please learn the reason for 404 response and fix the tests.

@krizhanovsky krizhanovsky mentioned this pull request Dec 28, 2016
@vankoven vankoven deleted the sl_396 branch March 22, 2017 10:09
@vankoven vankoven restored the sl_396 branch March 22, 2017 10:40
@krizhanovsky krizhanovsky deleted the sl_396 branch March 22, 2017 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants