Пример #1
0
  def testTailWithIndexInBounds(self):
    # calling 'appscale tail 1 *' should tail from the second node
    # (nodes[1]). If there are two nodes in this deployment,
    # we should tail from it successfully
    appscale = AppScale()

    contents = { 'keyname' : 'boo' }
    yaml_dumped_contents = yaml.dump(contents)

    one = {
      'public_ip' : 'blarg'
    }
    two = {
      'public_ip' : 'blarg2'
    }
    nodes = {'node_info': [one, two]}
    nodes_contents = json.dumps(nodes)

    mock = self.addMockForAppScalefile(appscale, yaml_dumped_contents)
    (mock.should_receive('open')
      .with_args(appscale.get_locations_json_file('boo'))
      .and_return(flexmock(read=lambda: nodes_contents)))

    flexmock(subprocess)
    subprocess.should_receive('call').with_args(["ssh", "-o",
      "StrictHostkeyChecking=no", "-i", appscale.get_key_location('boo'),
      "root@blarg2", "tail -F /var/log/appscale/c*"]).and_return().once()
    appscale.tail(1, "c*")
Пример #2
0
    def testTailWithIndexInBounds(self):
        # calling 'appscale tail 1 *' should tail from the second node
        # (nodes[1]). If there are two nodes in this deployment,
        # we should tail from it successfully
        appscale = AppScale()

        contents = {'keyname': 'boo'}
        yaml_dumped_contents = yaml.dump(contents)

        one = {'public_ip': 'blarg'}
        two = {'public_ip': 'blarg2'}
        nodes = {'node_info': [one, two]}
        nodes_contents = json.dumps(nodes)

        mock = self.addMockForAppScalefile(appscale, yaml_dumped_contents)
        (mock.should_receive('open').with_args(
            appscale.get_locations_json_file('boo')).and_return(
                flexmock(read=lambda: nodes_contents)))

        flexmock(subprocess)
        subprocess.should_receive('call').with_args([
            "ssh", "-o", "StrictHostkeyChecking=no", "-i",
            appscale.get_key_location('boo'), "root@blarg2",
            "tail -F /var/log/appscale/c*"
        ]).and_return().once()
        appscale.tail(1, "c*")