generate

package
v1.3.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterRoleTests = []struct {
	//TestName - Name of the Test
	TestName string
	// ClusterRoleName - Name of the ClusterRole to be Created
	ClusterRoleName string
	// ClusterRoleBindingName - Name of the ClusterRoleBinding
	ClusterRoleBindingName string
	// ResourceNamespace - Namespace for which Resources are Created
	ResourceNamespace string
	// Clone - Set Clone Value
	Clone bool
	// CloneClusterRoleName
	ClonerClusterRoleName string
	// CloneClusterRoleBindingName
	ClonerClusterRoleBindingName string
	// CloneSourceRoleData - Source ClusterRole Name from which ClusterRole is Cloned
	CloneSourceClusterRoleData []byte
	// CloneSourceRoleBindingData - Source ClusterRoleBinding Name from which ClusterRoleBinding is Cloned
	CloneSourceClusterRoleBindingData []byte
	// CloneNamespace - Namespace where Roles are Cloned
	CloneNamespace string
	// Sync - Set Synchronize
	Sync bool
	// Data - The Yaml file of the ClusterPolicy of the ClusterRole and ClusterRoleBinding - ([]byte{})
	Data []byte
}{
	{
		TestName:               "test-clusterrole-clusterrolebinding-without-clone",
		ClusterRoleName:        "ns-cluster-role",
		ClusterRoleBindingName: "ns-cluster-role-binding",
		ResourceNamespace:      "test",
		Clone:                  false,
		Sync:                   false,
		Data:                   genClusterRoleYamlWithSync,
	},
	{
		TestName:               "test-clusterrole-clusterrolebinding-with-sync-without-clone",
		ClusterRoleName:        "ns-cluster-role",
		ClusterRoleBindingName: "ns-cluster-role-binding",
		ResourceNamespace:      "test",
		Clone:                  false,
		Sync:                   true,
		Data:                   genClusterRoleYamlWithSync,
	},
	{
		TestName:                          "test-clusterrole-clusterrolebinding-with-sync-with-clone",
		ClusterRoleName:                   "ns-cluster-role",
		ClusterRoleBindingName:            "ns-cluster-role-binding",
		ResourceNamespace:                 "test",
		Clone:                             true,
		ClonerClusterRoleName:             "base-cluster-role",
		ClonerClusterRoleBindingName:      "base-cluster-role-binding",
		CloneSourceClusterRoleData:        baseClusterRoleData,
		CloneSourceClusterRoleBindingData: baseClusterRoleBindingData,
		Sync:                              false,
		Data:                              genClusterRoleYamlWithSync,
	},
}

ClusterRoleTests - E2E Test Config for ClusterRole and ClusterRoleBinding

View Source
var RoleTests = []struct {
	//TestName - Name of the Test
	TestName string
	// RoleName - Name of the Role to be Created
	RoleName string
	// RoleBindingName - Name of the RoleBindingName
	RoleBindingName string
	// ResourceNamespace - Namespace for which Role and ReleBinding are Created
	ResourceNamespace string
	// Clone - Set Clone Value
	Clone bool
	// CloneSourceRoleData - Source Role Name from which Role is Cloned
	CloneSourceRoleData []byte
	// CloneSourceRoleBindingData - Source RoleBinding Name from which RoleBinding is Cloned
	CloneSourceRoleBindingData []byte
	// CloneNamespace - Namespace where Roles are Cloned
	CloneNamespace string
	// Sync - Set Synchronize
	Sync bool
	// Data - The Yaml file of the ClusterPolicy of the ROle and RoleBinding - ([]byte{})
	Data []byte
}{
	{
		TestName:          "test-role-rolebinding-without-clone",
		RoleName:          "ns-role",
		RoleBindingName:   "ns-role-binding",
		ResourceNamespace: "test",
		Clone:             false,
		Sync:              false,
		Data:              roleRoleBindingYamlWithSync,
	},
	{
		TestName:          "test-role-rolebinding-withsync-without-clone",
		RoleName:          "ns-role",
		RoleBindingName:   "ns-role-binding",
		ResourceNamespace: "test",
		Clone:             false,
		Sync:              true,
		Data:              roleRoleBindingYamlWithSync,
	},
	{
		TestName:                   "test-role-rolebinding-with-clone",
		RoleName:                   "ns-role",
		RoleBindingName:            "ns-role-binding",
		ResourceNamespace:          "test",
		Clone:                      true,
		CloneSourceRoleData:        sourceRoleYaml,
		CloneSourceRoleBindingData: sourceRoleBindingYaml,
		CloneNamespace:             "default",
		Sync:                       false,
		Data:                       roleRoleBindingYamlWithClone,
	},
}

