Skip to content

Commit

Permalink
fix: delete log even if nothing was uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDombo committed Nov 16, 2023
1 parent 212328c commit bcd235e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public long totalSizeInBytes() {
public boolean hasExceededDiskUsage() {
return this.maxBytes
.map((val) -> this.totalSizeInBytes() > val)
.orElse(false);
.orElseGet(() -> false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ Feature: Greengrass V2 LogManager
Scenario: LogManager-1-T3: As a customer I can configure the logs uploader to delete log oldest log files to keep the
disk space limit specified on the configuration
Given 15 temporary rotated log files for component UserComponentB have been created
And 15 temporary rotated log files for component UserComponentC have been created
And 5 temporary rotated log files for component aws.greengrass.Nucleus have been created
And 5 temporary rotated log files for component UserComponentA have been created
Given I create a Greengrass deployment with components
Expand All @@ -168,6 +169,15 @@ Feature: Greengrass V2 LogManager
"logFileDirectoryPath": "${UserComponentBLogDirectory}",
"diskSpaceLimit":"100",
"diskSpaceLimitUnit":"KB",
"minimumLogLevel": "WARN",
"uploadToCloudWatch": "true",
"deleteLogFileAfterCloudUpload": "false"
},
"UserComponentC": {
"logFileRegex": "UserComponentC_(.)+.log",
"logFileDirectoryPath": "${UserComponentCLogDirectory}",
"diskSpaceLimit":"100",
"diskSpaceLimitUnit":"KB",
"minimumLogLevel": "INFO",
"uploadToCloudWatch": "true",
"deleteLogFileAfterCloudUpload": "false"
Expand All @@ -189,7 +199,8 @@ Feature: Greengrass V2 LogManager
Then the Greengrass deployment is COMPLETED on the device after 3 minutes
Then I verify the aws.greengrass.LogManager component is RUNNING using the greengrass-cli
And I wait 5 seconds
Then I verify that 15 log files for component UserComponentB are still available
Then I verify that 9 log files for component UserComponentB are still available
And I verify that 9 log files for component UserComponentC are still available

@network
Scenario: LogManager-1-T4: As a developer, logs uploader will handle network interruptions gracefully and upload logs from the last uploaded log after network resumes
Expand Down

0 comments on commit bcd235e

Please sign in to comment.