From 2f7d96a02ab6b11ed5b1976be664617be2f2e86a Mon Sep 17 00:00:00 2001 From: Tiago Queiroz Date: Mon, 8 Apr 2024 10:54:59 +0200 Subject: [PATCH] PR improvements - Rename `CleanTimeout` to `CleanInactive` - Remove commented out code --- .../internal/input-logfile/manager.go | 6 +-- filebeat/input/v2/input-cursor/manager.go | 8 ++-- filebeat/tests/integration/filestream_test.go | 40 ------------------- 3 files changed, 7 insertions(+), 47 deletions(-) diff --git a/filebeat/input/filestream/internal/input-logfile/manager.go b/filebeat/input/filestream/internal/input-logfile/manager.go index 8d80127a3e6e..ec25ff60b2f0 100644 --- a/filebeat/input/filestream/internal/input-logfile/manager.go +++ b/filebeat/input/filestream/internal/input-logfile/manager.go @@ -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 } @@ -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 } diff --git a/filebeat/input/v2/input-cursor/manager.go b/filebeat/input/v2/input-cursor/manager.go index e9156a74f790..74dd8a3bd342 100644 --- a/filebeat/input/v2/input-cursor/manager.go +++ b/filebeat/input/v2/input-cursor/manager.go @@ -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 } @@ -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 } diff --git a/filebeat/tests/integration/filestream_test.go b/filebeat/tests/integration/filestream_test.go index 23cb51705dab..3ddb04a2c20c 100644 --- a/filebeat/tests/integration/filestream_test.go +++ b/filebeat/tests/integration/filestream_test.go @@ -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") - - -*/