Exemple #1
0
    def test_wait_on_app(self):
        port = 20000
        ip = "127.0.0.1"
        testing.disable_logging()
        flexmock(urllib).should_receive("urlopen").and_return()
        flexmock(appscale_info).should_receive("get_private_ip").and_return(ip)
        self.assertEqual(True, app_manager_server.wait_on_app(port))

        flexmock(time).should_receive("sleep").and_return()
        flexmock(urllib).should_receive("urlopen").and_raise(IOError)
        self.assertEqual(False, app_manager_server.wait_on_app(port))
  def test_wait_on_app(self):
    port = 20000
    ip = '127.0.0.1'
    testing.disable_logging()
    flexmock(urllib).should_receive('urlopen').and_return()
    flexmock(appscale_info).should_receive('get_private_ip')\
      .and_return(ip)
    self.assertEqual(True, app_manager_server.wait_on_app(port))

    flexmock(time).should_receive('sleep').and_return()
    flexmock(urllib).should_receive('urlopen').and_raise(IOError)
    self.assertEqual(False, app_manager_server.wait_on_app(port))
Exemple #3
0
  def test_wait_on_app(self):
    port = 20000
    ip = '127.0.0.1'
    testing.disable_logging()
    fake_opener = flexmock(
      open=lambda opener: flexmock(code=200, headers=flexmock(headers=[])))
    flexmock(urllib2).should_receive('build_opener').and_return(fake_opener)
    flexmock(appscale_info).should_receive('get_private_ip').and_return(ip)
    self.assertEqual(True, app_manager_server.wait_on_app(port))

    flexmock(time).should_receive('sleep').and_return()
    fake_opener.should_receive('open').and_raise(IOError)
    self.assertEqual(False, app_manager_server.wait_on_app(port))
Exemple #4
0
  def test_wait_on_app(self):
    port = 20000
    ip = '127.0.0.1'
    testing.disable_logging()
    fake_opener = flexmock(
      open=lambda opener: flexmock(code=200, headers=flexmock(headers=[])))
    flexmock(urllib2).should_receive('build_opener').and_return(fake_opener)
    flexmock(appscale_info).should_receive('get_private_ip').and_return(ip)
    instance_started = yield app_manager_server.wait_on_app(port)
    self.assertEqual(True, instance_started)

    response = Future()
    response.set_result(None)
    flexmock(gen).should_receive('sleep').and_return(response)
    fake_opener.should_receive('open').and_raise(IOError)
    instance_started = yield app_manager_server.wait_on_app(port)
    self.assertEqual(False, instance_started)