Skip to content

Commit

Permalink
[Disk Manager] move metrics/mocks to tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Montsev committed Jan 8, 2024
1 parent d14cba1 commit 30aab08
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/dataplane/test"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/logging"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/monitoring/metrics"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/monitoring/metrics/mocks"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/persistence"
persistence_config "github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/persistence/config"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/tasks/errors"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/tasks/metrics/mocks"
)

////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 0 additions & 4 deletions cloud/disk_manager/internal/pkg/monitoring/metrics/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ SRCS(
)

END()

RECURSE(
mocks
)
3 changes: 3 additions & 0 deletions cloud/disk_manager/internal/pkg/tasks/metrics/ya.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RECURSE(
mocks
)
56 changes: 28 additions & 28 deletions cloud/disk_manager/internal/pkg/tasks/storage/storage_ydb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"github.com/stretchr/testify/require"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/logging"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/monitoring/metrics"
metrics_mocks "github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/monitoring/metrics/mocks"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/persistence"
persistence_config "github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/persistence/config"
tasks_config "github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/tasks/config"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/tasks/errors"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/tasks/metrics/mocks"
grpc_codes "google.golang.org/grpc/codes"
)

Expand Down Expand Up @@ -87,7 +87,7 @@ func TestStorageYDBCreateTask(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestStorageYDBCreateTaskIgnoresID(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -167,7 +167,7 @@ func TestStorageYDBCreateTwoTasks(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -218,7 +218,7 @@ func TestStorageYDBCreateTwoTasksWithDifferentIdempotencyIDs(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -270,7 +270,7 @@ func TestStorageYDBCreateTwoTasksWithTheSameIdempotencyID(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -316,7 +316,7 @@ func TestStorageYDBGetTask(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -376,7 +376,7 @@ func TestStorageYDBGetTaskWithDependencies(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -462,7 +462,7 @@ func TestStorageYDBGetTaskMissing(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2526,7 +2526,7 @@ func TestStorageYDBLockTaskToRun(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2579,7 +2579,7 @@ func TestStorageYDBLockTaskToRunWrongGeneration(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2625,7 +2625,7 @@ func TestStorageYDBLockTaskToRunWrongState(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2672,7 +2672,7 @@ func TestStorageYDBLockTaskToCancel(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2725,7 +2725,7 @@ func TestStorageYDBLockTaskToCancelWrongGeneration(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2771,7 +2771,7 @@ func TestStorageYDBLockTaskToCancelWrongState(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2818,7 +2818,7 @@ func TestStorageYDBMarkForCancellation(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2870,7 +2870,7 @@ func TestStorageYDBMarkForCancellationAlready(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2920,7 +2920,7 @@ func TestStorageYDBMarkForCancellationFinished(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -2969,7 +2969,7 @@ func TestStorageYDBUpdateTask(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3097,7 +3097,7 @@ func TestStorageYDBUpdateTaskStatus(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3187,7 +3187,7 @@ func TestStorageYDBUpdateTaskWrongGeneration(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3246,7 +3246,7 @@ func TestStorageYDBLockInParallel(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3311,7 +3311,7 @@ func TestStorageYDBMarkForCancellationInParallel(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3368,7 +3368,7 @@ func TestStorageYDBLockAlreadyCancellingTask(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3421,7 +3421,7 @@ func TestStorageYDBCheckStallingTimeout(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3471,7 +3471,7 @@ func TestStorageYDBCreateRegularTasks(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3605,7 +3605,7 @@ func TestStorageYDBClearEndedTasks(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down Expand Up @@ -3730,7 +3730,7 @@ func TestStorageYDBPauseResumeTask(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

metricsRegistry := metrics_mocks.NewRegistryMock()
metricsRegistry := mocks.NewRegistryMock()

taskStallingTimeout := "1s"
storage, err := newStorage(t, ctx, db, &tasks_config.TasksConfig{
Expand Down
1 change: 1 addition & 0 deletions cloud/disk_manager/internal/pkg/tasks/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RECURSE(

RECURSE_FOR_TESTS(
acceptance_tests
metrics
mocks
tasks_tests
tests
Expand Down

0 comments on commit 30aab08

Please sign in to comment.