diff --git a/cmd/internal/backup/providers/gcp/gcp_integration_test.go b/cmd/internal/backup/providers/gcp/gcp_integration_test.go index 6769b4c..6e83c57 100644 --- a/cmd/internal/backup/providers/gcp/gcp_integration_test.go +++ b/cmd/internal/backup/providers/gcp/gcp_integration_test.go @@ -37,11 +37,11 @@ func Test_BackupProviderGCP(t *testing.T) { defer func() { if t.Failed() { r, err := c.Logs(ctx) - assert.NoError(t, err) + require.NoError(t, err) if err == nil { logs, err := io.ReadAll(r) - assert.NoError(t, err) + require.NoError(t, err) fmt.Println(string(logs)) } @@ -113,7 +113,7 @@ func Test_BackupProviderGCP(t *testing.T) { require.NoError(t, err) _, err = versions.Get("foo") - assert.Error(t, err) + require.Error(t, err) allVersions := versions.List() // even if the amount is larger than max backups to keep the fake server @@ -129,7 +129,7 @@ func Test_BackupProviderGCP(t *testing.T) { assert.NotZero(t, v.Date) getVersion, err := versions.Get(v.Version) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, v, getVersion) if i == 0 { diff --git a/cmd/internal/backup/providers/local/local_test.go b/cmd/internal/backup/providers/local/local_test.go index 7da66b1..b7ac455 100644 --- a/cmd/internal/backup/providers/local/local_test.go +++ b/cmd/internal/backup/providers/local/local_test.go @@ -92,7 +92,7 @@ func Test_BackupProviderLocal(t *testing.T) { require.NoError(t, err) _, err = versions.Get("foo") - assert.Error(t, err) + require.Error(t, err) allVersions := versions.List() amount := backupAmount @@ -108,7 +108,7 @@ func Test_BackupProviderLocal(t *testing.T) { assert.NotZero(t, v.Date) getVersion, err := versions.Get(v.Version) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, v, getVersion) if i == 0 { diff --git a/cmd/internal/backup/providers/s3/s3_integration_test.go b/cmd/internal/backup/providers/s3/s3_integration_test.go index d62e184..f79d8fa 100644 --- a/cmd/internal/backup/providers/s3/s3_integration_test.go +++ b/cmd/internal/backup/providers/s3/s3_integration_test.go @@ -33,11 +33,11 @@ func Test_BackupProviderS3(t *testing.T) { defer func() { if t.Failed() { r, err := c.Logs(ctx) - assert.NoError(t, err) + require.NoError(t, err) if err == nil { logs, err := io.ReadAll(r) - assert.NoError(t, err) + require.NoError(t, err) fmt.Println(string(logs)) } @@ -109,7 +109,7 @@ func Test_BackupProviderS3(t *testing.T) { require.NoError(t, err) _, err = versions.Get("foo") - assert.Error(t, err) + require.Error(t, err) allVersions := versions.List() require.Len(t, allVersions, backupAmount) @@ -123,7 +123,7 @@ func Test_BackupProviderS3(t *testing.T) { assert.NotZero(t, v.Date) getVersion, err := versions.Get(v.Version) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, v, getVersion) if i == 0 { diff --git a/cmd/internal/database/meilisearch/meilisearch.go b/cmd/internal/database/meilisearch/meilisearch.go index 05cb812..b83e828 100644 --- a/cmd/internal/database/meilisearch/meilisearch.go +++ b/cmd/internal/database/meilisearch/meilisearch.go @@ -80,7 +80,10 @@ func (db *Meilisearch) Backup(ctx context.Context) error { db.log.Infow("dump creation triggered", "taskUUID", dumpResponse.TaskUID) - dumpTask, err := db.client.WaitForTask(dumpResponse.TaskUID, meilisearch.WaitParams{Context: ctx}) + dumpTask, err := db.client.WaitForTask(dumpResponse.TaskUID, meilisearch.WaitParams{ + Context: ctx, + Interval: time.Millisecond * 50, + }) if err != nil { return err } diff --git a/cmd/internal/initializer/service.go b/cmd/internal/initializer/service.go index ca7905d..5a9b9fc 100644 --- a/cmd/internal/initializer/service.go +++ b/cmd/internal/initializer/service.go @@ -49,7 +49,7 @@ func (s *backupService) ListBackups(ctx context.Context, _ *v1.ListBackupsReques response := &v1.BackupListResponse{} for _, b := range backups { b := b - response.Backups = append(response.Backups, &v1.Backup{ + response.Backups = append(response.GetBackups(), &v1.Backup{ Name: b.Name, Version: b.Version, Timestamp: timestamppb.New(b.Date), @@ -60,7 +60,7 @@ func (s *backupService) ListBackups(ctx context.Context, _ *v1.ListBackupsReques } func (s *backupService) RestoreBackup(ctx context.Context, req *v1.RestoreBackupRequest) (*v1.RestoreBackupResponse, error) { - if req.Version == "" { + if req.GetVersion() == "" { return nil, status.Error(codes.InvalidArgument, "version to restore must be defined explicitly") } @@ -69,7 +69,7 @@ func (s *backupService) RestoreBackup(ctx context.Context, req *v1.RestoreBackup return nil, status.Error(codes.Internal, err.Error()) } - version, err := versions.Get(req.Version) + version, err := versions.Get(req.GetVersion()) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/cmd/internal/wait/wait.go b/cmd/internal/wait/wait.go index 53bb766..95ff4b3 100644 --- a/cmd/internal/wait/wait.go +++ b/cmd/internal/wait/wait.go @@ -34,12 +34,12 @@ func Start(ctx context.Context, log *zap.SugaredLogger, addr string) error { continue } - if resp.Status == v1.StatusResponse_DONE { - log.Infow("initializer succeeded, database can be started", "message", resp.Message) + if resp.GetStatus() == v1.StatusResponse_DONE { + log.Infow("initializer succeeded, database can be started", "message", resp.GetMessage()) return nil } - log.Infow("initializer has not yet succeeded", "status", resp.Status, "message", resp.Message) + log.Infow("initializer has not yet succeeded", "status", resp.GetStatus(), "message", resp.GetMessage()) } } } diff --git a/cmd/main.go b/cmd/main.go index a197462..cb46174 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -222,8 +222,8 @@ var restoreListCmd = &cobra.Command{ } var data [][]string - for _, b := range backups.Backups { - data = append(data, []string{b.Timestamp.AsTime().String(), b.Name, b.Version}) + for _, b := range backups.GetBackups() { + data = append(data, []string{b.GetTimestamp().AsTime().String(), b.GetName(), b.GetVersion()}) } p := utils.NewTablePrinter() diff --git a/integration/main_test.go b/integration/main_test.go index 4aaf410..ad0bc89 100644 --- a/integration/main_test.go +++ b/integration/main_test.go @@ -126,11 +126,11 @@ func restoreFlow(t *testing.T, spec *flowSpec) { return err } - if len(backups.Backups) == 0 { + if len(backups.GetBackups()) == 0 { return fmt.Errorf("no backups were made yet") } - backup = backups.Backups[0] + backup = backups.GetBackups()[0] return nil }, retry.Context(ctx), retry.Attempts(0), retry.MaxDelay(2*time.Second)) @@ -251,11 +251,11 @@ func upgradeFlow(t *testing.T, spec *upgradeFlowSpec) { return err } - if len(backups.Backups) == 0 { + if len(backups.GetBackups()) == 0 { return fmt.Errorf("no backups were made yet") } - backup = backups.Backups[0] + backup = backups.GetBackups()[0] return nil }, retry.Context(ctx), retry.Attempts(0), retry.MaxDelay(2*time.Second))