def Run(self, args): if not args.host_port: args.host_port = arg_parsers.HostPort.Parse( datastore_util.GetHostPort(), ipv6_enabled=socket.has_ipv6) args.host_port.host = args.host_port.host or 'localhost' datastore_util.PrepareGCDDataDir(args) with datastore_util.StartGCDEmulator(args) as proc: datastore_util.WriteGCDEnvYaml(args) util.PrefixOutput(proc, 'datastore')
def _DoTestStartGCDEmulator(self): gcd_root_mock = self.StartObjectPatch(datastore_util, 'GetGCDRoot') gcd_root_mock.return_value = 'pathtogcdroot' exec_mock = self.StartObjectPatch(util, 'Exec') args = type(str('args_mock'), (object,), dict(host_port=arg_parsers.HostPort('localhost', '8080'), store_on_disk=True, data_dir='temp_dir', consistency=0.7)) datastore_util.StartGCDEmulator(args) start_args = ['start', '--host=localhost', '--port=8080', '--store_on_disk=True', '--consistency=0.7', '--allow_remote_shutdown', 'temp_dir',] exec_args = datastore_util.ArgsForGCDEmulator(start_args) exec_mock.assert_called_once_with(exec_args, log_file=None)