Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithAuthorizedID(ctx context.Context, clusterID string) context.Context
- func CreateRandomSetOfEndpoints() map[string]*alertingv1.FullAttachedEndpoint
- func DownloadCertManagerCRDs(scheme *runtime.Scheme) []*apiextensionsv1.CustomResourceDefinition
- func EnableIfCI[T any](decorator T) any
- func ExpectAlertManagerConfigToBeValid(env *Environment, tmpWritePath string, writeFile string, ctx context.Context, ...)
- func ExpectConfigEqual(c1, c2 *config.Config, name ...string)
- func ExpectConfigNotEqual(c1, c2 *config.Config, name ...string)
- func ExpectRouterEqual(r1, r2 routing.OpniRouting, name ...string)
- func ExpectRouterNotEqual(r1, r2 routing.OpniRouting, name ...string)
- func ExpectRuleGroupToExist(client cortexadmin.CortexAdminClient, ctx context.Context, tenant string, ...)
- func ExpectToRecoverConfig(router routing.OpniRouting, name ...string)
- func GenerateEndpoint(genId int, uuid string) *alertingv1.FullAttachedEndpoint
- func IfIntegration(f func())
- func IfLabelFilterMatches(labels ginkgo.Labels, f func())
- func InjectStorageError(ctx context.Context, err error) context.Context
- func InjectedStorageError(ctx context.Context) (error, bool)
- func LoadPlugins(loader *plugins.PluginLoader, mode meta.PluginMode) int
- func NewApiExtensionTestPlugin(srv apiextensions.ManagementAPIExtensionServer, svcDesc *grpc.ServiceDesc, ...) *plugin.ClientConfig
- func NewOverridePrometheusConfig(configPath string, jobs []PrometheusJob) *overridePrometheusConfig
- func NewTestCapabilityBackend(ctrl *gomock.Controller, capBackend *CapabilityInfo) capabilityv1.BackendClient
- func NewTestClusterStore(ctrl *gomock.Controller) storage.ClusterStore
- func NewTestFinder(ctrl *gomock.Controller, groups func() []rules.RuleGroup) notifier.Finder[rules.RuleGroup]
- func NewTestIdentProvider(ctrl *gomock.Controller, id string) ident.Provider
- func NewTestKeyValueStore[T any](ctrl *gomock.Controller, clone func(T) T) storage.KeyValueStoreT[T]
- func NewTestKeyValueStoreBroker(ctrl *gomock.Controller) storage.KeyValueStoreBroker
- func NewTestKeyringStore(ctrl *gomock.Controller, prefix string, ref *corev1.Reference) storage.KeyringStore
- func NewTestKeyringStoreBroker(ctrl *gomock.Controller, handler ...KeyringStoreHandler) storage.KeyringStoreBroker
- func NewTestRBACStore(ctrl *gomock.Controller) storage.RBACStore
- func NewTestStorageBackend(ctx context.Context, ctrl *gomock.Controller) storage.Backend
- func NewTestTokenStore(ctx context.Context, ctrl *gomock.Controller) storage.TokenStore
- func RandomName(seed int64) string
- func RunTestEnvironment(testEnv *envtest.Environment, runControllerManager bool, externalEnv bool, ...) (stop context.CancelFunc, k8sManager ctrl.Manager, k8sClient client.Client)
- func StandaloneHttpRequest(method string, url string, requestBody []byte, values url.Values, ...) (code int, body []byte, err error)
- func StartControllerManager(ctx context.Context, testEnv *envtest.Environment)
- func StartStandaloneTestEnvironment(opts ...EnvironmentOption)
- func TestData(filename string) []byte
- type AlarmPair
- type AlertingServerUnit
- type BenchRunner
- type CapabilityInfo
- type CrossDeviceTestFs
- type DefaultNamespaceSubTreeTestcase
- type Environment
- func (e *Environment) Context() context.Context
- func (e *Environment) CortexTLSConfig() *tls.Config
- func (e *Environment) CreateWebhookServer(parentCtx context.Context, num int) []*MockIntegrationWebhookServer
- func (e *Environment) EtcdClient() (*clientv3.Client, error)
- func (e *Environment) EtcdConfig() *v1beta1.EtcdStorageSpec
- func (e *Environment) GatewayConfig() *v1beta1.GatewayConfig
- func (e *Environment) GatewayTLSConfig() *tls.Config
- func (e *Environment) GenerateNewTempDirectory(prefix string) string
- func (e *Environment) GetAgent(id string) RunningAgent
- func (e *Environment) GetAlertingManagementWebhookEndpoint() string
- func (e *Environment) JetStreamConfig() *v1beta1.JetStreamStorageSpec
- func (e *Environment) ManagementClientConn() grpc.ClientConnInterface
- func (e *Environment) NewAlertConditionsClient() alertingv1.AlertConditionsClient
- func (e *Environment) NewAlertEndpointsClient() alertingv1.AlertEndpointsClient
- func (e *Environment) NewAlertNotificationsClient() alertingv1.AlertNotificationsClient
- func (e *Environment) NewAlertOpsClient() alertops.AlertingAdminClient
- func (e *Environment) NewBenchRunner(agent string, desc bench.WorkloadDesc) (*BenchRunner, error)
- func (e *Environment) NewCortexAdminClient() cortexadmin.CortexAdminClient
- func (e *Environment) NewCortexOpsClient() cortexops.CortexOpsClient
- func (e *Environment) NewGatewayConfig() *v1beta1.GatewayConfig
- func (e *Environment) NewManagementClient() managementv1.ManagementClient
- func (e *Environment) NewWebhookMemoryServer(parentCtx context.Context, webHookRoute string) *MockIntegrationWebhookServer
- func (e *Environment) PrometheusAPIEndpoint() string
- func (e *Environment) PutTestData(inputPath string, data []byte) string
- func (e *Environment) RunAlertManager(ctx context.Context, router routing.OpniRouting, tmpWritePath string, ...) (int, context.CancelFunc)
- func (e *Environment) Start(opts ...EnvironmentOption) error
- func (e *Environment) StartAgent(id string, token *corev1.BootstrapToken, pins []string, ...) (int, <-chan error)
- func (e *Environment) StartAgentDisconnectServer()
- func (e *Environment) StartCortex(ctx context.Context)
- func (e *Environment) StartEmbeddedAlertManager(ctx context.Context, configFilePath string, opniPort *int) (webPort int)
- func (e *Environment) StartEmbeddedJetstream() (*nats.Conn, error)
- func (e *Environment) StartInstrumentationServer(ctx context.Context) (int, chan struct{})
- func (e *Environment) StartK8s() (*rest.Config, *runtime.Scheme, error)
- func (e *Environment) StartManager(restConfig *rest.Config, reconcilers ...Reconciler) ctrl.Manager
- func (e *Environment) StartMockKubernetesMetricServer(ctx context.Context) (port int)
- func (e *Environment) StartNodeExporter()
- func (e *Environment) StartPrometheus(opniAgentPort int, override ...*overridePrometheusConfig) int
- func (e *Environment) Stop() error
- type EnvironmentOption
- func WithAgentIdSeed(seed int64) EnvironmentOption
- func WithDefaultAgentOpts(opts ...StartAgentOption) EnvironmentOption
- func WithDelayStartCortex(delay chan struct{}) EnvironmentOption
- func WithDelayStartEtcd(delay chan struct{}) EnvironmentOption
- func WithEnableAlertingClusterDriver(enable bool) EnvironmentOption
- func WithEnableCortex(enable bool) EnvironmentOption
- func WithEnableCortexClusterDriver(enable bool) EnvironmentOption
- func WithEnableDisconnectServer(enable bool) EnvironmentOption
- func WithEnableEtcd(enable bool) EnvironmentOption
- func WithEnableGateway(enable bool) EnvironmentOption
- func WithEnableJetstream(enable bool) EnvironmentOption
- func WithEnableNodeExporter(enable bool) EnvironmentOption
- func WithEnableRealtimeServer(enable bool) EnvironmentOption
- func WithStorageBackend(backend v1beta1.StorageType) EnvironmentOption
- type EnvironmentOptions
- type HealthStore
- type IndividualEndpointTestcase
- type KeyringStoreHandler
- type Lease
- type LeaseStore
- type MockIntegrationWebhookServer
- func (m *MockIntegrationWebhookServer) ClearBuffer()
- func (m *MockIntegrationWebhookServer) Endpoint() *alertingv1.AlertEndpoint
- func (m *MockIntegrationWebhookServer) GetBuffer() []*config.WebhookMessage
- func (m *MockIntegrationWebhookServer) GetWebhook() string
- func (m *MockIntegrationWebhookServer) WriteBuffer(msg *config.WebhookMessage)
- type ModeAwareMemMapFs
- func (m *ModeAwareMemMapFs) Chmod(name string, mode os.FileMode) error
- func (m *ModeAwareMemMapFs) Chown(name string, uid, gid int) error
- func (m *ModeAwareMemMapFs) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (m *ModeAwareMemMapFs) Create(name string) (afero.File, error)
- func (m *ModeAwareMemMapFs) Mkdir(name string, perm os.FileMode) error
- func (m *ModeAwareMemMapFs) MkdirAll(path string, perm os.FileMode) error
- func (m *ModeAwareMemMapFs) Name() string
- func (m *ModeAwareMemMapFs) Open(name string) (afero.File, error)
- func (m *ModeAwareMemMapFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (m *ModeAwareMemMapFs) Remove(name string) error
- func (m *ModeAwareMemMapFs) RemoveAll(path string) error
- func (m *ModeAwareMemMapFs) Rename(oldname string, newname string) error
- func (m *ModeAwareMemMapFs) Stat(name string) (os.FileInfo, error)
- type NamespaceSubTreeTestcase
- type NotificationPair
- type PrometheusJob
- type Reconciler
- type RoutableDataset
- type RunningAgent
- type StartAgentOption
- type StartAgentOptions
- type TestCertManager
- func (m *TestCertManager) GenerateAdminClientCert() error
- func (m *TestCertManager) GenerateClientCert(user string) error
- func (m *TestCertManager) GenerateHTTPCA() error
- func (m *TestCertManager) GenerateRootCACert() error
- func (m *TestCertManager) GenerateTransportCA() error
- func (m *TestCertManager) GetAdminClientCert() (tls.Certificate, error)
- func (m *TestCertManager) GetClientCert(user string) (tls.Certificate, error)
- func (m *TestCertManager) GetClientCertRef(_ string) (corev1.LocalObjectReference, error)
- func (m *TestCertManager) GetHTTPCARef() (corev1.LocalObjectReference, error)
- func (m *TestCertManager) GetHTTPRootCAs() (*x509.CertPool, error)
- func (m *TestCertManager) GetTransportCARef() (corev1.LocalObjectReference, error)
- func (m *TestCertManager) GetTransportRootCAs() (*x509.CertPool, error)
- func (m *TestCertManager) PopulateK8sObjects(ctx context.Context, client ctrlclient.Client, namespace string) error
- type TestChallengeHandler
- type TestEnvAlertingClusterDriver
- func (l *TestEnvAlertingClusterDriver) ConfigureCluster(ctx context.Context, configuration *alertops.ClusterConfiguration) (*emptypb.Empty, error)
- func (l *TestEnvAlertingClusterDriver) GetClusterConfiguration(ctx context.Context, empty *emptypb.Empty) (*alertops.ClusterConfiguration, error)
- func (l *TestEnvAlertingClusterDriver) GetClusterStatus(ctx context.Context, empty *emptypb.Empty) (*alertops.InstallStatus, error)
- func (l *TestEnvAlertingClusterDriver) GetRuntimeOptions() shared.AlertingClusterOptions
- func (l *TestEnvAlertingClusterDriver) InstallCluster(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error)
- func (l *TestEnvAlertingClusterDriver) Name() string
- func (l *TestEnvAlertingClusterDriver) ShouldDisableNode(reference *corev1.Reference) error
- func (l *TestEnvAlertingClusterDriver) StartAlertingBackendServer(ctx context.Context, configFilePath string) AlertingServerUnit
- func (l *TestEnvAlertingClusterDriver) UninstallCluster(ctx context.Context, req *alertops.UninstallRequest) (*emptypb.Empty, error)
- type TestEnvMetricsClusterDriver
- func (d *TestEnvMetricsClusterDriver) ConfigureCluster(_ context.Context, conf *cortexops.ClusterConfiguration) (*emptypb.Empty, error)
- func (d *TestEnvMetricsClusterDriver) GetClusterConfiguration(context.Context, *emptypb.Empty) (*cortexops.ClusterConfiguration, error)
- func (d *TestEnvMetricsClusterDriver) GetClusterStatus(context.Context, *emptypb.Empty) (*cortexops.InstallStatus, error)
- func (d *TestEnvMetricsClusterDriver) Name() string
- func (d *TestEnvMetricsClusterDriver) ShouldDisableNode(*corev1.Reference) error
- func (d *TestEnvMetricsClusterDriver) UninstallCluster(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
Constants ¶
const ( OpCreate = iota OpUpdate OpDelete )
const ( MockCAName = "mock-ca-cert" MockClientCertName = "mock-client-cert" )
Variables ¶
var (
ErrContext_TestKeyringStore_Get = context.WithValue(context.Background(), errContextValue, "error")
)
var ExternalResources sync.WaitGroup
var Log = logger.New(logger.WithLogLevel(logger.DefaultLogLevel.Level())).Named("test")
var TestDataFS embed.FS
Functions ¶
func ContextWithAuthorizedID ¶ added in v0.5.4
func CreateRandomSetOfEndpoints ¶ added in v0.8.2
func CreateRandomSetOfEndpoints() map[string]*alertingv1.FullAttachedEndpoint
the flakiest tests you could ever imagine !!!
func DownloadCertManagerCRDs ¶ added in v0.4.1
func DownloadCertManagerCRDs(scheme *runtime.Scheme) []*apiextensionsv1.CustomResourceDefinition
func EnableIfCI ¶ added in v0.4.1
func ExpectAlertManagerConfigToBeValid ¶ added in v0.8.2
func ExpectConfigEqual ¶ added in v0.8.2
func ExpectConfigNotEqual ¶ added in v0.8.2
func ExpectRouterEqual ¶ added in v0.8.2
func ExpectRouterEqual(r1, r2 routing.OpniRouting, name ...string)
func ExpectRouterNotEqual ¶ added in v0.8.2
func ExpectRouterNotEqual(r1, r2 routing.OpniRouting, name ...string)
func ExpectRuleGroupToExist ¶ added in v0.6.0
func ExpectRuleGroupToExist( client cortexadmin.CortexAdminClient, ctx context.Context, tenant string, groupName string, pollInterval time.Duration, maxTimeout time.Duration, )
func ExpectToRecoverConfig ¶ added in v0.8.2
func ExpectToRecoverConfig(router routing.OpniRouting, name ...string)
func GenerateEndpoint ¶ added in v0.8.2
func GenerateEndpoint(genId int, uuid string) *alertingv1.FullAttachedEndpoint
func IfIntegration ¶ added in v0.9.0
func IfIntegration(f func())
func IfLabelFilterMatches ¶ added in v0.9.0
func IfLabelFilterMatches(labels ginkgo.Labels, f func())
func InjectStorageError ¶ added in v0.7.0
func InjectedStorageError ¶ added in v0.7.0
func LoadPlugins ¶ added in v0.4.1
func LoadPlugins(loader *plugins.PluginLoader, mode meta.PluginMode) int
func NewApiExtensionTestPlugin ¶ added in v0.4.1
func NewApiExtensionTestPlugin( srv apiextensions.ManagementAPIExtensionServer, svcDesc *grpc.ServiceDesc, impl interface{}, ) *plugin.ClientConfig
func NewOverridePrometheusConfig ¶ added in v0.5.4
func NewOverridePrometheusConfig(configPath string, jobs []PrometheusJob) *overridePrometheusConfig
func NewTestCapabilityBackend ¶ added in v0.4.1
func NewTestCapabilityBackend( ctrl *gomock.Controller, capBackend *CapabilityInfo, ) capabilityv1.BackendClient
func NewTestClusterStore ¶ added in v0.4.1
func NewTestClusterStore(ctrl *gomock.Controller) storage.ClusterStore
func NewTestFinder ¶ added in v0.5.4
func NewTestIdentProvider ¶ added in v0.4.1
func NewTestIdentProvider(ctrl *gomock.Controller, id string) ident.Provider
func NewTestKeyValueStore ¶ added in v0.4.1
func NewTestKeyValueStore[T any](ctrl *gomock.Controller, clone func(T) T) storage.KeyValueStoreT[T]
func NewTestKeyValueStoreBroker ¶ added in v0.4.1
func NewTestKeyValueStoreBroker(ctrl *gomock.Controller) storage.KeyValueStoreBroker
func NewTestKeyringStore ¶ added in v0.4.1
func NewTestKeyringStore(ctrl *gomock.Controller, prefix string, ref *corev1.Reference) storage.KeyringStore
func NewTestKeyringStoreBroker ¶ added in v0.4.1
func NewTestKeyringStoreBroker(ctrl *gomock.Controller, handler ...KeyringStoreHandler) storage.KeyringStoreBroker
func NewTestRBACStore ¶ added in v0.4.1
func NewTestRBACStore(ctrl *gomock.Controller) storage.RBACStore
func NewTestStorageBackend ¶ added in v0.4.1
func NewTestTokenStore ¶ added in v0.4.1
func NewTestTokenStore(ctx context.Context, ctrl *gomock.Controller) storage.TokenStore
func RandomName ¶ added in v0.6.0
func RunTestEnvironment ¶
func RunTestEnvironment( testEnv *envtest.Environment, runControllerManager bool, externalEnv bool, reconcilers ...Reconciler, ) (stop context.CancelFunc, k8sManager ctrl.Manager, k8sClient client.Client)
func StandaloneHttpRequest ¶ added in v0.6.0
func StandaloneHttpRequest( method string, url string, requestBody []byte, values url.Values, tls *tls.Config, ) (code int, body []byte, err error)
StandaloneHttpRequest is a helper function to make a http request to a given url. returns status code, body and any errors
func StartControllerManager ¶ added in v0.2.0
func StartControllerManager(ctx context.Context, testEnv *envtest.Environment)
func StartStandaloneTestEnvironment ¶ added in v0.4.1
func StartStandaloneTestEnvironment(opts ...EnvironmentOption)
Types ¶
type AlarmPair ¶ added in v0.9.0
type AlarmPair = lo.Tuple2[*alertingv1.ListAlarmMessageRequest, int]
type AlertingServerUnit ¶ added in v0.8.2
type BenchRunner ¶ added in v0.5.4
type BenchRunner struct {
// contains filtered or unexported fields
}
func (*BenchRunner) StartWorker ¶ added in v0.5.4
func (b *BenchRunner) StartWorker(ctx context.Context)
type CapabilityInfo ¶ added in v0.4.1
type CapabilityInfo struct { Name string CanInstall bool InstallerTemplate string Storage storage.ClusterStore }
type CrossDeviceTestFs ¶ added in v0.8.0
A filesystem wrapper whose implementation of Rename will return EXDEV if the source and destination paths do not share the same first path component. This is to simulate cross-device rename errors.
func (*CrossDeviceTestFs) Rename ¶ added in v0.8.0
func (c *CrossDeviceTestFs) Rename(oldpath, newpath string) error
type DefaultNamespaceSubTreeTestcase ¶ added in v0.8.2
type DefaultNamespaceSubTreeTestcase struct { Endpoints []*alertingv1.AlertEndpoint *codes.Code }
func CreateRandomDefaultNamespacedTestcases ¶ added in v0.8.2
func CreateRandomDefaultNamespacedTestcases(endpSet map[string]*alertingv1.FullAttachedEndpoint) []DefaultNamespaceSubTreeTestcase
type Environment ¶ added in v0.4.1
type Environment struct { EnvironmentOptions TestBin string Logger *zap.SugaredLogger CRDDirectoryPaths []string Processes struct { Etcd future.Future[*os.Process] APIServer future.Future[*os.Process] } // contains filtered or unexported fields }
func (*Environment) Context ¶ added in v0.6.0
func (e *Environment) Context() context.Context
func (*Environment) CortexTLSConfig ¶ added in v0.6.0
func (e *Environment) CortexTLSConfig() *tls.Config
func (*Environment) CreateWebhookServer ¶ added in v0.8.2
func (e *Environment) CreateWebhookServer(parentCtx context.Context, num int) []*MockIntegrationWebhookServer
func (*Environment) EtcdClient ¶ added in v0.4.1
func (e *Environment) EtcdClient() (*clientv3.Client, error)
func (*Environment) EtcdConfig ¶ added in v0.4.1
func (e *Environment) EtcdConfig() *v1beta1.EtcdStorageSpec
func (*Environment) GatewayConfig ¶ added in v0.4.1
func (e *Environment) GatewayConfig() *v1beta1.GatewayConfig
func (*Environment) GatewayTLSConfig ¶ added in v0.4.1
func (e *Environment) GatewayTLSConfig() *tls.Config
func (*Environment) GenerateNewTempDirectory ¶ added in v0.8.0
func (e *Environment) GenerateNewTempDirectory(prefix string) string
func (*Environment) GetAgent ¶ added in v0.4.1
func (e *Environment) GetAgent(id string) RunningAgent
func (*Environment) GetAlertingManagementWebhookEndpoint ¶ added in v0.6.0
func (e *Environment) GetAlertingManagementWebhookEndpoint() string
func (*Environment) JetStreamConfig ¶ added in v0.6.2
func (e *Environment) JetStreamConfig() *v1beta1.JetStreamStorageSpec
func (*Environment) ManagementClientConn ¶ added in v0.5.4
func (e *Environment) ManagementClientConn() grpc.ClientConnInterface
func (*Environment) NewAlertConditionsClient ¶ added in v0.8.2
func (e *Environment) NewAlertConditionsClient() alertingv1.AlertConditionsClient
func (*Environment) NewAlertEndpointsClient ¶ added in v0.8.2
func (e *Environment) NewAlertEndpointsClient() alertingv1.AlertEndpointsClient
func (*Environment) NewAlertNotificationsClient ¶ added in v0.8.3
func (e *Environment) NewAlertNotificationsClient() alertingv1.AlertNotificationsClient
func (*Environment) NewAlertOpsClient ¶ added in v0.8.2
func (e *Environment) NewAlertOpsClient() alertops.AlertingAdminClient
func (*Environment) NewBenchRunner ¶ added in v0.5.4
func (e *Environment) NewBenchRunner(agent string, desc bench.WorkloadDesc) (*BenchRunner, error)
func (*Environment) NewCortexAdminClient ¶ added in v0.5.4
func (e *Environment) NewCortexAdminClient() cortexadmin.CortexAdminClient
func (*Environment) NewCortexOpsClient ¶ added in v0.6.0
func (e *Environment) NewCortexOpsClient() cortexops.CortexOpsClient
func (*Environment) NewGatewayConfig ¶ added in v0.8.0
func (e *Environment) NewGatewayConfig() *v1beta1.GatewayConfig
func (*Environment) NewManagementClient ¶ added in v0.4.1
func (e *Environment) NewManagementClient() managementv1.ManagementClient
func (*Environment) NewWebhookMemoryServer ¶ added in v0.8.2
func (e *Environment) NewWebhookMemoryServer(parentCtx context.Context, webHookRoute string) *MockIntegrationWebhookServer
func (*Environment) PrometheusAPIEndpoint ¶ added in v0.4.1
func (e *Environment) PrometheusAPIEndpoint() string
func (*Environment) PutTestData ¶ added in v0.8.0
func (e *Environment) PutTestData(inputPath string, data []byte) string
func (*Environment) RunAlertManager ¶ added in v0.8.2
func (e *Environment) RunAlertManager( ctx context.Context, router routing.OpniRouting, tmpWritePath string, debugFile string, ) (int, context.CancelFunc)
func (*Environment) Start ¶ added in v0.4.1
func (e *Environment) Start(opts ...EnvironmentOption) error
func (*Environment) StartAgent ¶ added in v0.4.1
func (e *Environment) StartAgent(id string, token *corev1.BootstrapToken, pins []string, opts ...StartAgentOption) (int, <-chan error)
func (*Environment) StartAgentDisconnectServer ¶ added in v0.6.1
func (e *Environment) StartAgentDisconnectServer()
func (*Environment) StartCortex ¶ added in v0.6.0
func (e *Environment) StartCortex(ctx context.Context)
func (*Environment) StartEmbeddedAlertManager ¶ added in v0.8.2
func (*Environment) StartEmbeddedJetstream ¶ added in v0.8.2
func (e *Environment) StartEmbeddedJetstream() (*nats.Conn, error)
func (*Environment) StartInstrumentationServer ¶ added in v0.5.4
func (e *Environment) StartInstrumentationServer(ctx context.Context) (int, chan struct{})
Starts a server that exposes Prometheus metrics
Returns port number of the server & a channel that shutdowns the server
func (*Environment) StartManager ¶ added in v0.4.1
func (e *Environment) StartManager(restConfig *rest.Config, reconcilers ...Reconciler) ctrl.Manager
func (*Environment) StartMockKubernetesMetricServer ¶ added in v0.6.0
func (e *Environment) StartMockKubernetesMetricServer(ctx context.Context) (port int)
func (*Environment) StartNodeExporter ¶ added in v0.6.1
func (e *Environment) StartNodeExporter()
func (*Environment) StartPrometheus ¶ added in v0.4.1
func (e *Environment) StartPrometheus(opniAgentPort int, override ...*overridePrometheusConfig) int
`prometheus/config.yaml` is the default monitoring config. `slo/prometheus/config.yaml` is the default SLO config.
func (*Environment) Stop ¶ added in v0.4.1
func (e *Environment) Stop() error
type EnvironmentOption ¶ added in v0.4.1
type EnvironmentOption func(*EnvironmentOptions)
func WithAgentIdSeed ¶ added in v0.6.0
func WithAgentIdSeed(seed int64) EnvironmentOption
func WithDefaultAgentOpts ¶ added in v0.5.4
func WithDefaultAgentOpts(opts ...StartAgentOption) EnvironmentOption
func WithDelayStartCortex ¶ added in v0.6.0
func WithDelayStartCortex(delay chan struct{}) EnvironmentOption
func WithDelayStartEtcd ¶ added in v0.6.0
func WithDelayStartEtcd(delay chan struct{}) EnvironmentOption
func WithEnableAlertingClusterDriver ¶ added in v0.8.2
func WithEnableAlertingClusterDriver(enable bool) EnvironmentOption
func WithEnableCortex ¶ added in v0.4.1
func WithEnableCortex(enable bool) EnvironmentOption
func WithEnableCortexClusterDriver ¶ added in v0.6.0
func WithEnableCortexClusterDriver(enable bool) EnvironmentOption
func WithEnableDisconnectServer ¶ added in v0.6.1
func WithEnableDisconnectServer(enable bool) EnvironmentOption
func WithEnableEtcd ¶ added in v0.4.1
func WithEnableEtcd(enable bool) EnvironmentOption
func WithEnableGateway ¶ added in v0.4.1
func WithEnableGateway(enable bool) EnvironmentOption
func WithEnableJetstream ¶ added in v0.6.0
func WithEnableJetstream(enable bool) EnvironmentOption
func WithEnableNodeExporter ¶ added in v0.6.1
func WithEnableNodeExporter(enable bool) EnvironmentOption
func WithEnableRealtimeServer ¶ added in v0.5.4
func WithEnableRealtimeServer(enable bool) EnvironmentOption
func WithStorageBackend ¶ added in v0.6.2
func WithStorageBackend(backend v1beta1.StorageType) EnvironmentOption
type EnvironmentOptions ¶ added in v0.4.1
type EnvironmentOptions struct {
// contains filtered or unexported fields
}
type HealthStore ¶ added in v0.5.4
type HealthStore struct { GetHealthShouldFail bool // contains filtered or unexported fields }
func (*HealthStore) GetHealth ¶ added in v0.5.4
func (hb *HealthStore) GetHealth(context.Context, *emptypb.Empty, ...grpc.CallOption) (*corev1.Health, error)
func (*HealthStore) SetHealth ¶ added in v0.5.4
func (hb *HealthStore) SetHealth(health *corev1.Health)
type IndividualEndpointTestcase ¶ added in v0.8.2
type IndividualEndpointTestcase struct { EndpointId string UpdateEndpoint *alertingv1.AlertEndpoint Op int *codes.Code }
func CreateRandomIndividualEndpointTestcases ¶ added in v0.8.2
func CreateRandomIndividualEndpointTestcases(endpSet map[string]*alertingv1.FullAttachedEndpoint) []IndividualEndpointTestcase
type KeyringStoreHandler ¶ added in v0.4.1
type KeyringStoreHandler = func(prefix string, ref *corev1.Reference) storage.KeyringStore
type LeaseStore ¶ added in v0.4.1
type LeaseStore struct {
// contains filtered or unexported fields
}
func NewLeaseStore ¶ added in v0.4.1
func NewLeaseStore(ctx context.Context) *LeaseStore
func (*LeaseStore) LeaseExpired ¶ added in v0.4.1
func (ls *LeaseStore) LeaseExpired() <-chan string
type MockIntegrationWebhookServer ¶ added in v0.8.2
type MockIntegrationWebhookServer struct { EndpointId string Webhook string Port int Addr string *sync.RWMutex Buffer []*config.WebhookMessage }
func (*MockIntegrationWebhookServer) ClearBuffer ¶ added in v0.8.2
func (m *MockIntegrationWebhookServer) ClearBuffer()
func (*MockIntegrationWebhookServer) Endpoint ¶ added in v0.8.2
func (m *MockIntegrationWebhookServer) Endpoint() *alertingv1.AlertEndpoint
func (*MockIntegrationWebhookServer) GetBuffer ¶ added in v0.8.2
func (m *MockIntegrationWebhookServer) GetBuffer() []*config.WebhookMessage
func (*MockIntegrationWebhookServer) GetWebhook ¶ added in v0.8.2
func (m *MockIntegrationWebhookServer) GetWebhook() string
func (*MockIntegrationWebhookServer) WriteBuffer ¶ added in v0.8.2
func (m *MockIntegrationWebhookServer) WriteBuffer(msg *config.WebhookMessage)
type ModeAwareMemMapFs ¶ added in v0.8.0
func NewModeAwareMemFs ¶ added in v0.8.0
func NewModeAwareMemFs() *ModeAwareMemMapFs
func (*ModeAwareMemMapFs) Chmod ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) Chmod(name string, mode os.FileMode) error
func (*ModeAwareMemMapFs) Chown ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) Chown(name string, uid, gid int) error
func (*ModeAwareMemMapFs) Create ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) Create(name string) (afero.File, error)
Create creates a file in the filesystem, returning the file and an error, if any happens.
func (*ModeAwareMemMapFs) Mkdir ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) Mkdir(name string, perm os.FileMode) error
Mkdir creates a directory in the filesystem, return an error if any happens.
func (*ModeAwareMemMapFs) MkdirAll ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) MkdirAll(path string, perm os.FileMode) error
MkdirAll creates a directory path and all parents that does not exist yet.
func (*ModeAwareMemMapFs) Name ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) Name() string
func (*ModeAwareMemMapFs) Open ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) Open(name string) (afero.File, error)
Open opens a file, returning it or an error, if any happens.
func (*ModeAwareMemMapFs) OpenFile ¶ added in v0.8.0
OpenFile opens a file using the given flags and the given mode.
func (*ModeAwareMemMapFs) Remove ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) Remove(name string) error
Remove removes a file identified by name, returning an error, if any happens.
func (*ModeAwareMemMapFs) RemoveAll ¶ added in v0.8.0
func (m *ModeAwareMemMapFs) RemoveAll(path string) error
RemoveAll removes a directory path and any children it contains. It does not fail if the path does not exist (return nil).
type NamespaceSubTreeTestcase ¶ added in v0.8.2
type NamespaceSubTreeTestcase struct { Namespace string ConditionId string Endpoints *alertingv1.FullAttachedEndpoints Op int *codes.Code }
func CreateRandomNamespacedTestCases ¶ added in v0.8.2
func CreateRandomNamespacedTestCases(n int, endpSet map[string]*alertingv1.FullAttachedEndpoint) []NamespaceSubTreeTestcase
type NotificationPair ¶ added in v0.9.0
type NotificationPair = lo.Tuple2[*alertingv1.ListNotificationRequest, int]
list request to expect length of notifications
type PrometheusJob ¶ added in v0.5.4
type Reconciler ¶
type RoutableDataset ¶ added in v0.9.0
type RoutableDataset struct { Routables []interfaces.Routable ExpectedNotifications []NotificationPair ExpectedAlarms []AlarmPair }
func NewRoutableDataset ¶ added in v0.9.0
func NewRoutableDataset() *RoutableDataset
type RunningAgent ¶ added in v0.4.1
type RunningAgent struct { Agent agent.AgentInterface *sync.Mutex }
type StartAgentOption ¶ added in v0.4.1
type StartAgentOption func(*StartAgentOptions)
func WithAgentVersion ¶ added in v0.6.0
func WithAgentVersion(version string) StartAgentOption
func WithContext ¶ added in v0.4.1
func WithContext(ctx context.Context) StartAgentOption
func WithLocalAgent ¶ added in v0.9.0
func WithLocalAgent() StartAgentOption
func WithRemoteGatewayAddress ¶ added in v0.5.4
func WithRemoteGatewayAddress(addr string) StartAgentOption
func WithRemoteKubeconfig ¶ added in v0.5.4
func WithRemoteKubeconfig(kubeconfig string) StartAgentOption
type StartAgentOptions ¶ added in v0.4.1
type StartAgentOptions struct {
// contains filtered or unexported fields
}
type TestCertManager ¶ added in v0.8.0
type TestCertManager struct{}
func (*TestCertManager) GenerateAdminClientCert ¶ added in v0.8.0
func (m *TestCertManager) GenerateAdminClientCert() error
func (*TestCertManager) GenerateClientCert ¶ added in v0.8.0
func (m *TestCertManager) GenerateClientCert(user string) error
func (*TestCertManager) GenerateHTTPCA ¶ added in v0.8.0
func (m *TestCertManager) GenerateHTTPCA() error
func (*TestCertManager) GenerateRootCACert ¶ added in v0.8.0
func (m *TestCertManager) GenerateRootCACert() error
func (*TestCertManager) GenerateTransportCA ¶ added in v0.8.0
func (m *TestCertManager) GenerateTransportCA() error
func (*TestCertManager) GetAdminClientCert ¶ added in v0.8.0
func (m *TestCertManager) GetAdminClientCert() (tls.Certificate, error)
func (*TestCertManager) GetClientCert ¶ added in v0.8.0
func (m *TestCertManager) GetClientCert(user string) (tls.Certificate, error)
func (*TestCertManager) GetClientCertRef ¶ added in v0.9.0
func (m *TestCertManager) GetClientCertRef(_ string) (corev1.LocalObjectReference, error)
func (*TestCertManager) GetHTTPCARef ¶ added in v0.8.0
func (m *TestCertManager) GetHTTPCARef() (corev1.LocalObjectReference, error)
func (*TestCertManager) GetHTTPRootCAs ¶ added in v0.8.0
func (m *TestCertManager) GetHTTPRootCAs() (*x509.CertPool, error)
func (*TestCertManager) GetTransportCARef ¶ added in v0.8.0
func (m *TestCertManager) GetTransportCARef() (corev1.LocalObjectReference, error)
func (*TestCertManager) GetTransportRootCAs ¶ added in v0.8.0
func (m *TestCertManager) GetTransportRootCAs() (*x509.CertPool, error)
func (*TestCertManager) PopulateK8sObjects ¶ added in v0.8.0
func (m *TestCertManager) PopulateK8sObjects(ctx context.Context, client ctrlclient.Client, namespace string) error
type TestChallengeHandler ¶ added in v0.9.0
type TestChallengeHandler struct {
// contains filtered or unexported fields
}
func NewTestChallengeHandler ¶ added in v0.9.0
func NewTestChallengeHandler(fn challenges.HandlerFunc, kvs ...string) *TestChallengeHandler
func (*TestChallengeHandler) DoChallenge ¶ added in v0.9.0
func (*TestChallengeHandler) InterceptContext ¶ added in v0.9.0
func (t *TestChallengeHandler) InterceptContext(ctx context.Context) context.Context
type TestEnvAlertingClusterDriver ¶ added in v0.8.2
type TestEnvAlertingClusterDriver struct { ConfigFile string *shared.AlertingClusterOptions *alerting_drivers.AlertingManagerDriverOptions *alertops.ClusterConfiguration alertops.UnsafeAlertingAdminServer // contains filtered or unexported fields }
func NewTestEnvAlertingClusterDriver ¶ added in v0.8.2
func NewTestEnvAlertingClusterDriver(env *Environment, opts ...alerting_drivers.AlertingManagerDriverOption) *TestEnvAlertingClusterDriver
func (*TestEnvAlertingClusterDriver) ConfigureCluster ¶ added in v0.8.2
func (l *TestEnvAlertingClusterDriver) ConfigureCluster(ctx context.Context, configuration *alertops.ClusterConfiguration) (*emptypb.Empty, error)
func (*TestEnvAlertingClusterDriver) GetClusterConfiguration ¶ added in v0.8.2
func (l *TestEnvAlertingClusterDriver) GetClusterConfiguration(ctx context.Context, empty *emptypb.Empty) (*alertops.ClusterConfiguration, error)
func (*TestEnvAlertingClusterDriver) GetClusterStatus ¶ added in v0.8.2
func (l *TestEnvAlertingClusterDriver) GetClusterStatus(ctx context.Context, empty *emptypb.Empty) (*alertops.InstallStatus, error)
func (*TestEnvAlertingClusterDriver) GetRuntimeOptions ¶ added in v0.8.2
func (l *TestEnvAlertingClusterDriver) GetRuntimeOptions() shared.AlertingClusterOptions
func (*TestEnvAlertingClusterDriver) InstallCluster ¶ added in v0.8.2
func (*TestEnvAlertingClusterDriver) Name ¶ added in v0.8.2
func (l *TestEnvAlertingClusterDriver) Name() string
func (*TestEnvAlertingClusterDriver) ShouldDisableNode ¶ added in v0.8.2
func (l *TestEnvAlertingClusterDriver) ShouldDisableNode(reference *corev1.Reference) error
func (*TestEnvAlertingClusterDriver) StartAlertingBackendServer ¶ added in v0.8.2
func (l *TestEnvAlertingClusterDriver) StartAlertingBackendServer( ctx context.Context, configFilePath string, ) AlertingServerUnit
func (*TestEnvAlertingClusterDriver) UninstallCluster ¶ added in v0.8.2
func (l *TestEnvAlertingClusterDriver) UninstallCluster(ctx context.Context, req *alertops.UninstallRequest) (*emptypb.Empty, error)
type TestEnvMetricsClusterDriver ¶ added in v0.8.2
type TestEnvMetricsClusterDriver struct { cortexops.UnsafeCortexOpsServer Env *Environment Configuration *cortexops.ClusterConfiguration // contains filtered or unexported fields }
func NewTestEnvMetricsClusterDriver ¶ added in v0.8.2
func NewTestEnvMetricsClusterDriver(env *Environment) *TestEnvMetricsClusterDriver
func (*TestEnvMetricsClusterDriver) ConfigureCluster ¶ added in v0.8.2
func (d *TestEnvMetricsClusterDriver) ConfigureCluster(_ context.Context, conf *cortexops.ClusterConfiguration) (*emptypb.Empty, error)
func (*TestEnvMetricsClusterDriver) GetClusterConfiguration ¶ added in v0.8.2
func (d *TestEnvMetricsClusterDriver) GetClusterConfiguration(context.Context, *emptypb.Empty) (*cortexops.ClusterConfiguration, error)
func (*TestEnvMetricsClusterDriver) GetClusterStatus ¶ added in v0.8.2
func (d *TestEnvMetricsClusterDriver) GetClusterStatus(context.Context, *emptypb.Empty) (*cortexops.InstallStatus, error)
func (*TestEnvMetricsClusterDriver) Name ¶ added in v0.8.2
func (d *TestEnvMetricsClusterDriver) Name() string
func (*TestEnvMetricsClusterDriver) ShouldDisableNode ¶ added in v0.8.2
func (d *TestEnvMetricsClusterDriver) ShouldDisableNode(*corev1.Reference) error
func (*TestEnvMetricsClusterDriver) UninstallCluster ¶ added in v0.8.2
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
mock
|
|
apiextensions
Package mock_apiextensions is a generated GoMock package.
|
Package mock_apiextensions is a generated GoMock package. |
capability
Package mock_v1 is a generated GoMock package.
|
Package mock_v1 is a generated GoMock package. |
ext
Package mock_ext is a generated GoMock package.
|
Package mock_ext is a generated GoMock package. |
grpc
Package mock_grpc is a generated GoMock package.
|
Package mock_grpc is a generated GoMock package. |
ident
Package mock_ident is a generated GoMock package.
|
Package mock_ident is a generated GoMock package. |
notifier
Package mock_notifier is a generated GoMock package.
|
Package mock_notifier is a generated GoMock package. |
rbac
Package mock_rbac is a generated GoMock package.
|
Package mock_rbac is a generated GoMock package. |
rules
Package mock_rules is a generated GoMock package.
|
Package mock_rules is a generated GoMock package. |
storage
Package mock_storage is a generated GoMock package.
|
Package mock_storage is a generated GoMock package. |
streams
Package mock_streams is a generated GoMock package.
|
Package mock_streams is a generated GoMock package. |