RoleTests is E2E Test Config for Role and RoleBinding TODO:- Clone for Role and RoleBinding

Functions

func GetGVR

func GetGVR(group, version, resource string) schema.GroupVersionResource

GetGVR :- gets GroupVersionResource for dynamic client

func GetWithRetry

func GetWithRetry(sleepInterval time.Duration, retryCount int, retryFunc func() error) error

GetWithRetry :- Retry Operation till the end of retry or until it is Passed, retryCount is the Wait duration after each retry,

Types

type E2EClient

type E2EClient struct {
	Client dynamic.Interface
}

E2EClient ...

func NewE2EClient

func NewE2EClient() (*E2EClient, error)

NewE2EClient returns a new instance of E2EClient

func (*E2EClient) CleanClusterPolicies

func (e2e *E2EClient) CleanClusterPolicies(gvr schema.GroupVersionResource) error

CleanClusterPolicies ;- Deletes all the cluster policies

func (*E2EClient) CreateClusteredResource

func (e2e *E2EClient) CreateClusteredResource(gvr schema.GroupVersionResource, resourceData *unstructured.Unstructured) (*unstructured.Unstructured, error)

CreateClusteredResource ...

func (*E2EClient) CreateClusteredResourceYaml

func (e2e *E2EClient) CreateClusteredResourceYaml(gvr schema.GroupVersionResource, resourceData []byte) (*unstructured.Unstructured, error)

CreateClusteredResourceYaml creates cluster resources from YAML like Namespace, ClusterRole, ClusterRoleBinding etc ...

func (*E2EClient) CreateNamespacedResource

func (e2e *E2EClient) CreateNamespacedResource(gvr schema.GroupVersionResource, namespace string, resourceData *unstructured.Unstructured) (*unstructured.Unstructured, error)

CreateNamespacedResource ...

func (*E2EClient) CreateNamespacedResourceYaml

func (e2e *E2EClient) CreateNamespacedResourceYaml(gvr schema.GroupVersionResource, namespace string, resourceData []byte) (*unstructured.Unstructured, error)

CreateNamespacedResourceYaml creates namespaced resources like Pods, Services, Deployments etc

func (*E2EClient) DeleteClusteredResource

func (e2e *E2EClient) DeleteClusteredResource(gvr schema.GroupVersionResource, name string) error

DeleteClusteredResource ...

func (*E2EClient) DeleteNamespacedResource

func (e2e *E2EClient) DeleteNamespacedResource(gvr schema.GroupVersionResource, namespace, name string) error

DeleteNamespacedResource ...

func (*E2EClient) GetClusteredResource

func (e2e *E2EClient) GetClusteredResource(gvr schema.GroupVersionResource, name string) (*unstructured.Unstructured, error)

GetClusteredResource ...

func (*E2EClient) GetNamespacedResource

func (e2e *E2EClient) GetNamespacedResource(gvr schema.GroupVersionResource, namespace, name string) (*unstructured.Unstructured, error)

GetNamespacedResource ...

func (*E2EClient) ListNamespacedResources

func (e2e *E2EClient) ListNamespacedResources(gvr schema.GroupVersionResource, namespace string) (*unstructured.UnstructuredList, error)

ListNamespacedResources ...

Jump to

Keyboard shortcuts

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