Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 committed Oct 5, 2023
1 parent 994f688 commit 079dcbc
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ func (creator *LogFileCreator) CreateLogFiles(ctx context.Context) error {
func (creator *LogFileCreator) getEnclaveAndServiceInfo(ctx context.Context) (map[enclave.EnclaveUUID][]*service.ServiceRegistration, error) {
enclaveToServicesMap := map[enclave.EnclaveUUID][]*service.ServiceRegistration{}

enclaves, err := creator.kurtosisBackend.GetEnclaves(ctx, &enclave.EnclaveFilters{})
enclaves, err := creator.kurtosisBackend.GetEnclaves(ctx, &enclave.EnclaveFilters{UUIDs: nil, Statuses: nil})
if err != nil {
return nil, stacktrace.Propagate(err, "An error occurred while trying to get all enclaves from kurtosis backend.")
}
for enclaveUuid := range enclaves {
var serviceRegistrations []*service.ServiceRegistration

enclaveServices, err := creator.kurtosisBackend.GetUserServices(ctx, enclaveUuid, &service.ServiceFilters{})
enclaveServices, err := creator.kurtosisBackend.GetUserServices(ctx, enclaveUuid, &service.ServiceFilters{Names: nil, UUIDs: nil, Statuses: nil})
if err != nil {
return nil, stacktrace.Propagate(err, "An error occurred while trying to get user services for enclave '%v' from kurtosis backend.", enclaveUuid)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ func TestLogRemover_Run(t *testing.T) {
week1filepath := getWeekFilepathStr(2023, 1)
week2filepath := getWeekFilepathStr(2023, 2)

mockFs.Create(week49filepath)
mockFs.Create(week50filepath)
mockFs.Create(week51filepath)
mockFs.Create(week52filepath)
mockFs.Create(week1filepath)
mockFs.Create(week2filepath)
_, _ = mockFs.Create(week49filepath)
_, _ = mockFs.Create(week50filepath)
_, _ = mockFs.Create(week51filepath)
_, _ = mockFs.Create(week52filepath)
_, _ = mockFs.Create(week1filepath)
_, _ = mockFs.Create(week2filepath)

currentWeek := 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func TestStreamUserServiceLogs_ThousandsOfLogLinesSuccessfulExecution(t *testing

file1PathStr := fmt.Sprintf(volume_consts.PerFileFmtStr, volume_consts.LogsStorageDirpath, string(enclaveUuid), testUserService1Uuid, volume_consts.Filetype)
file1, _ := underlyingFs.Create(file1PathStr)
file1.WriteString(logLinesStr)
_, _ = file1.WriteString(logLinesStr)

perFileStreamStrategy := stream_logs_strategy.NewPerFileStreamLogsStrategy()

Expand Down Expand Up @@ -309,7 +309,7 @@ func TestStreamUserServiceLogsPerWeek_ThousandsOfLogLinesSuccessfulExecution(t *
underlyingFs := volume_filesystem.NewMockedVolumeFilesystem()
file1PathStr := fmt.Sprintf(volume_consts.PerWeekFilePathFmtStr, volume_consts.LogsStorageDirpath, strconv.Itoa(defaultYear), strconv.Itoa(startingWeek), string(enclaveUuid), testUserService1Uuid, volume_consts.Filetype)
file1, _ := underlyingFs.Create(file1PathStr)
file1.WriteString(logLinesStr)
_, _ = file1.WriteString(logLinesStr)

mockTime := logs_clock.NewMockLogsClock(defaultYear, startingWeek, defaultDay)
perWeekStreamStrategy := stream_logs_strategy.NewPerWeekStreamLogsStrategy(mockTime)
Expand Down Expand Up @@ -352,7 +352,7 @@ func TestStreamUserServiceLogs_EmptyLogLines(t *testing.T) {
underlyingFs := volume_filesystem.NewMockedVolumeFilesystem()
file1PathStr := fmt.Sprintf("%s%s/%s%s", volume_consts.LogsStorageDirpath, string(enclaveUuid), testUserService1Uuid, volume_consts.Filetype)
file1, _ := underlyingFs.Create(file1PathStr)
file1.WriteString(logLinesStr)
_, _ = file1.WriteString(logLinesStr)

perFileStreamStrategy := stream_logs_strategy.NewPerFileStreamLogsStrategy()

Expand Down Expand Up @@ -393,7 +393,7 @@ func TestStreamUserServiceLogsPerWeek_EmptyLogLines(t *testing.T) {
underlyingFs := volume_filesystem.NewMockedVolumeFilesystem()
file1PathStr := fmt.Sprintf(volume_consts.PerWeekFilePathFmtStr, volume_consts.LogsStorageDirpath, strconv.Itoa(defaultYear), strconv.Itoa(startingWeek), string(enclaveUuid), testUserService1Uuid, volume_consts.Filetype)
file1, _ := underlyingFs.Create(file1PathStr)
file1.WriteString(logLinesStr)
_, _ = file1.WriteString(logLinesStr)

mockTime := logs_clock.NewMockLogsClock(defaultYear, startingWeek, defaultDay)
perWeekStreamStrategy := stream_logs_strategy.NewPerWeekStreamLogsStrategy(mockTime)
Expand Down Expand Up @@ -451,11 +451,11 @@ func TestStreamUserServiceLogsPerWeek_WithLogsAcrossWeeks(t *testing.T) {

week4filepath := fmt.Sprintf(volume_consts.PerWeekFilePathFmtStr, volume_consts.LogsStorageDirpath, strconv.Itoa(defaultYear), strconv.Itoa(4), testEnclaveUuid, testUserService1Uuid, volume_consts.Filetype)
week4, _ := underlyingFs.Create(week4filepath)
week4.WriteString(week4logLinesStr)
_, _ = week4.WriteString(week4logLinesStr)

week3filepath := fmt.Sprintf(volume_consts.PerWeekFilePathFmtStr, volume_consts.LogsStorageDirpath, strconv.Itoa(defaultYear), strconv.Itoa(3), testEnclaveUuid, testUserService1Uuid, volume_consts.Filetype)
week3, _ := underlyingFs.Create(week3filepath)
week3.WriteString(week3logLinesStr)
_, _ = week3.WriteString(week3logLinesStr)

mockTime := logs_clock.NewMockLogsClock(defaultYear, 4, defaultDay)
perWeekStreamStrategy := stream_logs_strategy.NewPerWeekStreamLogsStrategy(mockTime)
Expand Down Expand Up @@ -514,11 +514,11 @@ func TestStreamUserServiceLogsPerWeek_WithLogLineAcrossWeeks(t *testing.T) {

week4filepath := fmt.Sprintf(volume_consts.PerWeekFilePathFmtStr, volume_consts.LogsStorageDirpath, strconv.Itoa(defaultYear), strconv.Itoa(4), testEnclaveUuid, testUserService1Uuid, volume_consts.Filetype)
week4, _ := underlyingFs.Create(week4filepath)
week4.WriteString(week4logLinesStr)
_, _ = week4.WriteString(week4logLinesStr)

week3filepath := fmt.Sprintf(volume_consts.PerWeekFilePathFmtStr, volume_consts.LogsStorageDirpath, strconv.Itoa(defaultYear), strconv.Itoa(3), testEnclaveUuid, testUserService1Uuid, volume_consts.Filetype)
week3, _ := underlyingFs.Create(week3filepath)
week3.WriteString(week3logLinesStr)
_, _ = week3.WriteString(week3logLinesStr)

mockTime := logs_clock.NewMockLogsClock(defaultYear, 4, defaultDay)
perWeekStreamStrategy := stream_logs_strategy.NewPerWeekStreamLogsStrategy(mockTime)
Expand Down Expand Up @@ -634,13 +634,13 @@ func createFilledPerFileFilesystem() volume_filesystem.VolumeFilesystem {
mapFs := volume_filesystem.NewMockedVolumeFilesystem()

file1, _ := mapFs.Create(file1PathStr)
file1.WriteString(logLinesStr)
_, _ = file1.WriteString(logLinesStr)

file2, _ := mapFs.Create(file2PathStr)
file2.WriteString(logLinesStr)
_, _ = file2.WriteString(logLinesStr)

file3, _ := mapFs.Create(file3PathStr)
file3.WriteString(logLinesStr)
_, _ = file3.WriteString(logLinesStr)

return mapFs
}
Expand All @@ -657,13 +657,13 @@ func createFilledPerWeekFilesystem(week int) volume_filesystem.VolumeFilesystem
mapFs := volume_filesystem.NewMockedVolumeFilesystem()

file1, _ := mapFs.Create(file1PathStr)
file1.WriteString(logLinesStr)
_, _ = file1.WriteString(logLinesStr)

file2, _ := mapFs.Create(file2PathStr)
file2.WriteString(logLinesStr)
_, _ = file2.WriteString(logLinesStr)

file3, _ := mapFs.Create(file3PathStr)
file3.WriteString(logLinesStr)
_, _ = file3.WriteString(logLinesStr)

return mapFs
}
Expand All @@ -675,9 +675,9 @@ func createEmptyPerFileFilesystem() volume_filesystem.VolumeFilesystem {

mapFs := volume_filesystem.NewMockedVolumeFilesystem()

mapFs.Create(file1PathStr)
mapFs.Create(file2PathStr)
mapFs.Create(file3PathStr)
_, _ = mapFs.Create(file1PathStr)
_, _ = mapFs.Create(file2PathStr)
_, _ = mapFs.Create(file3PathStr)

return mapFs
}
Expand All @@ -689,9 +689,9 @@ func createEmptyPerWeekFilesystem(week int) volume_filesystem.VolumeFilesystem {

mapFs := volume_filesystem.NewMockedVolumeFilesystem()

mapFs.Create(file1PathStr)
mapFs.Create(file2PathStr)
mapFs.Create(file3PathStr)
_, _ = mapFs.Create(file1PathStr)
_, _ = mapFs.Create(file2PathStr)
_, _ = mapFs.Create(file3PathStr)

return mapFs
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func TestGetLogFilePaths(t *testing.T) {
week16filepath := getWeekFilepathStr(defaultYear, 16)
week17filepath := getWeekFilepathStr(defaultYear, 17)

filesystem.Create(week12filepath)
filesystem.Create(week13filepath)
filesystem.Create(week14filepath)
filesystem.Create(week15filepath)
filesystem.Create(week16filepath)
filesystem.Create(week17filepath)
_, _ = filesystem.Create(week12filepath)
_, _ = filesystem.Create(week13filepath)
_, _ = filesystem.Create(week14filepath)
_, _ = filesystem.Create(week15filepath)
_, _ = filesystem.Create(week16filepath)
_, _ = filesystem.Create(week17filepath)

currentWeek := 17

Expand Down Expand Up @@ -72,11 +72,11 @@ func TestGetLogFilePathsAcrossNewYear(t *testing.T) {
week1filepath := getWeekFilepathStr(defaultYear, 1)
week2filepath := getWeekFilepathStr(defaultYear, 2)

filesystem.Create(week50filepath)
filesystem.Create(week51filepath)
filesystem.Create(week52filepath)
filesystem.Create(week1filepath)
filesystem.Create(week2filepath)
_, _ = filesystem.Create(week50filepath)
_, _ = filesystem.Create(week51filepath)
_, _ = filesystem.Create(week52filepath)
_, _ = filesystem.Create(week1filepath)
_, _ = filesystem.Create(week2filepath)

currentWeek := 2

Expand Down Expand Up @@ -109,11 +109,11 @@ func TestGetLogFilePathsAcrossNewYearWith53Weeks(t *testing.T) {
week2filepath := getWeekFilepathStr(2016, 2)
week3filepath := getWeekFilepathStr(2016, 3)

filesystem.Create(week52filepath)
filesystem.Create(week53filepath)
filesystem.Create(week1filepath)
filesystem.Create(week2filepath)
filesystem.Create(week3filepath)
_, _ = filesystem.Create(week52filepath)
_, _ = filesystem.Create(week53filepath)
_, _ = filesystem.Create(week1filepath)
_, _ = filesystem.Create(week2filepath)
_, _ = filesystem.Create(week3filepath)

currentWeek := 3

Expand Down Expand Up @@ -144,9 +144,9 @@ func TestGetLogFilePathsWithDiffRetentionPeriod(t *testing.T) {
week1filepath := getWeekFilepathStr(defaultYear, 1)
week2filepath := getWeekFilepathStr(defaultYear, 2)

filesystem.Create(week52filepath)
filesystem.Create(week1filepath)
filesystem.Create(week2filepath)
_, _ = filesystem.Create(week52filepath)
_, _ = filesystem.Create(week1filepath)
_, _ = filesystem.Create(week2filepath)

currentWeek := 2
retentionPeriod := 2
Expand Down Expand Up @@ -176,9 +176,9 @@ func TestGetLogFilePathsReturnsAllAvailableWeeks(t *testing.T) {
week1filepath := getWeekFilepathStr(defaultYear, 1)
week2filepath := getWeekFilepathStr(defaultYear, 2)

filesystem.Create(week52filepath)
filesystem.Create(week1filepath)
filesystem.Create(week2filepath)
_, _ = filesystem.Create(week52filepath)
_, _ = filesystem.Create(week1filepath)
_, _ = filesystem.Create(week2filepath)

// should return existing file paths even though log files going all the back to retention period don't exist
expectedLogFilePaths := []string{
Expand Down Expand Up @@ -208,9 +208,9 @@ func TestGetLogFilePathsReturnsCorrectPathsIfWeeksMissingInBetween(t *testing.T)
week1filepath := getWeekFilepathStr(defaultYear, 1)
week3filepath := getWeekFilepathStr(defaultYear, 3)

filesystem.Create(week52filepath)
filesystem.Create(week1filepath)
filesystem.Create(week3filepath)
_, _ = filesystem.Create(week52filepath)
_, _ = filesystem.Create(week1filepath)
_, _ = filesystem.Create(week3filepath)

currentWeek := 3

Expand All @@ -235,8 +235,8 @@ func TestGetLogFilePathsReturnsCorrectPathsIfCurrentWeekHasNoLogsYet(t *testing.
week2filepath := getWeekFilepathStr(defaultYear, 2)

// no logs for week current week exist yet
filesystem.Create(week1filepath)
filesystem.Create(week2filepath)
_, _ = filesystem.Create(week1filepath)
_, _ = filesystem.Create(week2filepath)

// should return week 1 and 2 logs, even though no logs for current week yet
expectedLogFilePaths := []string{
Expand Down

0 comments on commit 079dcbc

Please sign in to comment.