def testGetInvalidHostPort(self): properties.VALUES.emulator.pubsub_host_port.Set('invalidhostport8080') with self.assertRaises(util.InvalidHostError): util.GetHostPort('pubsub') properties.VALUES.emulator.datastore_host_port.Set('localhost8085') with self.assertRaises(util.InvalidHostError): util.GetHostPort('datastore')
def Run(self, args): if not args.host_port: args.host_port = arg_parsers.HostPort.Parse(util.GetHostPort( bigtable_util.BIGTABLE), ipv6_enabled=True) bigtable_util.Start(args)
def Run(self, args): if not args.host_port: args.host_port = arg_parsers.HostPort.Parse(util.GetHostPort( pubsub_util.PUBSUB), ipv6_enabled=True) with pubsub_util.Start(args) as pubsub_process: util.WriteEnvYaml(pubsub_util.GetEnv(args), args.data_dir) util.PrefixOutput(pubsub_process, pubsub_util.PUBSUB)
def testGetHostPort(self): socket_mock = self.StartObjectPatch(socket.socket, 'connect_ex') socket_mock.return_value = 1 properties.VALUES.emulator.datastore_host_port.Set('[::1]:8081') properties.VALUES.emulator.pubsub_host_port.Set('[::1]:8085') self.assertEqual('[::1]:8081', util.GetHostPort('datastore')) self.assertEqual('[::1]:8085', util.GetHostPort('pubsub')) properties.VALUES.emulator.datastore_host_port.Set( '[2620::1012:a:476:5b8a:e9d8:596f]:8080') self.assertEqual('[2620::1012:a:476:5b8a:e9d8:596f]:8080', util.GetHostPort('datastore')) port_picker_mock = self.StartObjectPatch(util, 'GetHostPort') port_picker_mock.return_value = '[::1]:8123' socket_mock.return_value = 0 self.assertEqual('[::1]:8123', util.GetHostPort('pubsub'))
def Run(self, args): if not args.host_port: args.host_port = arg_parsers.HostPort.Parse( 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 GetHostPort(): return util.GetHostPort(DATASTORE)
def GetHostPort(): return util.GetHostPort(FIRESTORE)
def testEmulatorNoDefaultPort(self): port_picker_mock = self.StartObjectPatch(util, 'GetHostPort') port_picker_mock.return_value = '[::1]:8123' self.assertEqual('[::1]:8123', util.GetHostPort('unknownemulator'))