(t *testing.T, ctx context.Context)
| 53 | } |
| 54 | |
| 55 | func (n *notls) Run(t *testing.T, ctx context.Context) { |
| 56 | n.cluster.WaitUntilRunning(t, ctx) |
| 57 | |
| 58 | // Schedule job to random scheduler instance |
| 59 | //nolint:gosec // there is no need for a crypto secure rand. |
| 60 | chosenScheduler := rand.Intn(3) |
| 61 | client := n.cluster.ClientN(t, ctx, chosenScheduler) |
| 62 | |
| 63 | req := &schedulerv1pb.ScheduleJobRequest{ |
| 64 | Name: "testJob", |
| 65 | Job: &schedulerv1pb.Job{ |
| 66 | // Set to 90 so the job doesn't get cleaned up before I check for it in etcd |
| 67 | // also so the job doesn't reach daprd to be sent to an app bc there is not app |
| 68 | // for this test |
| 69 | Schedule: new("@every 90s"), |
| 70 | Repeats: new(uint32(1)), |
| 71 | Data: &anypb.Any{ |
| 72 | TypeUrl: "type.googleapis.com/google.type.Expr", |
| 73 | }, |
| 74 | Ttl: new("90s"), |
| 75 | }, |
| 76 | Metadata: &schedulerv1pb.JobMetadata{ |
| 77 | AppId: "appid", |
| 78 | Namespace: "ns", |
| 79 | Target: &schedulerv1pb.JobTargetMetadata{ |
| 80 | Type: &schedulerv1pb.JobTargetMetadata_Job{ |
| 81 | Job: new(schedulerv1pb.TargetJob), |
| 82 | }, |
| 83 | }, |
| 84 | }, |
| 85 | } |
| 86 | |
| 87 | _, err := client.ScheduleJob(ctx, req) |
| 88 | require.NoError(t, err) |
| 89 | |
| 90 | // ensure data exists on all schedulers |
| 91 | for i := range 3 { |
| 92 | schedulerPort := n.cluster.EtcdClientPortN(t, i) |
| 93 | assert.EventuallyWithT(t, func(c *assert.CollectT) { |
| 94 | n.checkKeysForJobName(t, "testJob", getEtcdKeys(t, ctx, schedulerPort)) |
| 95 | }, time.Second*40, time.Millisecond*10, "failed to find job's key in etcd") |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | func (n *notls) checkKeysForJobName(t *testing.T, jobName string, keys []*mvccpb.KeyValue) { |
| 100 | t.Helper() |
nothing calls this directly
no test coverage detected