Revision d51ae04c test/ganeti.masterd.instance_unittest.py

b/test/ganeti.masterd.instance_unittest.py
102 102
  def test(self):
103 103
    cds = "bbf46ea9a"
104 104
    salt = "ee5ad9"
105
    di = ComputeRemoteImportDiskInfo(cds, salt, 0, "node1", 1234)
105
    di = ComputeRemoteImportDiskInfo(cds, salt, 0, "node1", 1234, "mag111")
106 106
    self.assertEqual(CheckRemoteExportDiskInfo(cds, 0, di),
107
                     ("node1", 1234))
107
                     ("node1", 1234, "mag111"))
108 108

  
109 109
    for i in range(1, 100):
110 110
      # Wrong disk index
......
116 116
    salt = "drK5oYiHWD"
117 117

  
118 118
    for host in [",", "...", "Hello World", "`", "!", "#", "\\"]:
119
      di = ComputeRemoteImportDiskInfo(cds, salt, 0, host, 1234)
119
      di = ComputeRemoteImportDiskInfo(cds, salt, 0, host, 1234, "magic")
120 120
      self.assertRaises(errors.OpPrereqError,
121 121
                        CheckRemoteExportDiskInfo, cds, 0, di)
122 122

  
123 123
    for port in [-1, 792825908, "HelloWorld!", "`#", "\\\"", "_?_"]:
124
      di = ComputeRemoteImportDiskInfo(cds, salt, 0, "localhost", port)
124
      di = ComputeRemoteImportDiskInfo(cds, salt, 0, "localhost", port, "magic")
125 125
      self.assertRaises(errors.OpPrereqError,
126 126
                        CheckRemoteExportDiskInfo, cds, 0, di)
127 127

  
......
136 136

  
137 137
    # No host/port
138 138
    self.assertRaises(errors.GenericError, CheckRemoteExportDiskInfo,
139
                      cds, 0, ("", 0, "", ""))
139
                      cds, 0, ("", 1234, "magic", "", ""))
140
    self.assertRaises(errors.GenericError, CheckRemoteExportDiskInfo,
141
                      cds, 0, ("host", 0, "magic", "", ""))
142
    self.assertRaises(errors.GenericError, CheckRemoteExportDiskInfo,
143
                      cds, 0, ("host", 1234, "", "", ""))
140 144

  
141 145
    # Wrong hash
142 146
    self.assertRaises(errors.GenericError, CheckRemoteExportDiskInfo,
143
                      cds, 0, ("nodeX", 123, "fakehash", "xyz"))
147
                      cds, 0, ("nodeX", 123, "magic", "fakehash", "xyz"))
144 148

  
145 149

  
146 150
class TestFormatProgress(unittest.TestCase):

Also available in: Unified diff