Statistics
| Branch: | Tag: | Revision:

root / test / py / cmdlib / cluster_unittest.py @ 19830e88

History | View | Annotate | Download (1.6 kB)

1
#!/usr/bin/python
2
#
3

    
4
# Copyright (C) 2013 Google Inc.
5
#
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
# General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
# 02110-1301, USA.
20

    
21

    
22
"""Tests for LUCluster*
23

24
"""
25

    
26
from ganeti import opcodes
27

    
28
from testsupport import *
29

    
30
import testutils
31

    
32

    
33
class TestLUClusterActivateMasterIp(CmdlibTestCase):
34
  def testSuccess(self):
35
    op = opcodes.OpClusterActivateMasterIp()
36

    
37
    self.rpc.call_node_activate_master_ip.return_value = \
38
      RpcResultsBuilder(cfg=self.cfg) \
39
        .CreateSuccessfulNodeResult(self.cfg.GetMasterNode())
40

    
41
    self.ExecOpCode(op)
42

    
43
    self.rpc.call_node_activate_master_ip.assert_called_once_with(
44
      self.cfg.GetMasterNode(),
45
      self.cfg.GetMasterNetworkParameters(),
46
      False)
47

    
48
  def testFailure(self):
49
    op = opcodes.OpClusterActivateMasterIp()
50

    
51
    self.rpc.call_node_activate_master_ip.return_value = \
52
      RpcResultsBuilder(cfg=self.cfg) \
53
        .CreateFailedNodeResult(self.cfg.GetMasterNode()) \
54

    
55
    self.ExecOpCodeExpectOpExecError(op)
56

    
57

    
58
if __name__ == "__main__":
59
  testutils.GanetiTestProgram()