Search code examples
fedorafirewallrpmbuildchroot

Fedora Mockbuild: Execute karma tests


I'm trying to execute the KARMA test cases during the build generation. KARMA runs in a port and that is causing the problem. Is there any that I could open or use the port during the build process. I tried BuildRequires:Firewalld, and configure the firewall that does not work. Any hint or help is greatly appreciated.

[DEBUG] config - Loading config /builddir/build/BUILD/karma.conf.js
ERROR [runner]: There is no server listening on port 80

Solution

  • The answer here might not be to open a port in the firewall as you think.

    From the error message you posted, it seems that the test server tries to listen on port 80, which is forbidden to non-root users:

    $ python -m SimpleHTTPServer 80
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
        "__main__", fname, loader, pkg_name)
      File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
        exec code in run_globals
      File "/usr/lib64/python2.7/SimpleHTTPServer.py", line 235, in <module>
        test()
      File "/usr/lib64/python2.7/SimpleHTTPServer.py", line 231, in test
        BaseHTTPServer.test(HandlerClass, ServerClass)
      File "/usr/lib64/python2.7/BaseHTTPServer.py", line 595, in test
        httpd = ServerClass(server_address, HandlerClass)
      File "/usr/lib64/python2.7/SocketServer.py", line 420, in __init__
        self.server_bind()
      File "/usr/lib64/python2.7/BaseHTTPServer.py", line 108, in server_bind
        SocketServer.TCPServer.server_bind(self)
      File "/usr/lib64/python2.7/SocketServer.py", line 434, in server_bind
        self.socket.bind(self.server_address)
      File "/usr/lib64/python2.7/socket.py", line 228, in meth
        return getattr(self._sock,name)(*args)
    socket.error: [Errno 13] Permission denied
    

    But running the same as root:

    $ sudo python -m SimpleHTTPServer 80
    Serving HTTP on 0.0.0.0 port 80 ...
    

    So the first thing I would do would be to try and get that test server to run on a port > 1024.


    You tried installing firewalld as a build requirement, but that gets it installed inside the build chroot. You probably already have firewalld running on the host machine, so I don't think you can run one more inside the chroot.

    As a result, if you really need to change the firewall rules for those tests to pass, then I think you'll need to configure the firewall on the build host.