Skip to content

Commit

Permalink
PR improvements
Browse files Browse the repository at this point in the history
- Rename `CleanTimeout` to `CleanInactive`
- Remove commented out code
  • Loading branch information
belimawr committed Apr 8, 2024
1 parent e42ff3d commit 2f7d96a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 47 deletions.
6 changes: 3 additions & 3 deletions filebeat/input/filestream/internal/input-logfile/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ func (cim *InputManager) Create(config *conf.C) (v2.Input, error) {

settings := struct {
ID string `config:"id"`
CleanTimeout time.Duration `config:"clean_inactive"`
CleanInactive time.Duration `config:"clean_inactive"`
HarvesterLimit uint64 `config:"harvester_limit"`
}{CleanTimeout: cim.DefaultCleanTimeout}
}{CleanInactive: cim.DefaultCleanTimeout}
if err := config.Unpack(&settings); err != nil {
return nil, err
}
Expand Down Expand Up @@ -230,7 +230,7 @@ func (cim *InputManager) Create(config *conf.C) (v2.Input, error) {
prospector: prospector,
harvester: harvester,
sourceIdentifier: sourceIdentifier,
cleanTimeout: settings.CleanTimeout,
cleanTimeout: settings.CleanInactive,
harvesterLimit: settings.HarvesterLimit,
}, nil
}
Expand Down
8 changes: 4 additions & 4 deletions filebeat/input/v2/input-cursor/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ func (cim *InputManager) Create(config *conf.C) (v2.Input, error) {
}

settings := struct {
ID string `config:"id"`
CleanTimeout time.Duration `config:"clean_inactive"`
}{ID: "", CleanTimeout: cim.DefaultCleanTimeout}
ID string `config:"id"`
CleanInactive time.Duration `config:"clean_inactive"`
}{ID: "", CleanInactive: cim.DefaultCleanTimeout}
if err := config.Unpack(&settings); err != nil {
return nil, err
}
Expand All @@ -176,7 +176,7 @@ func (cim *InputManager) Create(config *conf.C) (v2.Input, error) {
userID: settings.ID,
sources: sources,
input: inp,
cleanTimeout: settings.CleanTimeout,
cleanTimeout: settings.CleanInactive,
}, nil
}

Expand Down
40 changes: 0 additions & 40 deletions filebeat/tests/integration/filestream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,43 +105,3 @@ func TestFilestreamCleanInactive(t *testing.T) {
registryFile := filepath.Join(filebeat.TempDir(), "data", "registry", "filebeat", "log.json")
filebeat.WaitFileContains(registryFile, `"op":"remove"`, time.Second)
}

/*
integration.EnsureESIsRunning(t)
esURL := integration.GetESURL(t, "http")
esPassword, _ := esURL.User.Password()
filebeat := integration.NewBeat(t, "filebeat", "../../filebeat.test")
logFile1 := filepath.Join(filebeat.TempDir(), "logfile1.log")
logFile2 := filepath.Join(filebeat.TempDir(), "logfile2.log")
// logFile3 := filepath.Join(filebeat.TempDir(), "logfile3.log")
filebeat.WriteConfigFile(fmt.Sprintf(
cleanInactiveCfg,
filebeat.TempDir(), // base path for logs
esURL.String(),
esURL.User.Username(),
esPassword,
filebeat.TempDir(), // base path for registry files
))
writeFile(t, logFile1, "file 1, line 1")
writeFile(t, logFile2, "file 2, line 1")
filebeat.Start()
// Make sure Filebeat correctly stops
defer func() {
filebeat.Stop()
filebeat.WaitForLogs("filebeat stopped", 5*time.Second, "did not find the stop message")
}()
filebeat.WaitForLogs("filebeat start running", 20*time.Second, "did not find Filebeat start logs, did Filebeat start correctly?")
filebeat.WaitForLogs("Connection to backoff(elasticsearch(http://localhost:9200)", 2*time.Second, "did not connect to ES")
// filebeat.WaitForLogs("events have been published to elasticsearch in", 5*time.Second, "did not publish events to ES")
filebeat.WaitForLogs("removed state for", 30*time.Second, "did not find log entry about removing state from registry")
*/

0 comments on commit 2f7d96a

Please sign in to comment.