Documentation ¶
Index ¶
- func AssertBannedUser(t *testing.T, fakeClient *test.FakeClient, ...)
- func AssertCatalogSourceDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertCatalogSourceExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertCatalogSourceHasSpec(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertConfigMapDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertConfigMapExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertConfigMapHasData(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertConfigMapHasDataEntries(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertDeploymentHasReplicas(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertNoBannedUser(t *testing.T, fakeClient *test.FakeClient, ...)
- func AssertObjectDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertObjectExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertObjectHasContent(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertObjects(t *testing.T, fakeClient *test.FakeClient, objectAssertions ...ObjectAssertion)
- func AssertOperatorGroupDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertOperatorGroupExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertOperatorGroupHasLabels(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertOperatorGroupHasSpec(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertSecretDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertSecretExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertSecretHasData(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertSecretHasDataEntries(t *testing.T, fakeClient runtimeclient.Client, ...) map[string][]byte
- func AssertServiceAccountHasImagePullSecret(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertSubscriptionDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertSubscriptionExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertSubscriptionHasSpec(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertToolchainClusterDoesNotExist(t *testing.T, fakeClient *test.FakeClient, ...)
- func AssertToolchainClusterSpec(t *testing.T, fakeClient *test.FakeClient, ...)
- func AssertToolchainConfigDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertToolchainConfigExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertToolchainConfigHasSpec(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertUserSignupDoesNotExist(t *testing.T, fakeClient *test.FakeClient, ...)
- func AssertUserSignupSpec(t *testing.T, fakeClient *test.FakeClient, ...)
- func ClusterRolesBindings(namespacePermissionsPerClusterType assets.PermissionsPerClusterType, ...)
- func NewCommandCreator(t *testing.T, cmd string, expCmd string, assertArgs ArgsAssertion) client.CommandCreator
- func NewFakeClients(t *testing.T, initObjs ...runtime.Object) (clicontext.NewClientFunc, *test.FakeClient)
- func NewFakeExternalClient(t *testing.T, token string, apiEndpoint string) *rest.RESTClient
- func NewFakeFiles(t *testing.T, fakeFiles ...FakeFileCreator) assets.FS
- func NewKsctlConfig(clusterDefs ...ClusterDefinitionWithName) configuration.KsctlConfig
- func NewKubeSawAdmins(addClusters ClustersCreator, serviceAccounts []assets.ServiceAccount, ...) *assets.KubeSawAdmins
- func NewPermissionsPerClusterType(permissions ...PermissionsPerClusterTypeModifier) assets.PermissionsPerClusterType
- func NewToolchainCluster(modifiers ...ToolchainClusterModifier) *toolchainv1alpha1.ToolchainCluster
- func NewUserSignup(modifiers ...UserSignupModifier) *toolchainv1alpha1.UserSignup
- func RoleBindings(namespacePermissionsPerClusterType assets.PermissionsPerClusterType, ...)
- func ServiceAccounts(serviceAccountModifiers ...ServiceAccountCreator) []assets.ServiceAccount
- func SetFileConfig(t *testing.T, clusterDefs ...ClusterDefinitionWithName)
- func UserSignupCompleteCondition(status corev1.ConditionStatus, reason string) toolchainv1alpha1.Condition
- func Users(userCreators ...UserCreator) []assets.User
- type ArgsAssertion
- type ClusterDefinitionWithName
- type ClustersCreator
- type ConfigOption
- type FakeFileCreator
- type FakeTerminal
- type ObjectAssertion
- type PermissionsPerClusterTypeModifier
- func HostClusterRoleBindings(clusterRoles ...string) PermissionsPerClusterTypeModifier
- func HostRoleBindings(namespace string, modifiers ...RoleBindingsModifier) PermissionsPerClusterTypeModifier
- func MemberClusterRoleBindings(clusterRoles ...string) PermissionsPerClusterTypeModifier
- func MemberRoleBindings(namespace string, modifiers ...RoleBindingsModifier) PermissionsPerClusterTypeModifier
- type RoleBindingsModifier
- type ServiceAccountCreator
- type ToolchainClusterModifier
- type UserCreator
- type UserSignupModifier
- func UserSignupApprovedByAdmin(_ bool) UserSignupModifier
- func UserSignupAutomaticallyApproved(_ bool) UserSignupModifier
- func UserSignupCompliantUsername(username string) UserSignupModifier
- func UserSignupDeactivated(deactivated bool) UserSignupModifier
- func UserSignupRemoveLabel(key string) UserSignupModifier
- func UserSignupSetLabel(key, value string) UserSignupModifier
- func UserSignupStatusComplete(status corev1.ConditionStatus, reason string) UserSignupModifier
- func UserSignupTargetCluster(cluster string) UserSignupModifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertBannedUser ¶
func AssertBannedUser(t *testing.T, fakeClient *test.FakeClient, userSignup *toolchainv1alpha1.UserSignup)
func AssertCatalogSourceDoesNotExist ¶
func AssertCatalogSourceDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertCatalogSourceDoesNotExist verifies that there is no CatalogSource resource with the given namespace/name
func AssertCatalogSourceExists ¶
func AssertCatalogSourceExists(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertCatalogSourceExists verifies that the there is a CatalogSource resource matching the expected namespace/name
func AssertCatalogSourceHasSpec ¶
func AssertCatalogSourceHasSpec(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expected olmv1alpha1.CatalogSourceSpec)
AssertCatalogSourceHasSpec verifies that the there is a CatalogSource resource matching the expected namespace/name, and with the same specs.
func AssertConfigMapDoesNotExist ¶
func AssertConfigMapDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertConfigMapDoesNotExist verifies that there is no ConfigMap resource with the given namespace/name
func AssertConfigMapExists ¶
func AssertConfigMapExists(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertConfigMapExists verifies that the there is a ConfigMap resource matching the expected namespace/name
func AssertConfigMapHasData ¶
func AssertConfigMapHasData(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expected map[string]string)
AssertConfigMapHasData verifies that the there is a ConfigMap resource matching the expected namespace/name, and with the same data.
func AssertConfigMapHasDataEntries ¶
func AssertConfigMapHasDataEntries(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expectedEntries ...string)
AssertConfigMapHasDataEntries verifies that the there is a ConfigMap resource matching the expected namespace/name, and with the given entries in its `data`.
func AssertDeploymentHasReplicas ¶
func AssertDeploymentHasReplicas(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, replicas int32)
AssertDeploymentHasReplicas verifies that the there is a Deployment resource matching the expected namespace/name, and with the same spec.replicas.
func AssertNoBannedUser ¶
func AssertNoBannedUser(t *testing.T, fakeClient *test.FakeClient, userSignup *toolchainv1alpha1.UserSignup)
func AssertObjectDoesNotExist ¶
func AssertObjectDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, resource runtimeclient.Object)
AssertObjectDoesNotExist verifies that there is no resource of the given type and with the given namespace/name
func AssertObjectExists ¶
func AssertObjectExists(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, resource runtimeclient.Object)
AssertObjectExists verifies that there is a resource of the given type and with the given namespace/name
func AssertObjectHasContent ¶
func AssertObjectHasContent(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, actualResource runtimeclient.Object, contentAssertions ...func())
AssertObjectHasContent verifies that the there is a resource matching the expected namespace/name, and with the same specs.
func AssertObjects ¶
func AssertObjects(t *testing.T, fakeClient *test.FakeClient, objectAssertions ...ObjectAssertion)
AssertObjects executes all given object assertions
func AssertOperatorGroupDoesNotExist ¶
func AssertOperatorGroupDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertOperatorGroupDoesNotExist verifies that there is no OperatorGroup resource with the given namespace/name
func AssertOperatorGroupExists ¶
func AssertOperatorGroupExists(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertOperatorGroupExists verifies that the there is a OperatorGroup resource matching the expected namespace/name
func AssertOperatorGroupHasLabels ¶
func AssertOperatorGroupHasLabels(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expected map[string]string)
func AssertOperatorGroupHasSpec ¶
func AssertOperatorGroupHasSpec(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expected olmv1.OperatorGroupSpec)
AssertOperatorGroupHasSpec verifies that the there is an OperatorGroup resource matching the expected namespace/name, and with the same specs.
func AssertSecretDoesNotExist ¶
func AssertSecretDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertSecretDoesNotExist verifies that there is no Secret resource with the given namespace/name
func AssertSecretExists ¶
func AssertSecretExists(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertSecretExists verifies that the there is a Secret resource matching the expected namespace/name
func AssertSecretHasData ¶
func AssertSecretHasData(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expected map[string][]byte)
AssertSecretHasData verifies that the there is a Secret resource matching the expected namespace/name, and with the same data.
func AssertSecretHasDataEntries ¶
func AssertSecretHasDataEntries(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expectedEntries ...string) map[string][]byte
AssertSecretHasDataEntries verifies that the there is a Secret resource matching the expected namespace/name, and with the given entries in its `data`.
func AssertServiceAccountHasImagePullSecret ¶
func AssertServiceAccountHasImagePullSecret(t *testing.T, fakeClient runtimeclient.Client, saNamespacedName types.NamespacedName, secretName string)
func AssertSubscriptionDoesNotExist ¶
func AssertSubscriptionDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertSubscriptionDoesNotExist verifies that there is no Subscription resource with the given namespace/name
func AssertSubscriptionExists ¶
func AssertSubscriptionExists(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertSubscriptionExists verifies that the there is a Subscription resource matching the expected namespace/name
func AssertSubscriptionHasSpec ¶
func AssertSubscriptionHasSpec(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expected *olmv1alpha1.SubscriptionSpec)
AssertSubscriptionHasSpec verifies that the there is a Subscription resource matching the expected namespace/name, and with the same specs.
func AssertToolchainClusterDoesNotExist ¶
func AssertToolchainClusterDoesNotExist(t *testing.T, fakeClient *test.FakeClient, toolchainCluster *toolchainv1alpha1.ToolchainCluster)
func AssertToolchainClusterSpec ¶
func AssertToolchainClusterSpec(t *testing.T, fakeClient *test.FakeClient, expectedToolchainCluster *toolchainv1alpha1.ToolchainCluster)
func AssertToolchainConfigDoesNotExist ¶
func AssertToolchainConfigDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertToolchainConfigDoesNotExist verifies that there is no ToolchainConfig resource with the given namespace/name
func AssertToolchainConfigExists ¶
func AssertToolchainConfigExists(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName)
AssertToolchainConfigExists verifies that the there is an ToolchainConfig resource matching the expected namespace/name
func AssertToolchainConfigHasSpec ¶
func AssertToolchainConfigHasSpec(t *testing.T, fakeClient runtimeclient.Client, namespacedName types.NamespacedName, expected toolchainv1alpha1.ToolchainConfigSpec)
AssertToolchainConfigHasSpec verifies that there is an ToolchainConfig resource matching the expected namespace/name, and with the same spec.
func AssertUserSignupDoesNotExist ¶
func AssertUserSignupDoesNotExist(t *testing.T, fakeClient *test.FakeClient, userSignup *toolchainv1alpha1.UserSignup)
func AssertUserSignupSpec ¶
func AssertUserSignupSpec(t *testing.T, fakeClient *test.FakeClient, expectedUserSignup *toolchainv1alpha1.UserSignup)
func ClusterRolesBindings ¶
func ClusterRolesBindings(namespacePermissionsPerClusterType assets.PermissionsPerClusterType, clusterType configuration.ClusterType, clusterRoles ...string)
func NewCommandCreator ¶
func NewCommandCreator(t *testing.T, cmd string, expCmd string, assertArgs ArgsAssertion) client.CommandCreator
func NewFakeClients ¶
func NewFakeClients(t *testing.T, initObjs ...runtime.Object) (clicontext.NewClientFunc, *test.FakeClient)
func NewFakeExternalClient ¶
func NewFakeFiles ¶
func NewFakeFiles(t *testing.T, fakeFiles ...FakeFileCreator) assets.FS
func NewKsctlConfig ¶
func NewKsctlConfig(clusterDefs ...ClusterDefinitionWithName) configuration.KsctlConfig
NewKsctlConfig creates KsctlConfig object with the given cluster definitions
func NewKubeSawAdmins ¶
func NewKubeSawAdmins(addClusters ClustersCreator, serviceAccounts []assets.ServiceAccount, users []assets.User) *assets.KubeSawAdmins
func NewPermissionsPerClusterType ¶
func NewPermissionsPerClusterType(permissions ...PermissionsPerClusterTypeModifier) assets.PermissionsPerClusterType
func NewToolchainCluster ¶
func NewToolchainCluster(modifiers ...ToolchainClusterModifier) *toolchainv1alpha1.ToolchainCluster
func NewUserSignup ¶
func NewUserSignup(modifiers ...UserSignupModifier) *toolchainv1alpha1.UserSignup
func RoleBindings ¶
func RoleBindings(namespacePermissionsPerClusterType assets.PermissionsPerClusterType, clusterType configuration.ClusterType, namespace string, modifiers ...RoleBindingsModifier)
func ServiceAccounts ¶
func ServiceAccounts(serviceAccountModifiers ...ServiceAccountCreator) []assets.ServiceAccount
func SetFileConfig ¶
func SetFileConfig(t *testing.T, clusterDefs ...ClusterDefinitionWithName)
SetFileConfig generates the configuration file to use during a test The file is automatically cleanup at the end of the test.
func UserSignupCompleteCondition ¶
func UserSignupCompleteCondition(status corev1.ConditionStatus, reason string) toolchainv1alpha1.Condition
func Users ¶
func Users(userCreators ...UserCreator) []assets.User
Types ¶
type ArgsAssertion ¶
func AssertArgsEqual ¶
func AssertArgsEqual(expArgs ...string) ArgsAssertion
func AssertFirstArgPrefixRestEqual ¶
func AssertFirstArgPrefixRestEqual(firstArgPrefix string, toEqual ...string) ArgsAssertion
type ClusterDefinitionWithName ¶
type ClusterDefinitionWithName struct { configuration.ClusterAccessDefinition ClusterName string }
func Host ¶
func Host(options ...ConfigOption) ClusterDefinitionWithName
Host defines the configuration for the host cluster
func Member ¶
func Member(options ...ConfigOption) ClusterDefinitionWithName
Member defines the configuration for a member cluster
func WithValues ¶
func WithValues(clusterDef ClusterDefinitionWithName, options ...ConfigOption) ClusterDefinitionWithName
WithValues applies the options on the given parameters
type ClustersCreator ¶
func Clusters ¶
func Clusters(hostURL string) ClustersCreator
func (ClustersCreator) AddMember ¶
func (m ClustersCreator) AddMember(name, URL string) ClustersCreator
type ConfigOption ¶
type ConfigOption func(*ClusterDefinitionWithName)
ConfigOption an option on the configuration generated for a test
func ClusterName ¶
func ClusterName(clusterName string) ConfigOption
ClusterName specifies the name of the server (default is `host` or `member1`)
func ClusterType ¶
func ClusterType(clusterType string) ConfigOption
ClusterType specifies the cluster type (`host` or `member`)
func ServerAPI ¶
func ServerAPI(serverAPI string) ConfigOption
ServerAPI specifies the ServerAPI to use (default is `https://cool-server.com`)
func ServerName ¶
func ServerName(serverName string) ConfigOption
ServerName specifies the name of the server (default is `cool-server.com`)
type FakeFileCreator ¶
func FakeFile ¶
func FakeFile(path string, content []byte) FakeFileCreator
func FakeTemplate ¶
func FakeTemplate(path string, objects ...runtime.Object) FakeFileCreator
func FakeTemplateWithParams ¶
func FakeTemplateWithParams(path string, requiredParams []string, objects ...runtime.Object) FakeFileCreator
type FakeTerminal ¶
FakeTerminal a fake terminal, which can: - be configured to always return the same response when the command prompts the user for confirmation - capture the command output
func NewFakeTerminal ¶
func NewFakeTerminal() *FakeTerminal
NewFakeTerminal returns a new FakeTerminal which will only print messages in the console
func NewFakeTerminalWithResponse ¶
func NewFakeTerminalWithResponse(response string) *FakeTerminal
NewFakeTerminalWithResponse returns a new FakeTerminal which will print messages in the console and respond to the questions/confirmations with the given response
func (*FakeTerminal) Output ¶
func (t *FakeTerminal) Output() string
Output return the content of the output buffer
func (*FakeTerminal) Tee ¶
func (t *FakeTerminal) Tee(out io.Writer)
Tee uses the given `out` as a secondary output. Usage: `Tee(os.Stdout)` to see in the console what's record in this terminal during the tests Note: it should be configured at the beginning of a test
type ObjectAssertion ¶
type ObjectAssertion func(t *testing.T, fakeClient *test.FakeClient)
ObjectAssertion is a type of function that should assert a content of an object
func ObjectDoesNotExists ¶
func ObjectDoesNotExists(namespace, name string, actualResource runtimeclient.Object) ObjectAssertion
ObjectDoesNotExists checks that the given object does not exist
func ObjectExists ¶
func ObjectExists(namespace, name string, actualResource runtimeclient.Object, contentAssertion func(t *testing.T)) ObjectAssertion
ObjectExists checks that the given object exists and executes the given content assertion
type PermissionsPerClusterTypeModifier ¶
type PermissionsPerClusterTypeModifier func(assets.PermissionsPerClusterType)
func HostClusterRoleBindings ¶
func HostClusterRoleBindings(clusterRoles ...string) PermissionsPerClusterTypeModifier
func HostRoleBindings ¶
func HostRoleBindings(namespace string, modifiers ...RoleBindingsModifier) PermissionsPerClusterTypeModifier
func MemberClusterRoleBindings ¶
func MemberClusterRoleBindings(clusterRoles ...string) PermissionsPerClusterTypeModifier
func MemberRoleBindings ¶
func MemberRoleBindings(namespace string, modifiers ...RoleBindingsModifier) PermissionsPerClusterTypeModifier
type RoleBindingsModifier ¶
type RoleBindingsModifier func(*assets.RoleBindings)
func ClusterRole ¶
func ClusterRole(clusterRoles ...string) RoleBindingsModifier
func Role ¶
func Role(roles ...string) RoleBindingsModifier
type ServiceAccountCreator ¶
type ServiceAccountCreator func() assets.ServiceAccount
func Sa ¶
func Sa(baseName, namespace string, permissions ...PermissionsPerClusterTypeModifier) ServiceAccountCreator
type ToolchainClusterModifier ¶
type ToolchainClusterModifier func(toolchainCluster *toolchainv1alpha1.ToolchainCluster)
func ToolchainClusterName ¶
func ToolchainClusterName(name string) ToolchainClusterModifier
type UserCreator ¶
func User ¶
func User(name string, IDs []string, group string, permissions ...PermissionsPerClusterTypeModifier) UserCreator
type UserSignupModifier ¶
type UserSignupModifier func(userSignup *toolchainv1alpha1.UserSignup)
func UserSignupApprovedByAdmin ¶
func UserSignupApprovedByAdmin(_ bool) UserSignupModifier
func UserSignupAutomaticallyApproved ¶
func UserSignupAutomaticallyApproved(_ bool) UserSignupModifier
func UserSignupCompliantUsername ¶
func UserSignupCompliantUsername(username string) UserSignupModifier
func UserSignupDeactivated ¶
func UserSignupDeactivated(deactivated bool) UserSignupModifier
func UserSignupRemoveLabel ¶
func UserSignupRemoveLabel(key string) UserSignupModifier
func UserSignupSetLabel ¶
func UserSignupSetLabel(key, value string) UserSignupModifier
func UserSignupStatusComplete ¶
func UserSignupStatusComplete(status corev1.ConditionStatus, reason string) UserSignupModifier
func UserSignupTargetCluster ¶
func UserSignupTargetCluster(cluster string) UserSignupModifier