(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestResumableStepAtCursor(t *testing.T) { |
| 52 | t.Parallel() |
| 53 | |
| 54 | type testCursor struct { |
| 55 | LastProcessedID int `json:"last_processed_id"` |
| 56 | } |
| 57 | |
| 58 | t.Run("SetsStepAndCursorInMetadata", func(t *testing.T) { |
| 59 | t.Parallel() |
| 60 | |
| 61 | opts := &river.InsertOpts{} |
| 62 | ResumableStepAtCursor(opts, "process_ids", testCursor{LastProcessedID: 42}) |
| 63 | |
| 64 | var metadata map[string]json.RawMessage |
| 65 | require.NoError(t, json.Unmarshal(opts.Metadata, &metadata)) |
| 66 | |
| 67 | var step string |
| 68 | require.NoError(t, json.Unmarshal(metadata[rivercommon.MetadataKeyResumableStep], &step)) |
| 69 | require.Equal(t, "process_ids", step) |
| 70 | |
| 71 | var cursors map[string]json.RawMessage |
| 72 | require.NoError(t, json.Unmarshal(metadata[rivercommon.MetadataKeyResumableCursor], &cursors)) |
| 73 | |
| 74 | var cursor testCursor |
| 75 | require.NoError(t, json.Unmarshal(cursors["process_ids"], &cursor)) |
| 76 | require.Equal(t, 42, cursor.LastProcessedID) |
| 77 | }) |
| 78 | } |
| 79 | |
| 80 | func TestResumableOptsIntegration(t *testing.T) { |
| 81 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…