Documentation
¶
Index ¶
- type Helper
- func (helper *Helper) CleanDB() error
- func (helper *Helper) ClearAllTables()
- func (helper *Helper) Count(table string) int64
- func (helper *Helper) CreateConsumer(name string) (*api.Consumer, error)
- func (helper *Helper) CreateConsumerList(count int) ([]*api.Consumer, error)
- func (helper *Helper) CreateConsumerWithLabels(name string, labels map[string]string) (*api.Consumer, error)
- func (helper *Helper) CreateGRPCAuthRule(ctx context.Context, kubeClient kubernetes.Interface, ...) error
- func (helper *Helper) CreateGRPCConn(serverAddr, serverCAFile, tokenFile string) (*grpc.ClientConn, error)
- func (helper *Helper) CreateJWTString(account *amv1.Account) string
- func (helper *Helper) CreateJWTToken(account *amv1.Account) *jwt.Token
- func (helper *Helper) CreateResource(consumerName, deployName, serviceAccount string, replicas int) (*api.Resource, error)
- func (helper *Helper) CreateResourceList(consumerName string, count int) ([]*api.Resource, error)
- func (helper *Helper) Delete(obj interface{})
- func (helper *Helper) DeleteAll(table interface{})
- func (helper *Helper) DeleteResource(id string) error
- func (helper *Helper) EncodeManifestBundle(manifestJSON, deployName, deployNamespace string) (datatypes.JSONMap, error)
- func (helper *Helper) Env() *environments.Env
- func (helper *Helper) HealthCheckURL(path string) string
- func (helper *Helper) MetricsURL(path string) string
- func (helper *Helper) MigrateDB() error
- func (helper *Helper) MigrateDBTo(migrationID string)
- func (helper *Helper) NewAccount(username, name, email string) *amv1.Account
- func (helper *Helper) NewApiClient() *openapi.APIClient
- func (helper *Helper) NewAuthenticatedContext(account *amv1.Account) context.Context
- func (helper *Helper) NewEvent(source, action, consumerName, resourceID, deployName string, ...) (*cloudevents.Event, error)
- func (helper *Helper) NewID() string
- func (helper *Helper) NewManifest(deployName, serviceAccount string, replicas int) workv1.Manifest
- func (helper *Helper) NewManifestJSON(deployName, serviceAccount string, replicas int) string
- func (helper *Helper) NewManifestWork(workName, deployName, serviceAccount string, replicas int) *workv1.ManifestWork
- func (helper *Helper) NewRandAccount() *amv1.Account
- func (helper *Helper) NewResource(consumerName, deployName, serviceAccount string, replicas int, ...) (*api.Resource, error)
- func (helper *Helper) NewUUID() string
- func (helper *Helper) OpenapiError(err error) openapi.Error
- func (helper *Helper) Reset()
- func (helper *Helper) ResetDB() error
- func (helper *Helper) RestURL(path string) string
- func (helper *Helper) RestartMetricsServer()
- func (helper *Helper) RestartServer()
- func (helper *Helper) SkipIfShort()
- func (helper *Helper) StartControllerManager(ctx context.Context)
- func (helper *Helper) StartGRPCResourceSourceClient()
- func (helper *Helper) StartJWKCertServerMock() (teardown func() error)
- func (helper *Helper) StartWorkAgent(ctx context.Context, clusterName string)
- func (helper *Helper) Teardown()
- func (helper *Helper) UpdateResource(resource *api.Resource) (*api.Resource, error)
- type MemoryStore
- func (s *MemoryStore) Add(resource *api.Resource)
- func (s *MemoryStore) Delete(resourceID string)
- func (s *MemoryStore) Get(resourceID string) (*api.Resource, error)
- func (s *MemoryStore) List(listOpts types.ListOptions) ([]*api.Resource, error)
- func (s *MemoryStore) ListByNamespace(namespace string) []*api.Resource
- func (s *MemoryStore) UpSert(resource *api.Resource)
- func (s *MemoryStore) Update(resource *api.Resource) error
- func (s *MemoryStore) UpdateStatus(resource *api.Resource) error
- type TimeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Helper ¶
type Helper struct { Ctx context.Context ContextCancelFunc context.CancelFunc Broker string EventBroadcaster *event.EventBroadcaster Store *MemoryStore GRPCSourceClient *generic.CloudEventSourceClient[*api.Resource] DBFactory db.SessionFactory AppConfig *config.ApplicationConfig APIServer server.Server MetricsServer server.Server HealthCheckServer *server.HealthCheckServer StatusDispatcher dispatcher.Dispatcher EventServer server.EventServer EventFilter controllers.EventFilter ControllerManager *server.ControllersServer WorkAgentHolder *work.ClientHolder WorkAgentInformer workv1informers.ManifestWorkInformer TimeFunc TimeFunc JWTPrivateKey *rsa.PrivateKey JWTCA *rsa.PublicKey T *testing.T // contains filtered or unexported fields }
func RegisterIntegration ¶
Register a test This should be run before every integration test
func (*Helper) ClearAllTables ¶
func (helper *Helper) ClearAllTables()
func (*Helper) CreateConsumer ¶
func (*Helper) CreateConsumerList ¶
func (*Helper) CreateConsumerWithLabels ¶
func (*Helper) CreateGRPCAuthRule ¶
func (*Helper) CreateGRPCConn ¶
func (helper *Helper) CreateGRPCConn(serverAddr, serverCAFile, tokenFile string) (*grpc.ClientConn, error)
func (*Helper) CreateJWTString ¶
func (*Helper) CreateJWTToken ¶
func (*Helper) CreateResource ¶
func (helper *Helper) CreateResource(consumerName, deployName, serviceAccount string, replicas int) (*api.Resource, error)
CreateResource creates a resource with the given consumer name, deploy name and replicas. It generates a deployment for nginx using the manifestJSON template, assigning a random deploy name to avoid conflicts.
func (*Helper) CreateResourceList ¶
CreateResourceList generates a list of resources with the specified consumer name and count. Each resource gets a randomly generated deploy name for nginx deployments to avoid conflicts.
func (*Helper) DeleteResource ¶
DeleteResource attempts to delete a resource and returns an error if it fails.
func (*Helper) EncodeManifestBundle ¶
func (helper *Helper) EncodeManifestBundle(manifestJSON, deployName, deployNamespace string) (datatypes.JSONMap, error)
EncodeManifestBundle converts resource manifest JSON into a CloudEvent JSONMap representation.
func (*Helper) Env ¶
func (helper *Helper) Env() *environments.Env
func (*Helper) HealthCheckURL ¶
func (*Helper) MetricsURL ¶
func (*Helper) MigrateDBTo ¶
func (*Helper) NewAccount ¶
func (*Helper) NewApiClient ¶
func (*Helper) NewAuthenticatedContext ¶
func (*Helper) NewEvent ¶
func (helper *Helper) NewEvent(source, action, consumerName, resourceID, deployName string, resourceVersion int64, replicas int) (*cloudevents.Event, error)
NewEvent creates a CloudEvent with the given source, action, consumer name, resource ID, deployment name, resource version, and replicas. It generates a nginx deployment using the manifestJSON template, assigning a random deploy name to avoid conflicts. If the action is "delete_request," the event includes a deletion timestamp.
func (*Helper) NewManifest ¶
NewManifest creats a manifest with the given deploy name and replicas. It generates a deployment for nginx using the manifestJSON template, assigning random deploy name to avoid conflicts.
func (*Helper) NewManifestJSON ¶
NewManifestJSON creates a resource manifest in JSON format with the given deploy name and replicas. It generates a deployment for nginx using the manifestJSON template, assigning a random deploy name to avoid conflicts.
func (*Helper) NewManifestWork ¶
func (helper *Helper) NewManifestWork(workName, deployName, serviceAccount string, replicas int) *workv1.ManifestWork
NewManifestWork creates a manifestwork with the given manifestwork name, deploy name and replicas. It generates a deployment for nginx using the manifestJSON template, assigning random manifestwork name and deploy name to avoid conflicts.
func (*Helper) NewRandAccount ¶
func (*Helper) NewResource ¶
func (helper *Helper) NewResource(consumerName, deployName, serviceAccount string, replicas int, resourceVersion int32) (*api.Resource, error)
NewResource creates a resource with the given consumer name, deploy name, replicas, and resource version.
func (*Helper) NewUUID ¶
NewUUID creates a new unique UUID, which has different formatting than ksuid UUID is used by telemeter and we validate the format.
func (*Helper) OpenapiError ¶
Convert an error response from the openapi client to an openapi error struct
func (*Helper) RestartMetricsServer ¶
func (helper *Helper) RestartMetricsServer()
func (*Helper) RestartServer ¶
func (helper *Helper) RestartServer()
func (*Helper) SkipIfShort ¶
func (helper *Helper) SkipIfShort()
func (*Helper) StartControllerManager ¶
func (*Helper) StartGRPCResourceSourceClient ¶
func (helper *Helper) StartGRPCResourceSourceClient()
func (*Helper) StartJWKCertServerMock ¶
func (*Helper) StartWorkAgent ¶
type MemoryStore ¶
func NewStore ¶
func NewStore() *MemoryStore
func (*MemoryStore) Add ¶
func (s *MemoryStore) Add(resource *api.Resource)
func (*MemoryStore) Delete ¶
func (s *MemoryStore) Delete(resourceID string)
func (*MemoryStore) List ¶
func (s *MemoryStore) List(listOpts types.ListOptions) ([]*api.Resource, error)
func (*MemoryStore) ListByNamespace ¶
func (s *MemoryStore) ListByNamespace(namespace string) []*api.Resource
func (*MemoryStore) UpSert ¶
func (s *MemoryStore) UpSert(resource *api.Resource)
func (*MemoryStore) UpdateStatus ¶
func (s *MemoryStore) UpdateStatus(resource *api.Resource) error