Esempio n. 1
0
    def test_commandline_client(self):
        args = []
        # Missing --daemon, --client
        with self.assertRaises(SystemExit):
            inl_client.commandline_client(args)

        # Missing --daemon
        args.extend(['--client', '0'])
        with self.assertRaises(SystemExit):
            inl_client.commandline_client(args)

        # this is the last required arg
        args.extend(['--daemon', 'stop'])
        c, cmd = inl_client.commandline_client(args)
        self.assertEqual(cmd, 'stop')
Esempio n. 2
0
    def test_commandline_client(self):
        args = []
        with self.assertRaises(SystemExit):
            c, cmd = inl_client.commandline_client(args)

        # make sure it exits unless all required
        # arguments are passed in
        args.extend(['--client', '0'])
        with self.assertRaises(SystemExit):
            c, cmd = inl_client.commandline_client(args)

        # this is the last required arg
        args.extend(['--daemon', 'stop'])
        c, cmd = inl_client.commandline_client(args)
        self.assertEqual(cmd, 'stop')
Esempio n. 3
0
        def do_test(test_cmd):
            args = ['--client', '0', '--daemon', test_cmd]

            # Missing --configs
            with self.assertRaises(BaseClient.ClientException):
                inl_client.commandline_client(args)

            # Have all required args
            args.extend(['--configs', 'config'])
            c, cmd = inl_client.commandline_client(args)
            self.assertEqual(self.civet_dir + '/build_0', c.get_build_root())

            # Addd --build-root
            args.extend(['--build-root', '/foo/bar'])
            c, cmd = inl_client.commandline_client(args)
            self.assertIn('config', c.get_client_info('build_configs'))
            self.assertEqual('/foo/bar', c.get_build_root())
            self.assertEqual(c.get_environment('CIVET_CLIENT_NUMBER'), '0')
            self.assertEqual(cmd, test_cmd)

            # Should add env
            args.extend(['--env', 'FOO', 'bar'])
            c, cmd = inl_client.commandline_client(args)
            self.assertEqual('bar', c.get_environment('FOO'))

            # Should add the current user to the client name
            user = pwd.getpwuid(os.getuid())[0]
            args.extend(['--user-client-suffix'])
            c, cmd = inl_client.commandline_client(args)
            self.assertIn(user, c.get_client_info('client_name'))
            self.assertIn(user, c.get_environment('CIVET_CLIENT_NAME'))
Esempio n. 4
0
    def create_client(self, args):
        c, cmd = inl_client.commandline_client(args)
        BaseClient.setup_logger() # logger on stdout
        claimed_job = utils.read_json_test_file("claimed_job.json")
        c.client_info["single_shot"] = True
        c.client_info["update_step_time"] = 1
        c.client_info["server_update_time"] = 1
        c.client_info["ssl_cert"] = False # not needed but will get another line of coverage
        if claimed_job['config'] not in c.get_client_info('build_configs'):
            c.add_config(claimed_job['config'])
        if claimed_job['config'] not in c.get_client_info('config_modules') or 'moose-dev-gcc' not in c.get_client_info('config_modules')[claimed_job['config']]:
            c.add_config_module(claimed_job['config'], 'moose-dev-gcc')
        server = ("https://<server1>", "1234", False)
        settings.SERVERS.append(server)
        c.client_info["servers"] = [ s[0] for s in settings.SERVERS ]

        return {"client": c, "daemon": cmd, "server": server, "claimed_job": claimed_job}
Esempio n. 5
0
    def create_client(self, args):
        c, cmd = inl_client.commandline_client(args)
        BaseClient.setup_logger()  # logger on stdout
        os.environ["BUILD_ROOT"] = "/foo/bar"
        claimed_job = utils.read_json_test_file("claimed_job.json")
        c.client_info["single_shot"] = True
        c.client_info["update_step_time"] = 1
        c.client_info["server_update_time"] = 1
        c.client_info[
            "ssl_cert"] = False  # not needed but will get another line of coverage

        settings.CONFIG_MODULES[claimed_job["config"]] = ["moose-dev-gcc"]
        server = ("https://<server1>", "1234", False)
        settings.SERVERS.append(server)
        c.client_info["servers"] = [s[0] for s in settings.SERVERS]

        return {
            "client": c,
            "daemon": cmd,
            "server": server,
            "claimed_job": claimed_job
        }
Esempio n. 6
0
 def create_client(self, args):
     c, cmd = inl_client.commandline_client(args)
     return c, cmd