diff --git a/createdLessonsImporter_test.go b/createdLessonsImporter_test.go index c8ad0ee..c899d98 100644 --- a/createdLessonsImporter_test.go +++ b/createdLessonsImporter_test.go @@ -11,7 +11,7 @@ import ( dekanatEvents "github.com/kneu-messenger-pigeon/dekanat-events" "github.com/kneu-messenger-pigeon/events" eventsMocks "github.com/kneu-messenger-pigeon/events/mocks" - "github.com/kneu-messenger-pigeon/fileStorage" + fileStorageMocks "github.com/kneu-messenger-pigeon/fileStorage/mocks" "github.com/segmentio/kafka-go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -104,7 +104,7 @@ func TestExecuteImportCreatedLesson(t *testing.T) { ) dbMock.ExpectRollback() - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return([]byte{}, nil) fileStorageMock.On("Set", uintToBytes(expectedEvent.Id)).Once().Return(nil) @@ -182,7 +182,7 @@ func TestExecuteImportCreatedLesson(t *testing.T) { ) dbMock.ExpectRollback() - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(nil, nil) fileStorageMock.On("Set", uintToBytes(expectedEvent.Id)).Once().Return(nil) @@ -268,7 +268,7 @@ func TestExecuteImportCreatedLesson(t *testing.T) { ) dbMock.ExpectRollback() - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(nil, nil) fileStorageMock.On("Set", uintToBytes(expectedEvent.Id)).Once().Return(nil) @@ -359,7 +359,7 @@ func TestExecuteImportCreatedLesson(t *testing.T) { ) dbMock.ExpectRollback() - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(uintToBytes(lastLessonId), nil) fileStorageMock.On("Set", uintToBytes(expectedEvent.Id)).Once().Return(nil) @@ -417,7 +417,7 @@ func TestImportCreatedLesson(t *testing.T) { db, dbMock, _ := sqlmock.New() dbMock.ExpectBegin().WillReturnError(expectedError) - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(uintToBytes(lastLessonId), nil) writerMock := eventsMocks.NewWriterInterface(t) @@ -465,7 +465,7 @@ func TestGetMaxLessonId(t *testing.T) { t.Run("Fail get max Lesson id", func(t *testing.T) { expectedError := errors.New("expected error") - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(nil, expectedError) createdLessonsImporter := &CreatedLessonsImporter{ @@ -487,7 +487,7 @@ func TestSetMaxLessonId(t *testing.T) { expectedError := errors.New("expected error") expectedLessonMaxId := uint(20) - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Set", uintToBytes(expectedLessonMaxId)).Once().Return(expectedError) createdLessonsImporter := &CreatedLessonsImporter{ @@ -505,7 +505,7 @@ func TestSetMaxLessonId(t *testing.T) { t.Run("Lesson max id chan", func(t *testing.T) { expectedLessonMaxId := uint(50) - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Set", uintToBytes(expectedLessonMaxId)).Once().Return(nil) createdLessonsImporter := &CreatedLessonsImporter{ diff --git a/currentYearWatcher_test.go b/currentYearWatcher_test.go index e5c3330..2cfaaa7 100644 --- a/currentYearWatcher_test.go +++ b/currentYearWatcher_test.go @@ -7,7 +7,7 @@ import ( "errors" "github.com/kneu-messenger-pigeon/events" "github.com/kneu-messenger-pigeon/events/mocks" - "github.com/kneu-messenger-pigeon/fileStorage" + fileStorageMocks "github.com/kneu-messenger-pigeon/fileStorage/mocks" "github.com/segmentio/kafka-go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -20,7 +20,7 @@ func TestExecuteCurrentYearWatcher(t *testing.T) { var out bytes.Buffer reader := mocks.NewReaderInterface(t) - storage := fileStorage.NewMockInterface(t) + storage := fileStorageMocks.NewInterface(t) storage.On("Get").Return(nil, nil) currentYearWatcher := CurrentYearWatcher{ @@ -69,7 +69,7 @@ func TestExecuteCurrentYearWatcher(t *testing.T) { }, nil) reader.On("CommitMessages", matchContext, message).Return(expectedError) - storage := fileStorage.NewMockInterface(t) + storage := fileStorageMocks.NewInterface(t) storage.On("Get").Return(uintToBytes(2024), nil) storage.On( "Set", @@ -125,7 +125,7 @@ func TestExecuteCurrentYearWatcher(t *testing.T) { return message }, expectedError) - storage := fileStorage.NewMockInterface(t) + storage := fileStorageMocks.NewInterface(t) storage.On("Get").Return(uintToBytes(2024), nil) currentYearWatcher := CurrentYearWatcher{ @@ -173,7 +173,7 @@ func TestExecuteCurrentYearWatcher(t *testing.T) { return message }, nil) - storage := fileStorage.NewMockInterface(t) + storage := fileStorageMocks.NewInterface(t) storage.On("Get").Return(uintToBytes(2024), nil) storage.On( "Set", diff --git a/go.mod b/go.mod index 3a63aab..49b108b 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/joho/godotenv v1.4.0 github.com/kneu-messenger-pigeon/dekanat-events v0.1.10 github.com/kneu-messenger-pigeon/events v0.1.41 - github.com/kneu-messenger-pigeon/fileStorage v1.1.2 + github.com/kneu-messenger-pigeon/fileStorage v1.1.4 github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.2 github.com/mattn/go-sqlite3 v1.14.16 github.com/nakagami/firebirdsql v0.9.4 diff --git a/go.sum b/go.sum index 04a173a..888fb5d 100644 --- a/go.sum +++ b/go.sum @@ -59,6 +59,10 @@ github.com/kneu-messenger-pigeon/fileStorage v1.1.1 h1:+UnSwQ2ADQq41WemAl0LvvGMY github.com/kneu-messenger-pigeon/fileStorage v1.1.1/go.mod h1:v6IRKfG5C45B6Ls6781bmnLNwAE3e6ZcWuU0N55l66M= github.com/kneu-messenger-pigeon/fileStorage v1.1.2 h1:kH8AklG9rTxF1t8+ZdjALizAXOh9QCYV1qEwk8pPTfA= github.com/kneu-messenger-pigeon/fileStorage v1.1.2/go.mod h1:v6IRKfG5C45B6Ls6781bmnLNwAE3e6ZcWuU0N55l66M= +github.com/kneu-messenger-pigeon/fileStorage v1.1.3 h1:tb6u8VFxaQUfrV6NUdKjAmRX7T4QzPFLXHdrLwa17NE= +github.com/kneu-messenger-pigeon/fileStorage v1.1.3/go.mod h1:v6IRKfG5C45B6Ls6781bmnLNwAE3e6ZcWuU0N55l66M= +github.com/kneu-messenger-pigeon/fileStorage v1.1.4 h1:wFBmG9tQV2PBEwfsa3bWS1RnfHpK+bSsINmDrO34gbw= +github.com/kneu-messenger-pigeon/fileStorage v1.1.4/go.mod h1:v6IRKfG5C45B6Ls6781bmnLNwAE3e6ZcWuU0N55l66M= github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.2 h1:jtKQpIefoZBJzgniS4+wM/HU+IgAPkhdOZa4B52RZA0= github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.2/go.mod h1:HxDZwQUrMLgZNdLFT1llblZ7Zj6EBpBk7+9tcU4NZCk= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= diff --git a/updatedScoresImporter_test.go b/updatedScoresImporter_test.go index 5488077..6953360 100644 --- a/updatedScoresImporter_test.go +++ b/updatedScoresImporter_test.go @@ -11,7 +11,7 @@ import ( dekanatEvents "github.com/kneu-messenger-pigeon/dekanat-events" "github.com/kneu-messenger-pigeon/events" eventsMocks "github.com/kneu-messenger-pigeon/events/mocks" - "github.com/kneu-messenger-pigeon/fileStorage" + fileStorageMocks "github.com/kneu-messenger-pigeon/fileStorage/mocks" "github.com/segmentio/kafka-go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -122,7 +122,7 @@ func TestExecuteImportUpdatedScores(t *testing.T) { dbMock.ExpectRollback() - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Times(2).Return(nil, nil) fileStorageMock.On("Set", timeToBytes(expectedEvent.UpdatedAt)).Once().Return(nil) @@ -226,7 +226,7 @@ func TestExecuteImportUpdatedScores(t *testing.T) { ) dbMock.ExpectRollback() - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(timeToBytes(lastRegDate), nil) writerMock := eventsMocks.NewWriterInterface(t) @@ -332,7 +332,7 @@ func TestExecuteImportUpdatedScores(t *testing.T) { ) dbMock.ExpectRollback() - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(timeToBytes(lastRegDate), nil) fileStorageMock.On( "Set", timeToBytes(expectedEvent.UpdatedAt), @@ -421,7 +421,7 @@ func TestImportUpdatedScoresLesson(t *testing.T) { db, dbMock, _ := sqlmock.New() dbMock.ExpectBegin().WillReturnError(expectedError) - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(nil, nil) writerMock := eventsMocks.NewWriterInterface(t) @@ -476,7 +476,7 @@ func TestGetLastRegDate(t *testing.T) { out.Reset() expectedError := errors.New("expected error") - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On("Get").Once().Return(nil, expectedError) updatedLessonsImporter := &UpdatedScoresImporter{ @@ -506,7 +506,7 @@ func TestSetLastRegDate(t *testing.T) { 0, now.Location(), ).Add(-time.Minute * 10) - fileStorageMock := fileStorage.NewMockInterface(t) + fileStorageMock := fileStorageMocks.NewInterface(t) fileStorageMock.On( "Set", timeToBytes(newLastRegDate), ).Once().Return(expectedError)