Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ingest Manager] Fixed tests across agent #19877

Merged
merged 1 commit into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ func readConfig(raw []byte) (*configuration.FleetAgentConfig, error) {
return nil, err
}

cfg := configuration.DefaultFleetAgentConfig()
cfg := configuration.DefaultConfiguration()
if err := config.Unpack(cfg); err != nil {
return nil, err
}
return cfg, nil
return cfg.Fleet, nil
}
1 change: 1 addition & 0 deletions x-pack/elastic-agent/pkg/agent/operation/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func getTestOperator(t *testing.T, downloadPath string, installPath string, p *a
TargetDirectory: downloadPath,
InstallPath: installPath,
},
LoggingConfig: logger.DefaultLoggingConfig(),
}

l := getLogger()
Expand Down
6 changes: 0 additions & 6 deletions x-pack/elastic-agent/pkg/reporter/log/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ func TestReport(t *testing.T) {

testCases := []testCase{
{infoEvent, DefaultString(infoEvent), ""},
{infoEvent, JSONString(infoEvent), ""},
{errorEvent, "", DefaultString(errorEvent)},
{errorEvent, "", JSONString(errorEvent)},
}

for _, tc := range testCases {
Expand Down Expand Up @@ -94,10 +92,6 @@ func (t testEvent) Time() time.Time { return t.timestamp }
func (t testEvent) Message() string { return t.message }
func (testEvent) Payload() map[string]interface{} { return map[string]interface{}{} }

func JSONString(event testEvent) string {
timestamp := event.timestamp.Format(timeFormat)
return fmt.Sprintf(`{"Type":"%s","SubType":"%s","Time":"%s","Message":"message"}`, event.Type(), event.SubType(), timestamp)
}
func DefaultString(event testEvent) string {
timestamp := event.timestamp.Format(timeFormat)
return fmt.Sprintf("%s: type: '%s': sub_type: '%s' message: message", timestamp, event.Type(), event.SubType())
Expand Down