Exemplo n.º 1
0
  def Run(self, args):
    if not args.host_port:
      args.host_port = arg_parsers.HostPort('localhost', '9010')
    if not args.rest_port:
      args.rest_port = 9020

    spanner_util.Start(args)
Exemplo n.º 2
0
  def testWriteIPV6EnvYaml(self):
    env_mock = self.StartObjectPatch(util, 'WriteEnvYaml')

    args = type(str('args_mock'),
                (object,),
                dict(host_port=arg_parsers.HostPort('::', '8080'),
                     store_on_disk=True,
                     data_dir='temp_dir'))
    datastore_util.WriteGCDEnvYaml(args)
    env = {'DATASTORE_HOST': 'http://:::8080',
           'DATASTORE_EMULATOR_HOST': ':::8080',
           'DATASTORE_EMULATOR_HOST_PATH': ':::8080/datastore',
           'DATASTORE_DATASET': self.Project(),
           'DATASTORE_PROJECT_ID': self.Project(),}
    env_mock.assert_called_once_with(env, 'temp_dir')
    def _DoTestStartFirestoreEmulator(self):
        firestore_root_mock = self.StartObjectPatch(util, 'GetEmulatorRoot')
        firestore_root_mock.return_value = 'pathtofirestoreroot'
        exec_mock = self.StartObjectPatch(util, 'Exec')

        args = type(
            str('args_mock'), (object, ), {
                'host_port': arg_parsers.HostPort('localhost', '8080'),
                'rules': '/path/to/firestore.rules'
            })
        firestore_util.StartFirestoreEmulator(args)
        start_args = [
            'start', '--host=localhost', '--port=8080',
            '--rules=/path/to/firestore.rules'
        ]
        exec_args = firestore_util.ArgsForFirestoreEmulator(start_args)
        exec_mock.assert_called_once_with(exec_args, log_file=None)
Exemplo n.º 4
0
  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)