Skip to content

Commit

Permalink
[Ingest Manager] Fixed tests across agent elastic#19877
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas authored Jul 14, 2020
1 parent b522046 commit e17431e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions x-pack/elastic-agent/pkg/agent/application/enroll_cmd_test.go
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

0 comments on commit e17431e

Please sign in to comment.