def test_glancing_metadata_bad_but_force(self):
     # Size & checksum mismatch: 375 MB -> 492 MB
     market_id = 'ME4iRTemHRwhABKV5AgrkQfDerA'
     mdfile = get_local_path('..', 'stratuslab', market_id + '.json')
     self.assertTrue(glancing.main(['-vf', '-n', test_name(), mdfile]))
     self.assertTrue(glance.glance_delete(test_name()))
     self.assertFalse(glancing.main(['-vf', '-n', test_name(), market_id]))
 def test_glancing_metadata_bad_but_force(self):
     # Size & checksum mismatch: 375 MB -> 492 MB
     market_id = 'ME4iRTemHRwhABKV5AgrkQfDerA'
     mdfile = get_local_path('..', 'stratuslab', market_id + '.json')
     self.assertTrue(glancing.main(['-vf', '-n', test_name(), mdfile]))
     self.assertTrue(glance.glance_delete(test_name()))
     self.assertFalse(glancing.main(['-vf', '-n', test_name(), market_id]))
 def test_glancing_file_dryrun_good_sum(self):
     self.assertTrue(
         glancing.main([
             '-d', '-n',
             test_name(), self._CIRROS_FILE, '-S', self._CIRROS_MD5
         ]))
     self.assertTrue(
         glancing.main([
             '-d', '-n',
             test_name(), self._CIRROS_FILE, '-S', self._CIRROS_SHA1
         ]))
     self.assertTrue(
         glancing.main([
             '-d', '-n',
             test_name(), self._CIRROS_FILE, '-S', self._CIRROS_SHA1, '-S',
             self._CIRROS_MD5
         ]))
     self.assertTrue(
         glancing.main([
             '-d', '-n',
             test_name(), self._CIRROS_FILE, '-S', self._CIRROS_MD5, '-s',
             self._CIRROS_CHK
         ]))
     self.assertTrue(
         glancing.main([
             '-d', '-n',
             test_name(), self._CIRROS_FILE, '-s', self._CIRROS_CHK, '-S',
             self._CIRROS_SHA1
         ]))
Beispiel #4
0
 def test_glance_diskformat(self):
     glance.glance_delete_all(utils.test_name(), quiet=True)
     ret = glance.glance_import(os.devnull, name=utils.test_name(),
                                diskformat='notgood')
     self.assertFalse(ret)
     ret = glance.glance_import(os.devnull, name=utils.test_name())
     self.assertFalse(ret)
     glance.glance_delete_all(utils.test_name(), quiet=True)
Beispiel #5
0
 def test_glance_diskformat(self):
     glance.glance_delete_all(utils.test_name(), quiet=True)
     ret = glance.glance_import(os.devnull,
                                name=utils.test_name(),
                                diskformat='notgood')
     self.assertFalse(ret)
     ret = glance.glance_import(os.devnull, name=utils.test_name())
     self.assertFalse(ret)
     glance.glance_delete_all(utils.test_name(), quiet=True)
Beispiel #6
0
 def test_glance_ids_uuid(self):
     glance.glance_delete_all(utils.test_name(), quiet=True)
     ret = glance.glance_import(os.devnull, name=utils.test_name(),
                                diskformat='raw')
     self.assertTrue(ret)
     img_uuids_name = list(glance.glance_ids(utils.test_name()))
     self.assertEqual(len(img_uuids_name), 1)
     img_uuid = img_uuids_name[0]
     img_uuids_uuid = list(glance.glance_ids(img_uuid))
     self.assertEqual(img_uuids_uuid, img_uuids_name)
     glance.glance_delete_all(utils.test_name(), quiet=True)
 def test_glancing_file_dryrun_good_sum(self):
     self.assertTrue(glancing.main(['-d', '-n', test_name(),
         self._CIRROS_FILE, '-S', self._CIRROS_MD5]))
     self.assertTrue(glancing.main(['-d', '-n', test_name(),
         self._CIRROS_FILE, '-S', self._CIRROS_SHA1]))
     self.assertTrue(glancing.main(['-d', '-n', test_name(),
         self._CIRROS_FILE, '-S', self._CIRROS_SHA1, '-S', self._CIRROS_MD5]))
     self.assertTrue(glancing.main(['-d', '-n', test_name(),
         self._CIRROS_FILE, '-S', self._CIRROS_MD5, '-s', self._CIRROS_CHK]))
     self.assertTrue(glancing.main(['-d', '-n', test_name(),
         self._CIRROS_FILE, '-s', self._CIRROS_CHK, '-S', self._CIRROS_SHA1]))
Beispiel #8
0
 def test_glance_ids_uuid(self):
     glance.glance_delete_all(utils.test_name(), quiet=True)
     ret = glance.glance_import(os.devnull,
                                name=utils.test_name(),
                                diskformat='raw')
     self.assertTrue(ret)
     img_uuids_name = list(glance.glance_ids(utils.test_name()))
     self.assertEqual(len(img_uuids_name), 1)
     img_uuid = img_uuids_name[0]
     img_uuids_uuid = list(glance.glance_ids(img_uuid))
     self.assertEqual(img_uuids_uuid, img_uuids_name)
     glance.glance_delete_all(utils.test_name(), quiet=True)
