Provisioning: Cleanup tester interface (#110640)

* Provisioning: Cleanup tester interface

* undo accidental change

* cleanup

* cleanup test
This commit is contained in:
Stephanie Hingtgen
2025-09-05 07:47:27 +02:00
committed by GitHub
parent c9eecf850b
commit 9ddc70423b
9 changed files with 30 additions and 126 deletions
-9
View File
@@ -12,15 +12,6 @@ import (
provisioning "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1"
)
// Tester is a struct that implements the Tester interface
// it's temporary
// FIXME: remove as soon as controller and jobs refactoring PRs are merged
type Tester struct{}
func (t *Tester) TestRepository(ctx context.Context, repo Repository) (*provisioning.TestResults, error) {
return TestRepository(ctx, repo)
}
func TestRepository(ctx context.Context, repo Repository) (*provisioning.TestResults, error) {
errors := ValidateRepository(repo)
if len(errors) > 0 {
@@ -360,9 +360,6 @@ func TestTestRepository(t *testing.T) {
}
func TestTester_TestRepository(t *testing.T) {
tester := &Tester{}
// Test that it properly delegates to TestRepository
repository := NewMockRepository(t)
repository.On("Config").Return(&provisioning.Repository{
Spec: provisioning.RepositorySpec{
@@ -375,7 +372,7 @@ func TestTester_TestRepository(t *testing.T) {
Success: true,
}, nil)
results, err := tester.TestRepository(context.Background(), repository)
results, err := TestRepository(context.Background(), repository)
require.NoError(t, err)
require.NotNil(t, results)
require.Equal(t, http.StatusOK, results.Code)