Documentation ¶
Index ¶
- func AssertBannedUser(t *testing.T, fakeClient *test.FakeClient, ...)
- func AssertCatalogSourceExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertCatalogSourceHasSpec(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 AssertOperatorGroupDoesNotExist(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertOperatorGroupExists(t *testing.T, fakeClient runtimeclient.Client, ...)
- func AssertOperatorGroupHasLabels(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 AssertUserSignupDoesNotExist(t *testing.T, fakeClient *test.FakeClient, ...)
- func AssertUserSignupSpec(t *testing.T, fakeClient *test.FakeClient, ...)
- func ClusterRolesBindings(namespacePermissionsPerClusterType assets.PermissionsPerClusterType, ...)
- func HostKubeConfig() *clientcmdapi.Config
- func MemberKubeConfig() *clientcmdapi.Config
- func NewCommandCreator(t *testing.T, cmd string, expCmd string, assertArgs ArgsAssertion) client.CommandCreator
- func NewFakeClients(t *testing.T, initObjs ...runtimeclient.Object) (clicontext.NewClientFunc, *test.FakeClient)
- 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 PersistKubeConfigFile(t *testing.T, config *clientcmdapi.Config) string
- func RoleBindings(namespacePermissionsPerClusterType assets.PermissionsPerClusterType, ...)
- func ServiceAccounts(serviceAccountModifiers ...ServiceAccountCreator) []assets.ServiceAccount
- func SetFileConfig(t *testing.T, clusterDefs ...ClusterDefinitionWithName)
- func Users(userCreators ...UserCreator) []assets.User
- type ArgsAssertion
- type ClusterDefinitionWithName
- type ClustersCreator
- type ConfigOption
- type FakeFileCreator
- type FakeTerminal
- type MemberClusterOption
- 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertBannedUser ¶
func AssertBannedUser(t *testing.T, fakeClient *test.FakeClient, userSignup *toolchainv1alpha1.UserSignup, banReason string)
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 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 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 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 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 HostKubeConfig ¶
func HostKubeConfig() *clientcmdapi.Config
func MemberKubeConfig ¶
func MemberKubeConfig() *clientcmdapi.Config
func NewCommandCreator ¶
func NewCommandCreator(t *testing.T, cmd string, expCmd string, assertArgs ArgsAssertion) client.CommandCreator
func NewFakeClients ¶
func NewFakeClients(t *testing.T, initObjs ...runtimeclient.Object) (clicontext.NewClientFunc, *test.FakeClient)
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 PersistKubeConfigFile ¶
func PersistKubeConfigFile(t *testing.T, config *clientcmdapi.Config) string
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 Users ¶
func Users(userCreators ...UserCreator) []assets.User
Types ¶
type 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, options ...MemberClusterOption) 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 MemberClusterOption ¶
type MemberClusterOption func(*assets.MemberCluster)
func WithSeparateKustomizeComponent ¶
func WithSeparateKustomizeComponent() MemberClusterOption
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
func (ServiceAccountCreator) WithSelectedMembers ¶
func (c ServiceAccountCreator) WithSelectedMembers(members ...string) ServiceAccountCreator
func (ServiceAccountCreator) WithSkippedMembers ¶
func (c ServiceAccountCreator) WithSkippedMembers(members ...string) 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, allCluster bool, group string, permissions ...PermissionsPerClusterTypeModifier) UserCreator
func (UserCreator) WithSelectedMembers ¶
func (c UserCreator) WithSelectedMembers(members ...string) UserCreator
func (UserCreator) WithSkippedMembers ¶
func (c UserCreator) WithSkippedMembers(members ...string) UserCreator
type UserSignupModifier ¶
type UserSignupModifier func(userSignup *toolchainv1alpha1.UserSignup)
func UserSignupApprovedByAdmin ¶
func UserSignupApprovedByAdmin(_ bool) UserSignupModifier
func UserSignupAutomaticallyApproved ¶
func UserSignupAutomaticallyApproved(_ bool) UserSignupModifier
func UserSignupDeactivated ¶
func UserSignupDeactivated(deactivated bool) UserSignupModifier
func UserSignupRemoveLabel ¶
func UserSignupRemoveLabel(key string) UserSignupModifier