예제 #1
0
    def test_command_with_bad_count(self, mocker, printing, instances):
        real_command = subject.command()

        real_command.run_for('bad')

        assert self.mock_print.mock_calls == [
            mocker.call('FAILED TO START daisy chain: bad is not an integer')
        ]
예제 #2
0
    def test_command_when_starting_one_node_and_node_is_running_on_node0(self, instances):
        self.mock_node0.node.descriptor = 'descriptor'
        real_command = subject.command()

        real_command.run_for('1')

        self.mock_node0.start_node.assert_not_called()
        self.mock_node1.start_node.assert_called_with('descriptor')
예제 #3
0
    def test_command_when_trying_to_start_one_node_and_node_is_not_running_on_node0(self, instances):
        self.mock_node0.node.descriptor = ''
        self.mock_node0.start_node.return_value = 'mock-node-descriptor'
        real_command = subject.command()

        real_command.run_for('1')

        self.mock_node0.start_node.assert_called_with()
        self.mock_node1.start_node.assert_called_with('mock-node-descriptor')
예제 #4
0
    def test_command_when_starting_multiple_nodes_and_node0_is_running(self, instances):
        self.mock_node0.node.descriptor = 'node-0-descriptor'
        self.mock_node1.start_node.return_value = 'node-1-descriptor'
        real_command = subject.command()

        real_command.run_for('2')

        self.mock_node0.start_node.assert_not_called()
        self.mock_node1.start_node.assert_called_with('node-0-descriptor')
        self.mock_node2.start_node.assert_called_with('node-1-descriptor')
예제 #5
0
    ),
    'stop':
    SelectCommand('stop', lambda instance: instance.stop_node(),
                  "reverts and stops MASQNode on"),
    finish.name():
    finish.command(),  # always "all"
    'shell':
    SelectCommand('shell', lambda instance: instance.shell(),
                  "opens shell(s) on node instance in terminal window"),
    kill.name():
    kill.command(),
    nfo.name():
    nfo.command(),
    help.name():
    help.command(),
    daisy.name():
    daisy.command(),
    cluster.name():
    cluster.command(),
    'set':
    SetCommand(),
    'binaries':
    binaries_command.BinariesCommand(),

    # TODO status command (finds out which instances are running (checks all platforms), for running instances, determines if node is running on them, if they are subverted, etc)
    # it should not load this state into INSTANCES automatically (multiple pairs could be using different cloud instances, so this should enable coordination)
    # status could prompt for which ones we want to claim for this run of TNT, and load only those into INSTANCES.

    # TODO help command with more detailed command info
}
예제 #6
0
    def test_command(self):
        real_command = subject.command()

        assert real_command.name == 'daisy'
        assert real_command.info == 'Starts the specified number of nodes in a daisy chain'