Exemple #1
0
    def test_client_server(self):
        context.cwd = '$testdir'
        servertask = Task('server', detach=True)
        server = servertask.command('%s Server --Ice.Config=Server.config' % java,
                                    signal=2, expected=130)
        servertask.assert_that(server.stdout.content, contains_string('Hello World!'))

        clientside = Task('client')
        clientside.wait_that(server, running())
        clientside.wait_that(server.stdout.content, contains_string('printer1'))
        clientside.command('%s Client "$(head -1 %s)"' % (java, server.stdout.path))
Exemple #2
0
    def make_client_server(self, client, server):
        servertask = Task('server', detach=True)
        server = servertask.command('{} --Ice.Config=Server.config'.format(server),
                                    cwd='$testdir', signal=2)
        servertask.assert_that(server.stdout.content, contains_string('Hello World!'))

        clientside = Task('client')
        clientside.wait_that(server, running())
        clientside.wait_that(server.stdout.content, contains_string('printer1'))
        clientside.command('{} "$(head -1 {})"'.format(client, server.stdout.path),
                           cwd='$testdir')
Exemple #3
0
    def test_netcat(self):
        ctx.port = 2000
        server = Task(desc='netcat server', detach=True)
        server.assert_that(Package('nmap'), installed())
        server.assert_that(localhost, hamcrest.is_not(listen_port(ctx.port)))
        cmd = server.command('ncat -l -p $port')
        server.assert_that(cmd.stdout.content, hamcrest.contains_string('bye'))

        client = Task(desc='netcat client')
        client.wait_that(server, running())
        client.wait_that(localhost, listen_port(ctx.port))
        client.command('ncat -c "echo bye" localhost $port')
Exemple #4
0
    def run_with_config(self, mode, browser=None):
        write_config_file(mode, browser)

        server = Task(detach=True)
        server.command('python -m SimpleHTTPServer 8000', expected=-15, timeout=None)

        tester = Task()
        tester.wait_that(localhost, listen_port(8000))
        tester.command('nosetests -v test/tests.py', timeout=60)

        Task().command('killall chromedriver', expected=None, timeout=None)
        return tester
 def test_no_detach_no_timeout(self):
     task = Task(detach=True)
     cmd = task.command(
         prego_cmd %
         '-v test/integration/advices.py:Timeout.test_no_detach_no_timeout',
         expected=None)
     task.wait_that(
         cmd.stderr.content,
         contains_string(
             "A.0 No timeout command in a non detached task could block forever!"
         ))
     Task().delay()
Exemple #6
0
    def test(self):
        with open(ctx.source, 'w') as s:
            s.write(code)

        gcc = Task('compile')
        gcc.command('gcc $source -o $bin')

        run = Task('run', detach=True)
        c = run.command('$bin', expected=None)

        check = Task('check')
        check.wait_that(c.stdout.content, contains_string('Hello!\n'))
Exemple #7
0
def wait_clients(clients):
    task = Task('wait clients end')
    for client in clients:
        task.wait_that(client, terminated(), timeout=60)