예제 #1
0
 def test_programmatic(self):
     conf = Configuration()
     conf.add_machine_conf(
         MachineConfiguration(roles=["r1"],
                              flavour=constants.FLAVOURS["large"],
                              number=10,
                              cluster="test-cluster"))
     conf.finalize()
     self.assertEqual(1, len(conf.machines))
     # default networks
     self.assertEqual(constants.DEFAULT_NETWORKS, conf.networks)
예제 #2
0
    def test_do_build_g5k_conf(self, mock_find_node_number):
        conf = Configuration()
        conf.add_machine(roles=["r1"], cluster="cluster1", number=10, flavour="tiny")
        conf.finalize()
        g5k_conf = _do_build_g5k_conf(conf, "rennes")
        # it's valid
        g5k_conf.finalize()

        # machines
        self.assertEqual(1, len(g5k_conf.machines))
        machine = g5k_conf.machines[0]
        self.assertEqual("cluster1", machine.cluster)
        self.assertEqual(2, machine.nodes)
        # role have been expanded with the unique cookie
        self.assertEqual(2, len(machine.roles))

        # networks
        self.assertEqual(2, len(g5k_conf.networks))
        self.assertTrue(g5k_conf.networks[0].type in ["prod", "slash_22"])
        self.assertTrue(g5k_conf.networks[1].type in ["prod", "slash_22"])
예제 #3
0
 def test_programmatic_missing_keys(self):
     conf = Configuration()
     conf.add_machine_conf(MachineConfiguration())
     with self.assertRaises(jsonschema.exceptions.ValidationError) as _:
         conf.finalize()