message: added config based tests
diff: @@ -18,8 +18,8 @@ from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  +import tempfile
  from tensorflow.python.data.experimental.service import server_lib
  -
  from tensorflow.python.platform import test
  @@ -29,6 +29,32 @@ class ServerLibTest(test.TestCase):
  dispatcher = server_lib.DispatchServer(start=False)
  dispatcher.start()
  + def testStartDispatcherWithPortConfig(self):
  + config = server_lib.DispatcherConfig(port=5000)
  + dispatcher = server_lib.DispatchServer(config=config, start=False)
  + dispatcher.start()
  + assert dispatcher.target == "grpc://localhost:5000"
  +
  + def testStartDispatcherWithWorkDirConfig(self):
  + temp_dir = tempfile.mkdtemp()
  + config = server_lib.DispatcherConfig(work_dir=temp_dir)
  + dispatcher = server_lib.DispatchServer(config=config, start=False)
  + dispatcher.start()
  +
  + def testStartDispatcherWithFaultTolerantConfig(self):
  + temp_dir = tempfile.mkdtemp()
  + config = server_lib.DispatcherConfig(work_dir=temp_dir,
  + fault_tolerant_mode=True)
  + dispatcher = server_lib.DispatchServer(config=config, start=False)
  + dispatcher.start()
  +
  + def testStartDispatcherWithWrongFaultTolerantConfig(self):
  + config = server_lib.DispatcherConfig(fault_tolerant_mode=True)
  + error = "Cannot enable fault tolerant mode without configuring a work_dir"
  + with self.assertRaisesRegex(ValueError, error):
  + dispatcher = server_lib.DispatchServer(config=config, start=False)
  + dispatcher.start()
  +
  def testMultipleStartDispatcher(self):
  dispatcher = server_lib.DispatchServer(start=True)
  dispatcher.start()
  @@ -39,6 +65,13 @@ class ServerLibTest(test.TestCase):
  server_lib.WorkerConfig(dispatcher._address), start=False)
  worker.start()
  + def testStartWorkerWithPortConfig(self):
  + dispatcher = server_lib.DispatchServer()
  + worker = server_lib.WorkerServer(
  + server_lib.WorkerConfig(dispatcher._address, port=5005), start=False)
  + worker.start()
  + assert worker._address == "localhost:5005"
  +
  def testMultipleStartWorker(self):
  dispatcher = server_lib.DispatchServer()
  worker = server_lib.WorkerServer(
  