tork-a / roswww

Tiny web server for ROS (forked from https://github.com/jihoonl/roswww)
Other
36 stars 25 forks source link

Enable client testing && fix redirect bug #42

Closed furushchev closed 6 years ago

furushchev commented 6 years ago

Currently, the test may fail since roswww server port is decided randomly range from --start_port to --end_port. This pull request adds arguments to set start_port and end_port to webserver.launch file and set them as same as --port to fix the port to one specified in here: https://github.com/tork-a/roswww/blob/develop/test/launch.test#L3

I also improved argument parser of server script.

This pull request also include client side test. To check the error mentioned here: https://github.com/tork-a/visualization_rwt/pull/71, I first commit the test code without fix for this error. After confirming that it fails, I will push the fix.

furushchev commented 6 years ago

waiting for https://github.com/ros/rosdistro/pull/16755

furushchev commented 6 years ago

test failed as expected:

make[3]: Entering directory `/root/catkin_ws/build/roswww'
catkin_generated/env_cached.sh /usr/bin/python /opt/ros/indigo/share/catkin/cmake/test/run_tests.py /root/catkin_ws/build/roswww/test_results/roswww/rostest-test_launch.xml /opt/ros/indigo/share/rostest/cmake/../../../bin/rostest\ --pkgdir=/root/catkin_ws/src/roswww\ --package=roswww\ --results-filename\ test_launch.xml\ --results-base-dir\ "/root/catkin_ws/build/roswww/test_results"\ /root/catkin_ws/src/roswww/test/launch.test\ 
-- run_tests.py: execute commands
  /opt/ros/indigo/share/rostest/cmake/../../../bin/rostest --pkgdir=/root/catkin_ws/src/roswww --package=roswww --results-filename test_launch.xml --results-base-dir /root/catkin_ws/build/roswww/test_results /root/catkin_ws/src/roswww/test/launch.test 
... logging to rostest-08579b9cb671-3275.log
[ROSUNIT] Outputting test results to /root/catkin_ws/build/roswww/test_results/roswww/rostest-test_launch.xml
Error opening rosout log file '/root/.ros/f09200a2-f5f5-11e7-acfd-0242ac110002/rosout.log': No such file or directory2018-01-10 11:03:51,464 - roswww - INFO - roswww : # of packages : 43
2018-01-10 11:03:51,464 - roswww - INFO - roswww : Weg Page root : www
2018-01-10 11:03:51,474 - roswww - INFO - roswww : Initialised
2018-01-10 11:03:51,475 - roswww - INFO - roswww : Attempting to start webserver on port 8086
2018-01-10 11:03:51,477 - roswww - INFO - roswww : Webserver successfully started on port 8086
2018-01-10 11:03:54,759 - roswww - INFO - roswww : Webserver shutting down
testtest_roswww ... ok
[ROSTEST]-----------------------------------------------------------------------
[roswww.rosunit-test_roswww/test_index_redirected][FAILURE]---------------------
Loading 'css/index.css' from 'index.html' failed
  File "/usr/lib/python2.7/unittest/case.py", line 331, in run
    testMethod()
  File "/root/catkin_ws/src/roswww/test/test_roswww.py", line 91, in test_index_redirected
    self._check_index(url)
  File "/root/catkin_ws/src/roswww/test/test_roswww.py", line 83, in _check_index
    "Loading 'css/index.css' from 'index.html' failed")
  File "/usr/lib/python2.7/unittest/case.py", line 515, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python2.7/unittest/case.py", line 508, in _baseAssertEqual
    raise self.failureException(msg)
--------------------------------------------------------------------------------
[roswww.rosunit-test_roswww/test_index_served][passed]
SUMMARY
 * RESULT: FAIL
 * TESTS: 2
 * ERRORS: 0
 * FAILURES: 1

Now I'll push fixed codes

furushchev commented 6 years ago

Travis is all passed https://travis-ci.org/tork-a/roswww/builds/327244145

furushchev commented 6 years ago

@k-okada Please review and merge if there is no problem!