def test_it_errors_when_given_a_negative_number_of_worker_pods(self): with pytest.raises(ValueError, match="positive number of pods"): zelt.deploy( locustfile="a_locustfile", worker_pods=-1, manifests_path="some_manifests", clean=False, storage_method=StorageMethod.CONFIGMAP, local=False, )
def test_it_exits_when_not_given_manifests(self): with pytest.raises(ValueError, match="[Mm]issing required"): zelt.deploy( locustfile="a_locustfile", worker_pods=0, manifests_path=None, clean=False, storage_method=StorageMethod.CONFIGMAP, local=False, )
def test_it_deploys_locust_in_kubernetes_when_given_manifests( self, deploy_in_kubernetes): zelt.deploy( locustfile="a_locustfile", worker_pods=0, manifests_path="some_manifests", clean=False, storage_method=StorageMethod.CONFIGMAP, local=False, ) deploy_in_kubernetes.assert_called_once()
def test_it_defaults_to_deploying_locally_when_given_manifest_and_local_options( self, subprocess): zelt.deploy( locustfile="a_locustfile", worker_pods=0, manifests_path="some_manifests", clean=False, storage_method=StorageMethod.CONFIGMAP, local=True, ) subprocess.assert_called_once()
def test_it_does_not_clean_before_deployment_when_not_given_clean_option( self, _cm_init, _from_dir, delete, create): zelt.deploy( locustfile="a_locustfile", worker_pods=0, manifests_path="some_manifests", clean=False, storage_method=StorageMethod.CONFIGMAP, local=False, ) delete.assert_not_called() create.assert_called_once()
def _deploy(config: Config) -> None: """ Deploys Locust. """ try: zelt.deploy( config.locustfile, int(config.worker_pods), config.manifests, config.clean, StorageMethod.from_storage_arg(config.storage), config.local, config.s3_bucket, config.s3_key, ) except Exception as e: logging.fatal("Error: %s", e) exit(1)