Beispiel #9
0
 def test_utils_cleanup(self):
     test_file = '/tmp/' + utils.test_name()
     self.assertFalse(os.path.exists(test_file))
     with utils.cleanup(['rm', test_file]):
         utils.run(['touch', test_file])
         self.assertTrue(os.path.exists(test_file))
     self.assertFalse(os.path.exists(test_file))
Beispiel #10
0
 def test_decompressor_good_ext_existent(self):
     fn = '/tmp/' + utils.test_name() + '.ext'
     open(fn, 'wb+').close()
     with self.assertRaises(decompressor.DecompressorError):
         decompressor.Decompressor(fn)
     with self.assertRaises(decompressor.DecompressorError):
         decompressor.Decompressor(fn, '.zip')
 def test_glancing_metadata_cirros_import_no_cksum(self):
     # 12 MB
     mdfile = get_local_path('..', 'stratuslab', 'cirros_no_cksum.json')
     with devnull('stderr'):
         self.assertTrue(
             glancing.main(['-v', '-n',
                            test_name(), mdfile, '-k']))
Beispiel #12
0
 def test_utils_cleanup(self):
     test_file = '/tmp/' + utils.test_name()
     self.assertFalse(os.path.exists(test_file))
     with utils.cleanup(['rm', test_file]):
         utils.run(['touch', test_file])
         self.assertTrue(os.path.exists(test_file))
     self.assertFalse(os.path.exists(test_file))
 def test_decompressor_good_ext_existent(self):
     fn = '/tmp/' + utils.test_name() + '.ext'
     open(fn, 'wb+').close()
     with self.assertRaises(decompressor.DecompressorError):
         decompressor.Decompressor(fn)
     with self.assertRaises(decompressor.DecompressorError):
         decompressor.Decompressor(fn, '.zip')
Beispiel #14
0
 def test_utils_run_file(self):
     test_file = '/tmp/' + utils.test_name()
     if os.path.exists(test_file): # pragma: no cover
         os.remove(test_file)
     self.assertTrue(utils.run(['touch', test_file])[0])
     self.assertTrue(os.path.exists(test_file))
     self.assertTrue(utils.run(['rm', test_file])[0])
     self.assertFalse(os.path.exists(test_file))
Beispiel #15
0
 def test_utils_run_file(self):
     test_file = '/tmp/' + utils.test_name()
     if os.path.exists(test_file):  # pragma: no cover
         os.remove(test_file)
     self.assertTrue(utils.run(['touch', test_file])[0])
     self.assertTrue(os.path.exists(test_file))
     self.assertTrue(utils.run(['rm', test_file])[0])
     self.assertFalse(os.path.exists(test_file))
 def test_glancing_metadata_cern_cirros_import(self):
     # 12 MB
     mdfile = get_local_path('..', 'CERN', 'test_image_list')
     self.assertTrue(
         glancing.main([
             '-v', '-n',
             test_name(), '-c', mdfile, '-k',
             "deadbabe-f00d-beef-cafe-b1ab1ab1a666"
         ]))
 def test_glancing_metadata_cirros_import_no_cksum(self):
     # 12 MB
     mdfile = get_local_path('..', 'stratuslab', 'cirros_no_cksum.json')
     with devnull('stderr'):
         self.assertTrue(glancing.main(['-v', '-n', test_name(),
             mdfile, '-k']))
 def test_glancing_file_import_good_sum(self):
     self.assertTrue(
         glancing.main(
             ['-n',
              test_name(), self._CIRROS_FILE, '-S', self._CIRROS_MD5]))
 def test_glancing_image_import_name_force(self):
     self.assertTrue(
         glancing.main(
             ['-f', '-n',
              test_name(), self._TTYLINUX_FILE, '-s', '0' * 32]))
