Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gy2411 committed Jan 16, 2025
1 parent bc764a9 commit 709b86c
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions cloud/tasks/tasks_tests/tasks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,39 @@ func createServicesWithConfig(
}
}

func createServices(
func createServicesWithMetricsRegistry(
t *testing.T,
ctx context.Context,
db *persistence.YDBClient,
runnersCount uint64,
schedulerRegistry metrics.Registry,
) services {

config := proto.Clone(newDefaultConfig()).(*tasks_config.TasksConfig)
config.RunnersCount = &runnersCount
config.StalkingRunnersCount = &runnersCount

return createServicesWithConfig(
t,
ctx,
db,
config,
schedulerRegistry,
)
}

func createServices(
t *testing.T,
ctx context.Context,
db *persistence.YDBClient,
runnersCount uint64,
) services {

return createServicesWithMetricsRegistry(
t,
ctx,
db,
runnersCount,
metrics_empty.NewRegistry(),
)
}
Expand Down Expand Up @@ -720,15 +738,16 @@ func TestTasksInflightLimit(t *testing.T) {
require.NoError(t, err)
defer db.Close(ctx)

runnersCount := uint64(3 * inflightLongTaskPerNodeLimit)
config := proto.Clone(newDefaultConfig()).(*tasks_config.TasksConfig)
config.RunnersCount = &runnersCount
config.StalkingRunnersCount = &runnersCount

registry := mocks.NewIgnoreUnknownCallsRegistryMock()
defer registry.AssertAllExpectations(t)

s := createServicesWithConfig(t, ctx, db, config, registry)
s := createServicesWithMetricsRegistry(
t,
ctx,
db,
3*inflightLongTaskPerNodeLimit, // runnersCount
registry,
)

err = registerDoublerTask(s.registry)
require.NoError(t, err)
Expand Down Expand Up @@ -804,6 +823,8 @@ func TestTasksInflightLimit(t *testing.T) {
for {
select {
case <-ticker.C:
// Note that inflight task is not the same as task with status 'running'.
// The task with status 'running' might not be executed right now.
count := int(inflightLongTasksCount.Load())
logging.Debug(ctx, "There are %v inflight tasks of type long", count)
// We have separate inflight per node limit for each lister.
Expand Down

0 comments on commit 709b86c

Please sign in to comment.