def test_dump_configuration_busy(database_connection): magic_castle = MagicCastle(database_connection, "missingfloatingips.c3.ca") assert magic_castle.dump_configuration() == { "cluster_name": "missingfloatingips", "domain": "c3.ca", "image": "CentOS-7-x64-2019-07", "nb_users": 17, "instances": { "mgmt": { "type": "p4-6gb", "count": 1 }, "login": { "type": "p4-6gb", "count": 1 }, "node": { "type": "p2-3gb", "count": 3 }, }, "storage": { "type": "nfs", "home_size": 50, "project_size": 1, "scratch_size": 1, }, "public_keys": [""], "hieradata": "", "guest_passwd": "password-123", "os_floating_ips": ["Automatic allocation"], }
def test_dump_configuration_not_found(database_connection): magic_castle = MagicCastle(database_connection) with pytest.raises(ClusterNotFoundException): magic_castle.dump_configuration()
def test_dump_configuration_missing_nodes(database_connection): magic_castle = MagicCastle(database_connection, "missingnodes.sub.example.com") assert magic_castle.dump_configuration(planned_only=True) == { "cluster_name": "missingnodes", "nb_users": 10, "guest_passwd": "password-123", "storage": { "type": "nfs", "home_size": 100, "scratch_size": 50, "project_size": 50, }, "instances": { "mgmt": { "type": "p4-6gb", "count": 1 }, "login": { "type": "p4-6gb", "count": 1 }, "node": { "type": "p2-3gb", "count": 1 }, }, "domain": "sub.example.com", "hieradata": "", "public_keys": [""], "image": "CentOS-7-x64-2019-07", "os_floating_ips": ["100.101.102.103"], } assert magic_castle.dump_configuration(planned_only=False) == { "cluster_name": "missingnodes", "nb_users": 10, "guest_passwd": "password-123", "storage": { "type": "nfs", "home_size": 100, "scratch_size": 50, "project_size": 50, }, "instances": { "mgmt": { "type": "", "count": 0 }, "login": { "type": "", "count": 0 }, "node": { "type": "", "count": 0 }, }, "domain": "sub.example.com", "hieradata": "", "public_keys": ["ssh-rsa FAKE"], "image": "CentOS-7-x64-2019-07", "os_floating_ips": ["100.101.102.103"], }
def test_dump_configuration_empty(database_connection): magic_castle = MagicCastle(database_connection, "empty.calculquebec.cloud") assert magic_castle.dump_configuration() == dict()