update the event type messages
This commit is contained in:
@@ -9,10 +9,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/api/response"
|
"github.com/grafana/grafana/pkg/api/response"
|
||||||
"github.com/grafana/grafana/pkg/api/routing"
|
"github.com/grafana/grafana/pkg/api/routing"
|
||||||
"github.com/grafana/grafana/pkg/infra/db"
|
"github.com/grafana/grafana/pkg/infra/db"
|
||||||
@@ -29,6 +25,9 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/gcom"
|
"github.com/grafana/grafana/pkg/services/gcom"
|
||||||
"github.com/grafana/grafana/pkg/services/secrets"
|
"github.com/grafana/grafana/pkg/services/secrets"
|
||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Service Define the cloudmigration.Service Implementation.
|
// Service Define the cloudmigration.Service Implementation.
|
||||||
@@ -78,7 +77,7 @@ func ProvideService(
|
|||||||
folderService folder.Service,
|
folderService folder.Service,
|
||||||
) (cloudmigration.Service, error) {
|
) (cloudmigration.Service, error) {
|
||||||
if !features.IsEnabledGlobally(featuremgmt.FlagOnPremToCloudMigrations) {
|
if !features.IsEnabledGlobally(featuremgmt.FlagOnPremToCloudMigrations) {
|
||||||
return &noopServiceImpl{}, nil
|
return &NoopServiceImpl{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
s := &Service{
|
s := &Service{
|
||||||
|
|||||||
@@ -7,55 +7,55 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/gcom"
|
"github.com/grafana/grafana/pkg/services/gcom"
|
||||||
)
|
)
|
||||||
|
|
||||||
// noopServiceImpl Define the Service Implementation.
|
// NoopServiceImpl Define the Service Implementation.
|
||||||
type noopServiceImpl struct{}
|
type NoopServiceImpl struct{}
|
||||||
|
|
||||||
var _ cloudmigration.Service = (*noopServiceImpl)(nil)
|
var _ cloudmigration.Service = (*NoopServiceImpl)(nil)
|
||||||
|
|
||||||
func (s *noopServiceImpl) GetToken(ctx context.Context) (gcom.TokenView, error) {
|
func (s *NoopServiceImpl) GetToken(ctx context.Context) (gcom.TokenView, error) {
|
||||||
return gcom.TokenView{}, cloudmigration.ErrFeatureDisabledError
|
return gcom.TokenView{}, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) CreateToken(ctx context.Context) (cloudmigration.CreateAccessTokenResponse, error) {
|
func (s *NoopServiceImpl) CreateToken(ctx context.Context) (cloudmigration.CreateAccessTokenResponse, error) {
|
||||||
return cloudmigration.CreateAccessTokenResponse{}, cloudmigration.ErrFeatureDisabledError
|
return cloudmigration.CreateAccessTokenResponse{}, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) DeleteToken(ctx context.Context, uid string) error {
|
func (s *NoopServiceImpl) DeleteToken(ctx context.Context, uid string) error {
|
||||||
return cloudmigration.ErrFeatureDisabledError
|
return cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) ValidateToken(ctx context.Context, cm cloudmigration.CloudMigrationSession) error {
|
func (s *NoopServiceImpl) ValidateToken(ctx context.Context, cm cloudmigration.CloudMigrationSession) error {
|
||||||
return cloudmigration.ErrFeatureDisabledError
|
return cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) GetSession(ctx context.Context, uid string) (*cloudmigration.CloudMigrationSession, error) {
|
func (s *NoopServiceImpl) GetSession(ctx context.Context, uid string) (*cloudmigration.CloudMigrationSession, error) {
|
||||||
return nil, cloudmigration.ErrFeatureDisabledError
|
return nil, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) GetSessionList(ctx context.Context) (*cloudmigration.CloudMigrationSessionListResponse, error) {
|
func (s *NoopServiceImpl) GetSessionList(ctx context.Context) (*cloudmigration.CloudMigrationSessionListResponse, error) {
|
||||||
return nil, cloudmigration.ErrFeatureDisabledError
|
return nil, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) CreateSession(ctx context.Context, cm cloudmigration.CloudMigrationSessionRequest) (*cloudmigration.CloudMigrationSessionResponse, error) {
|
func (s *NoopServiceImpl) CreateSession(ctx context.Context, cm cloudmigration.CloudMigrationSessionRequest) (*cloudmigration.CloudMigrationSessionResponse, error) {
|
||||||
return nil, cloudmigration.ErrFeatureDisabledError
|
return nil, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) GetMigrationStatus(ctx context.Context, runUID string) (*cloudmigration.CloudMigrationSnapshot, error) {
|
func (s *NoopServiceImpl) GetMigrationStatus(ctx context.Context, runUID string) (*cloudmigration.CloudMigrationSnapshot, error) {
|
||||||
return nil, cloudmigration.ErrFeatureDisabledError
|
return nil, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) GetMigrationRunList(ctx context.Context, uid string) (*cloudmigration.SnapshotList, error) {
|
func (s *NoopServiceImpl) GetMigrationRunList(ctx context.Context, uid string) (*cloudmigration.SnapshotList, error) {
|
||||||
return nil, cloudmigration.ErrFeatureDisabledError
|
return nil, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) DeleteSession(ctx context.Context, uid string) (*cloudmigration.CloudMigrationSession, error) {
|
func (s *NoopServiceImpl) DeleteSession(ctx context.Context, uid string) (*cloudmigration.CloudMigrationSession, error) {
|
||||||
return nil, cloudmigration.ErrFeatureDisabledError
|
return nil, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) CreateMigrationRun(context.Context, cloudmigration.CloudMigrationSnapshot) (string, error) {
|
func (s *NoopServiceImpl) CreateMigrationRun(context.Context, cloudmigration.CloudMigrationSnapshot) (string, error) {
|
||||||
return "", cloudmigration.ErrInternalNotImplementedError
|
return "", cloudmigration.ErrInternalNotImplementedError
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *noopServiceImpl) RunMigration(context.Context, string) (*cloudmigration.MigrateDataResponse, error) {
|
func (s *NoopServiceImpl) RunMigration(context.Context, string) (*cloudmigration.MigrateDataResponse, error) {
|
||||||
return nil, cloudmigration.ErrFeatureDisabledError
|
return nil, cloudmigration.ErrFeatureDisabledError
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/stretchr/testify/mock"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/api/routing"
|
"github.com/grafana/grafana/pkg/api/routing"
|
||||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||||
"github.com/grafana/grafana/pkg/infra/db"
|
"github.com/grafana/grafana/pkg/infra/db"
|
||||||
@@ -26,10 +20,15 @@ import (
|
|||||||
secretsfakes "github.com/grafana/grafana/pkg/services/secrets/fakes"
|
secretsfakes "github.com/grafana/grafana/pkg/services/secrets/fakes"
|
||||||
"github.com/grafana/grafana/pkg/services/user"
|
"github.com/grafana/grafana/pkg/services/user"
|
||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"go.opentelemetry.io/otel/sdk/trace/tracetest"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_noopServiceDoesNothing(t *testing.T) {
|
func Test_NoopServiceDoesNothing(t *testing.T) {
|
||||||
s := &noopServiceImpl{}
|
s := &NoopServiceImpl{}
|
||||||
_, e := s.CreateToken(context.Background())
|
_, e := s.CreateToken(context.Background())
|
||||||
assert.ErrorIs(t, e, cloudmigration.ErrFeatureDisabledError)
|
assert.ErrorIs(t, e, cloudmigration.ErrFeatureDisabledError)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user