Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ben1009 authored and ti-chi-bot committed Dec 14, 2021
1 parent d9150f7 commit 4b86b67
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cdc/redo/writer/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ func TestDeleteAllLogs(t *testing.T) {
}

func TestPreCleanUpS3(t *testing.T) {
tests := []struct {
testCases := []struct {
name string
fileExistsErr error
fileExists bool
Expand Down Expand Up @@ -914,16 +914,16 @@ func TestPreCleanUpS3(t *testing.T) {
},
}

for _, tt := range tests {
for _, tc := range testCases {
origin := getAllFilesInS3
getAllFilesInS3 = func(ctx context.Context, l *LogWriter) ([]string, error) {
return []string{"1", "11", "delete_test-cf"}, tt.getAllFilesInS3Err
return []string{"1", "11", "delete_test-cf"}, tc.getAllFilesInS3Err
}
controller := gomock.NewController(t)
mockStorage := mockstorage.NewMockExternalStorage(controller)

mockStorage.EXPECT().FileExists(gomock.Any(), gomock.Any()).Return(tt.fileExists, tt.fileExistsErr)
mockStorage.EXPECT().DeleteFile(gomock.Any(), gomock.Any()).Return(tt.deleteFileErr).MaxTimes(3)
mockStorage.EXPECT().FileExists(gomock.Any(), gomock.Any()).Return(tc.fileExists, tc.fileExistsErr)
mockStorage.EXPECT().DeleteFile(gomock.Any(), gomock.Any()).Return(tc.deleteFileErr).MaxTimes(3)

cfg := &LogWriterConfig{
Dir: "dir",
Expand All @@ -938,10 +938,10 @@ func TestPreCleanUpS3(t *testing.T) {
storage: mockStorage,
}
ret := writer.preCleanUpS3(context.Background())
if tt.wantErr != "" {
require.Regexp(t, tt.wantErr, ret.Error(), tt.name)
if tc.wantErr != "" {
require.Regexp(t, tc.wantErr, ret.Error(), tc.name)
} else {
require.Nil(t, ret, tt.name)
require.Nil(t, ret, tc.name)
}
getAllFilesInS3 = origin
}
Expand Down

0 comments on commit 4b86b67

Please sign in to comment.