MCPcopy
hub / github.com/dapr/dapr / Run

Method Run

tests/integration/suite/scheduler/metrics/jobsfailedtotal.go:59–98  ·  view source on GitHub ↗
(t *testing.T, ctx context.Context)

Source from the content-addressed store, hash-verified

57}
58
59func (j *jobsfailedtotal) Run(t *testing.T, ctx context.Context) {
60 j.actors.WaitUntilRunning(t, ctx)
61
62 client := j.actors.GRPCClient(t, ctx)
63
64 for i := range 5 {
65 _, err := client.ScheduleJob(ctx, &rtv1.ScheduleJobRequest{
66 Job: &rtv1.Job{
67 Name: strconv.Itoa(i),
68 DueTime: new("0s"),
69 FailurePolicy: &common.JobFailurePolicy{
70 Policy: &common.JobFailurePolicy_Drop{
71 Drop: new(common.JobFailurePolicyDrop),
72 },
73 },
74 },
75 })
76 require.NoError(t, err)
77 }
78
79 for i := range 3 {
80 _, err := client.RegisterActorReminder(ctx, &rtv1.RegisterActorReminderRequest{
81 ActorType: "my-type",
82 ActorId: strconv.Itoa(i),
83 Name: strconv.Itoa(i),
84 DueTime: "0s",
85 })
86 require.NoError(t, err)
87 }
88
89 assert.EventuallyWithT(t, func(c *assert.CollectT) {
90 metrics := j.actors.Scheduler().MetricsWithLabels(t, ctx)
91 total, ok := metrics.Metrics["dapr_scheduler_jobs_failed_total"]
92 if !assert.True(c, ok) {
93 return
94 }
95 assert.InDelta(c, 5.0, total["type=job"], 0.01)
96 assert.InDelta(c, 9.0, total["type=actor"], 0.01)
97 }, time.Second*15, time.Millisecond*10)
98}

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
MetricsWithLabelsMethod · 0.80
ScheduleJobMethod · 0.65
RegisterActorReminderMethod · 0.65
SchedulerMethod · 0.65
WaitUntilRunningMethod · 0.45
GRPCClientMethod · 0.45

Tested by

no test coverage detected