Beispiel #1
0
 def test_validate_good_cluster(self):
     client_workers = [
         ClientWorker('10.0.0.0', 'n1-standard-16', 'europe-west4-a'),
         ClientWorker('10.0.0.1', 'n1-standard-16', 'europe-west4-a'),
         ClientWorker('10.0.0.2', 'n1-standard-16', 'europe-west4-a'),
         ClientWorker('10.0.0.3',
                      'n1-standard-16',
                      'europe-west4-a',
                      hostname='test'),
     ]
     service_workers = [
         ServiceWorker('10.0.0.0', 'v3-32', 'europe-west4-a'),
         ServiceWorker('10.0.0.1', 'v3-32', 'europe-west4-a'),
         ServiceWorker('10.0.0.2', 'v3-32', 'europe-west4-a'),
         ServiceWorker('10.0.0.3', 'v3-32', 'europe-west4-a'),
     ]
     cluster = Cluster(client_workers, service_workers)
     cluster.validate()  # Does not raise exception
Beispiel #2
0
    def test_validate_machine_type_client_cluster(self):
        client_workers = [
            ClientWorker('10.0.0.0', 'n1-standard-16', 'europe-west4-a'),
            ClientWorker('10.0.0.1', 'n1-standard-8', 'europe-west4-a'),
        ]
        service_workers = [
            ServiceWorker('10.0.0.0', 'v3-8', 'europe-west4-a'),
            ServiceWorker('10.0.0.1', 'v3-8', 'europe-west4-a'),
        ]

        no_check_cluster = Cluster(client_workers,
                                   service_workers,
                                   check_client_machine_type=False)
        no_check_cluster.validate()  # Does not raise exception

        check_cluster = Cluster(client_workers, service_workers)
        self.assertRaisesRegex(
            RuntimeError, 'All client_workers must have the same machine_type',
            check_cluster.validate)