Beispiel #20
0
 def test_utils_vprint_lines_silent(self):
     self.vprint_lines_verbose(False, utils.test_name())
 def test_glancing_url_import_bad_md5(self):
     self.assertFalse(
         glancing.main(
             ['-n', test_name(), self._CIRROS_URL, '-s', '0' * 32]))
 def test_glancing_url_import_good_md5(self):
     self.assertTrue(glancing.main(['-n', test_name(),
         self._CIRROS_URL, '-s', self._CIRROS_MD5]))
 def test_glancing_url_import_bad_md5_but_force(self):
     self.assertTrue(glancing.main(['-f', '-n', test_name(),
         self._CIRROS_URL, '-s', '0' * 32]))
 def test_glancing_image_import_name(self):
     self.assertTrue(
         glancing.main([
             '-n',
             test_name(), self._TTYLINUX_FILE, '-s', self._TTYLINUX_MD5
         ]))
 def test_glancing_url_import_good_sum(self):
     self.assertTrue(
         glancing.main(
             ['-n',
              test_name(), self._CIRROS_URL, '-S', self._CIRROS_SUM]))
 def test_glancing_url_import_good_md5(self):
     self.assertTrue(
         glancing.main(
             ['-n',
              test_name(), self._CIRROS_URL, '-s', self._CIRROS_MD5]))
 def test_glancing_url_import_no_md5(self):
     self.assertTrue(glancing.main(['-n', test_name(), self._CIRROS_URL]))
 def test_glancing_url_import_bad_md5_but_force(self):
     self.assertTrue(
         glancing.main(
             ['-f', '-n',
              test_name(), self._CIRROS_URL, '-s', '0' * 32]))
 def test_glancing_metadata_cirros_import_bad_size(self):
     # 12 MB
     mdfile = get_local_path('..', 'stratuslab', 'cirros_bad_size.json')
     with devnull('stderr'):
         self.assertFalse(glancing.main(['-v', '-n', test_name(), mdfile]))
         self.assertTrue(glancing.main(['-f', '-n', test_name(), mdfile]))
 def test_glancing_url_import_bad_md5(self):
     self.assertFalse(glancing.main(['-n', test_name(),
         self._CIRROS_URL, '-s', '0' * 32]))
Beispiel #31
0
 def test_utils_vprint_lines_verbose(self):
     self.vprint_lines_verbose(True, utils.test_name())
 def test_glancing_url_import_no_md5(self):
     self.assertTrue(glancing.main(['-n', test_name(),
         self._CIRROS_URL]))
Beispiel #33
0
 def test_utils_test_name(self):
     self.assertEqual(utils.test_name(), 'test_utils_test_name')
 def test_glancing_url_import_good_sum(self):
     self.assertTrue(glancing.main(['-n', test_name(),
         self._CIRROS_URL, '-S', self._CIRROS_SUM]))
 def test_glancing_metadata_cirros_import_bad_size(self):
     # 12 MB
     mdfile = get_local_path('..', 'stratuslab', 'cirros_bad_size.json')
     with devnull('stderr'):
         self.assertFalse(glancing.main(['-v', '-n', test_name(), mdfile]))
         self.assertTrue(glancing.main(['-f', '-n', test_name(), mdfile]))
Beispiel #36
0
 def test_utils_vprint_lines_silent(self):
     self.vprint_lines_verbose(False, utils.test_name())
 def test_glancing_image_import_name(self):
     self.assertTrue(glancing.main(['-n', test_name(),
         self._TTYLINUX_FILE, '-s', self._TTYLINUX_MD5]))
 def test_glancing_image_import_name_bad_md5(self):
     self.assertFalse(glancing.main(['-n', test_name(),
         self._TTYLINUX_FILE, '-s', '0' * 32]))
 def test_glancing_image_import_name_force(self):
     self.assertTrue(glancing.main(['-f', '-n', test_name(),
         self._TTYLINUX_FILE, '-s', '0' * 32]))
Beispiel #40
0
 def test_utils_vprint_lines_verbose(self):
     self.vprint_lines_verbose(True, utils.test_name())
 def test_glancing_metadata_cern_cirros_import(self):
     # 12 MB
     mdfile = get_local_path('..', 'CERN', 'test_image_list')
     self.assertTrue(glancing.main(['-v', '-n', test_name(), '-c',
         mdfile, '-k', "deadbabe-f00d-beef-cafe-b1ab1ab1a666"]))
Beispiel #42
0
 def test_utils_test_name(self):
     self.assertEqual(utils.test_name(), 'test_utils_test_name')
 def test_glancing_image_import_name_bad_md5(self):
     self.assertFalse(
         glancing.main(
             ['-n', test_name(), self._TTYLINUX_FILE, '-s', '0' * 32]))
 def test_glancing_file_import_good_sum(self):
     self.assertTrue(glancing.main(['-n', test_name(),
         self._CIRROS_FILE, '-S', self._CIRROS_MD5]))
Beispiel #45
0
if len(answer_model) == 0:
    answer_model = model
if len(answer_n_nodes) == 0:
    answer_n_nodes = n_nodes
if len(answer_ranks_per_node) == 0:
    answer_ranks_per_node = ranks_per_node

# Turn the node model into the number of CPUs on those nodes
if answer_model == "bro":
    ncpus = "28"
else:
    raise ValueError("Model not supported yet")

# then validate these answers for type
try:
    utils.test_name(answer_model)
    utils.test_integer(answer_n_nodes)
    utils.test_integer(answer_ranks_per_node)
except ValueError:
    raise ValueError("These answers are not valid.")

# Then check whether the use picked an appropriate number of mpi tasks
# per node. It must evenly divide the number of cpus on the node
n_cpus_per_task = float(ncpus) / float(answer_ranks_per_node)
if int(n_cpus_per_task) != n_cpus_per_task:
    raise ValueError("Running {} MPI ranks per mode results in an "
                     "uneven number of cores per rank. Choose again."
                     "".format(answer_ranks_per_node))
n_cpus_per_task = str(int(n_cpus_per_task))

# Then we can go through and change things. We'll change things that we