Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTestAgentConfigEnv() (string, string, func(), error)
- func GetDetailsMap() map[string]*proto.NginxDetails
- func GetDetailsNginxOssConfig() string
- func GetMockAgentConfig() *config.Config
- func GetNginxConfig(contents []byte) *proto.NginxConfig
- func GetProcesses() []core.Process
- func GetTestAgentConfigPath() string
- func LoadKeyPair() credentials.TransportCredentials
- func ProcessResponse(resp *resty.Response) []string
- func StartFakeProcesses(names []string, fakeProcsDuration string) func()
- type MockCommandClient
- func (m *MockCommandClient) ChunksSize() int
- func (m *MockCommandClient) Close() error
- func (m *MockCommandClient) Connect(ctx context.Context) error
- func (m *MockCommandClient) DialOptions() []grpc.DialOption
- func (m *MockCommandClient) Download(_ context.Context, meta *proto.Metadata) (*proto.NginxConfig, error)
- func (m *MockCommandClient) Recv() <-chan client.Message
- func (m *MockCommandClient) Send(ctx context.Context, message client.Message) error
- func (m *MockCommandClient) Server() string
- func (m *MockCommandClient) Upload(_ context.Context, cfg *proto.NginxConfig, messageId string) error
- func (m *MockCommandClient) WithBackoffSettings(backoffSettings backoff.BackoffSettings) client.Client
- func (m *MockCommandClient) WithChunkSize(i int) client.Client
- func (m *MockCommandClient) WithClientInterceptor(interceptor interceptors.ClientInterceptor) client.Client
- func (m *MockCommandClient) WithConnWaitDuration(d time.Duration) client.Client
- func (m *MockCommandClient) WithDialOptions(options ...grpc.DialOption) client.Client
- func (m *MockCommandClient) WithInterceptor(interceptor interceptors.Interceptor) client.Client
- func (m *MockCommandClient) WithServer(s string) client.Client
- type MockEnvironment
- func (m *MockEnvironment) DiskDevices() ([]string, error)
- func (m *MockEnvironment) FileStat(path string) (os.FileInfo, error)
- func (m *MockEnvironment) GetContainerID() (string, error)
- func (m *MockEnvironment) GetHostname() string
- func (m *MockEnvironment) GetNetOverflow() (float64, error)
- func (m *MockEnvironment) GetSystemUUID() string
- func (m *MockEnvironment) IsContainer() bool
- func (m *MockEnvironment) NewHostInfo(agentVersion string, tags *[]string, configDirs string, clearCache bool) *proto.HostInfo
- func (m *MockEnvironment) Processes() (result []core.Process)
- func (m *MockEnvironment) ReadDirectory(dir string, ext string) ([]string, error)
- func (m *MockEnvironment) ReadFile(file string) ([]byte, error)
- func (m *MockEnvironment) WriteFiles(backup core.ConfigApplyMarker, files []*proto.File, prefix string, ...) error
- type MockMetricsReportClient
- func (m *MockMetricsReportClient) Close() error
- func (m *MockMetricsReportClient) Connect(ctx context.Context) error
- func (m *MockMetricsReportClient) DialOptions() []grpc.DialOption
- func (m *MockMetricsReportClient) Send(ctx context.Context, message client.Message) error
- func (m *MockMetricsReportClient) Server() string
- func (m *MockMetricsReportClient) WithBackoffSettings(backoffSettings backoff.BackoffSettings) client.Client
- func (m *MockMetricsReportClient) WithClientInterceptor(interceptor interceptors.ClientInterceptor) client.Client
- func (m *MockMetricsReportClient) WithConnWaitDuration(d time.Duration) client.Client
- func (m *MockMetricsReportClient) WithDialOptions(options ...grpc.DialOption) client.Client
- func (m *MockMetricsReportClient) WithInterceptor(interceptor interceptors.Interceptor) client.Client
- func (m *MockMetricsReportClient) WithServer(s string) client.Client
- type MockNginxBinary
- func (m *MockNginxBinary) GetAccessLogs() map[string]string
- func (m *MockNginxBinary) GetChildProcesses() map[string][]*proto.NginxDetails
- func (m *MockNginxBinary) GetErrorLogs() map[string]string
- func (m *MockNginxBinary) GetNginxDetailsByID(nginxID string) *proto.NginxDetails
- func (m *MockNginxBinary) GetNginxDetailsFromProcess(nginxProcess core.Process) *proto.NginxDetails
- func (m *MockNginxBinary) GetNginxDetailsMapFromProcesses(nginxProcesses []core.Process) map[string]*proto.NginxDetails
- func (m *MockNginxBinary) GetNginxIDForProcess(nginxProcess core.Process) string
- func (m *MockNginxBinary) ReadConfig(path, nginxId, systemId string) (*proto.NginxConfig, error)
- func (m *MockNginxBinary) Reload(processId, bin string) error
- func (m *MockNginxBinary) Start(nginxId, bin string) error
- func (m *MockNginxBinary) Stop(processId, bin string) error
- func (m *MockNginxBinary) UpdateLogs(existing map[string]string, newLogs map[string]string) bool
- func (m *MockNginxBinary) UpdateNginxDetailsFromProcesses(nginxProcesses []core.Process)
- func (m *MockNginxBinary) ValidateConfig(processId, bin, configLocation string, config *proto.NginxConfig, ...) error
- func (m *MockNginxBinary) WriteConfig(config *proto.NginxConfig) (*sdk.ConfigApply, error)
- type Symbols
Constants ¶
const ( DisplayNameKey = "display_name" DefaultTestDisplayName = "nginx-agent-repo" )
const ( InitialConfTag1 = "locally-tagged" InitialConfTag2 = "tagged-locally" )
Variables ¶
var ( // These initial conf tags come from the values located in // ../testdata/configs/agent-dynamic.conf InitialConfTags = []string{InitialConfTag1, InitialConfTag2} )
Functions ¶
func CreateTestAgentConfigEnv ¶
CreateTestAgentConfigEnv creates an agent config file named "temp-nginx-agent.conf" and a dynamic config named "temp-agent-dynamic.conf" meant for testing in the current working directory. Additionally, a Viper config is created that has its variables set based off the created conf files ("temp-nginx-agent.conf" and "temp-agent-dynamic.conf"). It returns the name of the config ("nginx-agent.conf"), the name of the of the dynamic config ("temp-agent-dynamic.conf"), and a function to call that deletes the both of the files that were created.
func GetDetailsMap ¶
func GetDetailsMap() map[string]*proto.NginxDetails
func GetDetailsNginxOssConfig ¶ added in v2.21.0
func GetDetailsNginxOssConfig() string
func GetMockAgentConfig ¶
func GetNginxConfig ¶ added in v2.25.0
func GetNginxConfig(contents []byte) *proto.NginxConfig
func GetProcesses ¶
func GetTestAgentConfigPath ¶
func GetTestAgentConfigPath() string
GetTestAgentConfigPath gets the absolute path to the test agent config
func LoadKeyPair ¶
func LoadKeyPair() credentials.TransportCredentials
func ProcessResponse ¶ added in v2.23.0
func ProcessResponse(resp *resty.Response) []string
func StartFakeProcesses ¶
StartFakeProcesses creates a fake process for each of the string names and each fake process lasts for fakeProcsDuration of time (seconds), the function that is returned can be ran to kill all the fake processes that were created.
Types ¶
type MockCommandClient ¶
func GetMockCommandClient ¶
func GetMockCommandClient(config *proto.NginxConfig) *MockCommandClient
func NewMockCommandClient ¶
func NewMockCommandClient() *MockCommandClient
func (*MockCommandClient) ChunksSize ¶
func (m *MockCommandClient) ChunksSize() int
func (*MockCommandClient) Close ¶
func (m *MockCommandClient) Close() error
func (*MockCommandClient) DialOptions ¶
func (m *MockCommandClient) DialOptions() []grpc.DialOption
func (*MockCommandClient) Download ¶
func (m *MockCommandClient) Download(_ context.Context, meta *proto.Metadata) (*proto.NginxConfig, error)
func (*MockCommandClient) Recv ¶
func (m *MockCommandClient) Recv() <-chan client.Message
func (*MockCommandClient) Server ¶
func (m *MockCommandClient) Server() string
func (*MockCommandClient) Upload ¶
func (m *MockCommandClient) Upload(_ context.Context, cfg *proto.NginxConfig, messageId string) error
func (*MockCommandClient) WithBackoffSettings ¶
func (m *MockCommandClient) WithBackoffSettings(backoffSettings backoff.BackoffSettings) client.Client
func (*MockCommandClient) WithChunkSize ¶
func (m *MockCommandClient) WithChunkSize(i int) client.Client
func (*MockCommandClient) WithClientInterceptor ¶
func (m *MockCommandClient) WithClientInterceptor(interceptor interceptors.ClientInterceptor) client.Client
func (*MockCommandClient) WithConnWaitDuration ¶
func (m *MockCommandClient) WithConnWaitDuration(d time.Duration) client.Client
func (*MockCommandClient) WithDialOptions ¶
func (m *MockCommandClient) WithDialOptions(options ...grpc.DialOption) client.Client
func (*MockCommandClient) WithInterceptor ¶
func (m *MockCommandClient) WithInterceptor(interceptor interceptors.Interceptor) client.Client
func (*MockCommandClient) WithServer ¶
func (m *MockCommandClient) WithServer(s string) client.Client
type MockEnvironment ¶
func GetMockEnv ¶
func GetMockEnv() *MockEnvironment
func GetMockEnvWithHostAndProcess ¶
func GetMockEnvWithHostAndProcess() *MockEnvironment
func GetMockEnvWithProcess ¶
func GetMockEnvWithProcess() *MockEnvironment
func NewMockEnvironment ¶
func NewMockEnvironment() *MockEnvironment
func (*MockEnvironment) DiskDevices ¶
func (m *MockEnvironment) DiskDevices() ([]string, error)
func (*MockEnvironment) FileStat ¶
func (m *MockEnvironment) FileStat(path string) (os.FileInfo, error)
func (*MockEnvironment) GetContainerID ¶
func (m *MockEnvironment) GetContainerID() (string, error)
func (*MockEnvironment) GetHostname ¶
func (m *MockEnvironment) GetHostname() string
func (*MockEnvironment) GetNetOverflow ¶
func (m *MockEnvironment) GetNetOverflow() (float64, error)
func (*MockEnvironment) GetSystemUUID ¶
func (m *MockEnvironment) GetSystemUUID() string
func (*MockEnvironment) IsContainer ¶
func (m *MockEnvironment) IsContainer() bool
func (*MockEnvironment) NewHostInfo ¶
func (*MockEnvironment) Processes ¶
func (m *MockEnvironment) Processes() (result []core.Process)
func (*MockEnvironment) ReadDirectory ¶
func (m *MockEnvironment) ReadDirectory(dir string, ext string) ([]string, error)
func (*MockEnvironment) WriteFiles ¶
func (m *MockEnvironment) WriteFiles(backup core.ConfigApplyMarker, files []*proto.File, prefix string, allowedDirs map[string]struct{}) error
type MockMetricsReportClient ¶
func NewMockMetricsReportClient ¶
func NewMockMetricsReportClient() *MockMetricsReportClient
func (*MockMetricsReportClient) Close ¶
func (m *MockMetricsReportClient) Close() error
func (*MockMetricsReportClient) Connect ¶
func (m *MockMetricsReportClient) Connect(ctx context.Context) error
func (*MockMetricsReportClient) DialOptions ¶
func (m *MockMetricsReportClient) DialOptions() []grpc.DialOption
func (*MockMetricsReportClient) Server ¶
func (m *MockMetricsReportClient) Server() string
func (*MockMetricsReportClient) WithBackoffSettings ¶
func (m *MockMetricsReportClient) WithBackoffSettings(backoffSettings backoff.BackoffSettings) client.Client
func (*MockMetricsReportClient) WithClientInterceptor ¶
func (m *MockMetricsReportClient) WithClientInterceptor(interceptor interceptors.ClientInterceptor) client.Client
func (*MockMetricsReportClient) WithConnWaitDuration ¶
func (m *MockMetricsReportClient) WithConnWaitDuration(d time.Duration) client.Client
func (*MockMetricsReportClient) WithDialOptions ¶
func (m *MockMetricsReportClient) WithDialOptions(options ...grpc.DialOption) client.Client
func (*MockMetricsReportClient) WithInterceptor ¶
func (m *MockMetricsReportClient) WithInterceptor(interceptor interceptors.Interceptor) client.Client
func (*MockMetricsReportClient) WithServer ¶
func (m *MockMetricsReportClient) WithServer(s string) client.Client
type MockNginxBinary ¶
func GetMockNginxBinary ¶
func GetMockNginxBinary() *MockNginxBinary
func NewMockNginxBinary ¶
func NewMockNginxBinary() *MockNginxBinary
func (*MockNginxBinary) GetAccessLogs ¶ added in v2.20.0
func (m *MockNginxBinary) GetAccessLogs() map[string]string
func (*MockNginxBinary) GetChildProcesses ¶
func (m *MockNginxBinary) GetChildProcesses() map[string][]*proto.NginxDetails
func (*MockNginxBinary) GetErrorLogs ¶ added in v2.20.0
func (m *MockNginxBinary) GetErrorLogs() map[string]string
func (*MockNginxBinary) GetNginxDetailsByID ¶
func (m *MockNginxBinary) GetNginxDetailsByID(nginxID string) *proto.NginxDetails
func (*MockNginxBinary) GetNginxDetailsFromProcess ¶
func (m *MockNginxBinary) GetNginxDetailsFromProcess(nginxProcess core.Process) *proto.NginxDetails
func (*MockNginxBinary) GetNginxDetailsMapFromProcesses ¶
func (m *MockNginxBinary) GetNginxDetailsMapFromProcesses(nginxProcesses []core.Process) map[string]*proto.NginxDetails
func (*MockNginxBinary) GetNginxIDForProcess ¶
func (m *MockNginxBinary) GetNginxIDForProcess(nginxProcess core.Process) string
func (*MockNginxBinary) ReadConfig ¶
func (m *MockNginxBinary) ReadConfig(path, nginxId, systemId string) (*proto.NginxConfig, error)
func (*MockNginxBinary) Reload ¶
func (m *MockNginxBinary) Reload(processId, bin string) error
func (*MockNginxBinary) Start ¶
func (m *MockNginxBinary) Start(nginxId, bin string) error
func (*MockNginxBinary) Stop ¶
func (m *MockNginxBinary) Stop(processId, bin string) error
func (*MockNginxBinary) UpdateLogs ¶ added in v2.20.0
func (*MockNginxBinary) UpdateNginxDetailsFromProcesses ¶
func (m *MockNginxBinary) UpdateNginxDetailsFromProcesses(nginxProcesses []core.Process)
func (*MockNginxBinary) ValidateConfig ¶
func (m *MockNginxBinary) ValidateConfig(processId, bin, configLocation string, config *proto.NginxConfig, configApply *sdk.ConfigApply) error
func (*MockNginxBinary) WriteConfig ¶
func (m *MockNginxBinary) WriteConfig(config *proto.NginxConfig) (*sdk.ConfigApply, error)