util

package
v3.7.0-0.172.0+incompa... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2017 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyCachePollInterval = 100 * time.Millisecond
	PolicyCachePollTimeout  = 5 * time.Second
)

Variables

This section is empty.

Functions

func CleanupServiceAndPod added in v0.4.2

func CleanupServiceAndPod(pod *kapi.Pod, service *kapi.Service, ns string)

CleanupServiceAndPod removes the Service and the Pod

func CreateNamespace added in v0.4.4

func CreateNamespace(clusterAdminKubeConfig, name string) (err error)

CreateNamespace creates a namespace with the specified name using the provided kubeconfig DO NOT USE, use create project instead

func CreatePodFromImage added in v0.4.2

func CreatePodFromImage(stream *imageapi.ImageStream, tag, ns string) *kapi.Pod

CreatePodFromImage creates a Pod from the latest image available in the Image Stream

func CreateServiceForPod added in v0.4.2

func CreateServiceForPod(pod *kapi.Pod, ns string) *kapi.Service

CreateServiceForPod creates a service to serve the provided Pod

func DeleteAndWaitForNamespaceTermination added in v1.1.5

func DeleteAndWaitForNamespaceTermination(c kclientset.Interface, name string) error

func DumpEtcdOnFailure added in v1.3.0

func DumpEtcdOnFailure(t *testing.T, etcd2 etcdclient.Client, etcd3 *etcdclientv3.Client)

func GetBaseDir added in v0.4.2

func GetBaseDir() string

GetBaseDir returns the base directory used for test.

func GetClientForServiceAccount added in v1.0.7

func GetClientForServiceAccount(adminClient kclientset.Interface, clientConfig restclient.Config, namespace, name string) (*kclientset.Clientset, *restclient.Config, error)

func GetClientForUser added in v0.6.1

func GetClientForUser(clientConfig *restclient.Config, username string) (kclientset.Interface, *restclient.Config, error)

func GetClusterAdminClientConfig added in v0.4.2

func GetClusterAdminClientConfig(adminKubeConfigFile string) (*restclient.Config, error)

func GetClusterAdminClientConfigOrDie

func GetClusterAdminClientConfigOrDie(adminKubeConfigFile string) *restclient.Config

GetClusterAdminClientConfigOrDie returns a REST config for the cluster admin user or panic.

func GetClusterAdminKubeClient added in v0.4.2

func GetClusterAdminKubeClient(adminKubeConfigFile string) (kclientset.Interface, error)

func GetEtcdURL added in v0.4.2

func GetEtcdURL() string

func GetImageFixture added in v1.3.0

func GetImageFixture(filename string) (*imageapi.Image, error)

func GetScopedClientForUser added in v1.3.0

func GetScopedClientForUser(clusterAdminClientConfig *restclient.Config, username string, scopes []string) (kclientset.Interface, *restclient.Config, error)

func GetTemplateFixture added in v1.0.7

func GetTemplateFixture(filename string) (*templateapi.Template, error)

func KubeConfigPath added in v0.4.2

func KubeConfigPath() string

func MakeNewEtcd3Client

func MakeNewEtcd3Client() (*etcdclientv3.Client, error)

func MakeNewEtcdClient added in v1.1.3

func MakeNewEtcdClient() (etcdclient.Client, error)

func Namespace added in v0.4.2

func Namespace() string

Namespace returns the test namespace. The default namespace is set to 'integration-test'. You can override it by setting the 'OS_TEST_NAMESPACE' environment variable

func NewDockerClient added in v0.4.2

func NewDockerClient() (*dockerClient.Client, error)

newDockerClient creates a docker client using the env var DOCKER_ENDPOINT or, if not supplied, uses the default docker endpoint /var/run/docker.sock

func NewEtcd3Client

func NewEtcd3Client() *etcdclientv3.Client

func NewEtcdClient added in v0.4.2

func NewEtcdClient() etcdclient.Client

func NewTestLDAPServer added in v1.0.2

func NewTestLDAPServer() *testLDAPServer

func RandomNamespace added in v0.4.2

func RandomNamespace(prefix string) string

RandomNamespace provides random Kubernetes namespace name based on the UNIX timestamp. Optionally you can set the prefix.

func RequireDocker added in v0.4.2

func RequireDocker()

RequireDocker ensures that a new docker client can be created and that a ListImages command can be run on the client or it fails with glog.Fatal

func VerifyImage added in v0.4.2

func VerifyImage(stream *imageapi.ImageStream, tag, ns string, validator ValidateFunc) error

VerifyImage verifies if the latest image in given ImageStream is valid

func WaitForAddress added in v0.4.2

func WaitForAddress(pod *kapi.Pod, service *kapi.Service, ns string) (string, error)

WaitForAddress waits for the Pod to be running and then for the Service to get the endpoint.

func WaitForClusterPolicyUpdate added in v1.0.6

func WaitForClusterPolicyUpdate(c authorizationtypedclient.SelfSubjectAccessReviewsGetter, verb string, resource schema.GroupResource, allowed bool) error

WaitForClusterPolicyUpdate checks if the given client can perform the named verb and action. If PolicyCachePollTimeout is reached without the expected condition matching, an error is returned

func WaitForPolicyUpdate added in v1.0.1

func WaitForPolicyUpdate(c authorizationtypedclient.SelfSubjectAccessReviewsGetter, namespace, verb string, resource schema.GroupResource, allowed bool) error

WaitForPolicyUpdate checks if the given client can perform the named verb and action. If PolicyCachePollTimeout is reached without the expected condition matching, an error is returned

func WaitForResourceQuotaLimitSync added in v1.3.0

func WaitForResourceQuotaLimitSync(
	client kcoreclient.ResourceQuotaInterface,
	name string,
	hardLimit kapi.ResourceList,
	timeout time.Duration,
) error

WaitForResourceQuotaSync watches given resource quota until its hard limit is updated to match the desired spec or timeout occurs.

Types

type EtcdTestServer

type EtcdTestServer struct {
	*etcdtest.EtcdTestServer
}

func RequireEtcd added in v0.4.2

func RequireEtcd(t *testing.T) EtcdTestServer

RequireEtcd verifies if the etcd is running and accessible for testing

func RequireEtcd2

func RequireEtcd2(t *testing.T) EtcdTestServer

RequireEtcd verifies if the etcd is running and accessible for testing TODO: remove use of etcd2 specific apis in 1.6

func (EtcdTestServer) DumpEtcdOnFailure

func (s EtcdTestServer) DumpEtcdOnFailure(t *testing.T)

type ValidateFunc added in v0.4.2

type ValidateFunc func(string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL