Skip to content

Instantly share code, notes, and snippets.

@chanwit
Created August 2, 2022 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chanwit/d2725cdc52f49c585124769c25559448 to your computer and use it in GitHub Desktop.
Save chanwit/d2725cdc52f49c585124769c25559448 to your computer and use it in GitHub Desktop.
package run_test
import (
"context"
"sigs.k8s.io/controller-runtime/pkg/client"
)
type stateInstallDevBucketServer string
// mock controller-runtime client
type mockClientForInstallDevBucketServer struct {
client.Client
state stateInstallDevBucketServer
}
const (
stateUnknown stateInstallDevBucketServer = "unknown"
stateNotInstalled stateInstallDevBucketServer = "not-installed"
stateInstalled stateInstallDevBucketServer = "installed"
)
func (c *mockClientForInstallDevBucketServer) List(_ context.Context, list client.ObjectList, _ ...client.ListOption) error {
switch c.state {
case stateUnknown:
return nil
case stateNotInstalled:
return nil
case stateInstalled:
return nil
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment