def test_pfs_client_init_with_env_vars(monkeypatch): # GIVEN a Pachyderm deployment # WHEN environment variables are set for Pachyderm host and port monkeypatch.setenv('PACHD_SERVICE_HOST', 'pachd.example.com') monkeypatch.setenv('PACHD_SERVICE_PORT_API_GRPC_PORT', '12345') # AND a client is created without specifying a host or port client = pypachy.PfsClient() # THEN the GRPC channel should reflect the host and port specified in the environment variables assert client.channel._channel.target() == b'pachd.example.com:12345'
def pfs_client(): """Connect to Pachyderm before tests and reset to initial state after tests.""" # Setup : create a PfsClient instance client = pypachy.PfsClient() yield client # this is where the testing happens # Teardown : Delete all repos, commits, files, pipelines and jobs. This resets the cluster to its initial state. client.delete_all()
def pfs_client_with_repo(request): """Connect to Pachyderm before tests and reset to initial state after tests.""" # Setup : create a PfsClient instance and create a repository client = pypachy.PfsClient() client.create_repo(request.param.name, request.param.description) yield client, request.param # this is where the testing happens # Teardown : Delete all repos, commits, files, pipelines and jobs. This resets the cluster to its initial state. client.delete_all()
def __init__(self, filename, pattern, size, has_header=True, write_header=True, repo='', branch=''): self.filename = filename self.pattern = pattern self.size = size self.has_header = has_header self.write_header = write_header self._header = None self._length = None self._client = pypachy.PfsClient() self._files = [] self._repo = repo self._branch = branch
def test_pfs_client_init_with_args(): # GIVEN a Pachyderm deployment # WHEN a client is created with host and port arguments client = pypachy.PfsClient(host='pachd.example.com', port=54321) # THEN the GRPC channel should reflect the host and port specified in the arguments assert client.channel._channel.target() == b'pachd.example.com:54321'
def test_pfs_client_init_with_default_host_port(): # GIVEN a Pachyderm deployment # WHEN a client is created without specifying a host or port client = pypachy.PfsClient() # THEN the GRPC channel should reflect the default of localhost and port 30650 assert client.channel._channel.target() == b'localhost:30650'