MODULE

PYTEST_HELM_CHARTS.CLUSTERS

This module introduces classes for handling different clusters.

Classes
  • Cluster(kube_config_path) Represents an abstract cluster.</>
  • ExistingCluster Implementation of Cluster that uses kube.config file to connect to external existing cluster.</>
abstract class

pytest_helm_charts.clusters.Cluster(kube_config_path=None)

Represents an abstract cluster.

Parameters
  • kube_config_path (str, optional)
Attributes
  • _kube_client
  • kube_client (HTTPClient, optional) Returns the HTTP client you can use to access Kubernetes API of the cluster under test.
    Please refer to pykube to get docs for HTTPClient.</>
  • kube_config_path
Methods
  • create() (HTTPClient) Creates an instance of a cluster and returns HTTPClient to connect to it.</>
  • destroy() Destroys the cluster created earlier with a call to create.</>
  • kubectl(subcmd_string, std_input, output_format, **kwargs) (any) If your cluster delivers the kube.config file, run a kubectl command against the cluster and return the output. Otherwise, exception is raised.</>
abstract method

create() → HTTPClient

Creates an instance of a cluster and returns HTTPClient to connect to it.

abstract method

destroy()

Destroys the cluster created earlier with a call to create.

method

kubectl(subcmd_string, std_input='', output_format='json', **kwargs) → any

If your cluster delivers the kube.config file, run a kubectl command against the cluster and return the output. Otherwise, exception is raised.

Parameters
  • subcmd_string (str)
  • std_input (str, optional)
  • output_format (str, optional)
  • **kwargs (str)
class

pytest_helm_charts.clusters.ExistingCluster(kube_config_path)

Implementation of Cluster that uses kube.config file to connect to external existing cluster.

Parameters
  • kube_config_path (str)
Attributes
  • _kube_client
  • kube_client (HTTPClient, optional) Returns the HTTP client you can use to access Kubernetes API of the cluster under test.
    Please refer to pykube to get docs for HTTPClient.</>
  • kube_config_path
Methods
  • create() (HTTPClient) Creates an instance of a cluster and returns HTTPClient to connect to it.</>
  • destroy() Destroys the cluster created earlier with a call to create.</>
  • kubectl(subcmd_string, std_input, output_format, **kwargs) (any) If your cluster delivers the kube.config file, run a kubectl command against the cluster and return the output. Otherwise, exception is raised.</>
method

kubectl(subcmd_string, std_input='', output_format='json', **kwargs) → any

If your cluster delivers the kube.config file, run a kubectl command against the cluster and return the output. Otherwise, exception is raised.

Parameters
  • subcmd_string (str)
  • std_input (str, optional)
  • output_format (str, optional)
  • **kwargs (str)
method

create() → HTTPClient

Creates an instance of a cluster and returns HTTPClient to connect to it.

method

destroy()

Destroys the cluster created earlier with a call to create.