(t *testing.T)
| 2725 | } |
| 2726 | |
| 2727 | func Test_Client_ClientFromContext(t *testing.T) { |
| 2728 | t.Parallel() |
| 2729 | |
| 2730 | ctx := context.Background() |
| 2731 | |
| 2732 | config := newTestConfig(t, "") |
| 2733 | |
| 2734 | type JobArgs struct { |
| 2735 | testutil.JobArgsReflectKind[JobArgs] |
| 2736 | } |
| 2737 | |
| 2738 | var ( |
| 2739 | clientResult *Client[pgx.Tx] |
| 2740 | jobDoneChan = make(chan struct{}) |
| 2741 | ) |
| 2742 | AddWorker(config.Workers, WorkFunc(func(ctx context.Context, job *Job[JobArgs]) error { |
| 2743 | clientResult = ClientFromContext[pgx.Tx](ctx) |
| 2744 | close(jobDoneChan) |
| 2745 | return nil |
| 2746 | })) |
| 2747 | |
| 2748 | client := runNewTestClient(ctx, t, config) |
| 2749 | |
| 2750 | _, err := client.Insert(ctx, JobArgs{}, nil) |
| 2751 | require.NoError(t, err) |
| 2752 | |
| 2753 | riversharedtest.WaitOrTimeout(t, jobDoneChan) |
| 2754 | |
| 2755 | require.NotNil(t, clientResult) |
| 2756 | require.Equal(t, client, clientResult) |
| 2757 | } |
| 2758 | |
| 2759 | func Test_Client_JobDelete(t *testing.T) { |
| 2760 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…