fix: add API test coverage and fix minor bugs

This commit is contained in:
garethgeorge
2024-02-03 18:08:42 -08:00
parent 4a565f2cdc
commit f5bb74bf24
5 changed files with 302 additions and 7 deletions

View File

@@ -67,6 +67,11 @@ func (s *BackrestHandler) SetConfig(ctx context.Context, req *connect.Request[v1
if existing.Modno != req.Msg.Modno {
return nil, errors.New("config modno mismatch, reload and try again")
}
if err := config.ValidateConfig(req.Msg); err != nil {
return nil, fmt.Errorf("validation error: %w", err)
}
req.Msg.Modno += 1
if err := s.config.Update(req.Msg); err != nil {