Skip to content

Commit

Permalink
rename sleep variable
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-mateen committed Sep 15, 2023
1 parent 9cfb376 commit acd694f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/cloudwatchlogs/publish_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,25 @@ func TestAutoRemovalStopAgent(t *testing.T) {
// Use instance id so 2 tests in parallel on different machines do not conflict.
instanceId := awsservice.GetInstanceId()
defer awsservice.DeleteLogGroupAndStream(instanceId, instanceId)
configPath := "resources/config_auto_removal.json"
fpath := logFilePath + "1"
f, err := os.Create(fpath)
if err != nil {
t.Fatalf("Error occurred creating log file for writing: %v", err)
}
defer f.Close()
defer os.Remove(fpath)
configPath := "resources/config_auto_removal.json"
common.StartAgent(configPath, true, false)
time.Sleep(agentRuntime)
// Sleep 20 seconds before and after writing the file to ensure the agent reads it.
sleepTime := time.Second*20
time.Sleep(sleepTime)
writeLogs(t, f, 1000)
time.Sleep(agentRuntime)
time.Sleep(sleepTime)
common.StopAgent()
time.Sleep(agentRuntime)
time.Sleep(sleepTime)
assert.FileExists(t, fpath, "file does not exist, {}", fpath)
common.StartAgent(configPath, true, false)
time.Sleep(agentRuntime)
time.Sleep(sleepTime)
assert.FileExists(t, fpath, "file does not exist, {}", fpath)
}

Expand Down

0 comments on commit acd694f

Please sign in to comment.