(t *testing.T)
| 4693 | } |
| 4694 | |
| 4695 | func TestGetProvisionerJobsByIDsWithQueuePosition(t *testing.T) { |
| 4696 | t.Parallel() |
| 4697 | |
| 4698 | testCases := []struct { |
| 4699 | name string |
| 4700 | jobTags []database.StringMap |
| 4701 | daemonTags []database.StringMap |
| 4702 | queueSizes []int64 |
| 4703 | queuePositions []int64 |
| 4704 | // GetProvisionerJobsByIDsWithQueuePosition takes jobIDs as a parameter. |
| 4705 | // If skipJobIDs is empty, all jobs are passed to the function; otherwise, the specified jobs are skipped. |
| 4706 | // NOTE: Skipping job IDs means they will be excluded from the result, |
| 4707 | // but this should not affect the queue position or queue size of other jobs. |
| 4708 | skipJobIDs map[int]struct{} |
| 4709 | }{ |
| 4710 | // Baseline test case |
| 4711 | { |
| 4712 | name: "test-case-1", |
| 4713 | jobTags: []database.StringMap{ |
| 4714 | {"a": "1", "b": "2"}, |
| 4715 | {"a": "1"}, |
| 4716 | {"a": "1", "c": "3"}, |
| 4717 | }, |
| 4718 | daemonTags: []database.StringMap{ |
| 4719 | {"a": "1", "b": "2"}, |
| 4720 | {"a": "1"}, |
| 4721 | }, |
| 4722 | queueSizes: []int64{2, 2, 0}, |
| 4723 | queuePositions: []int64{1, 1, 0}, |
| 4724 | }, |
| 4725 | // Includes an additional provisioner |
| 4726 | { |
| 4727 | name: "test-case-2", |
| 4728 | jobTags: []database.StringMap{ |
| 4729 | {"a": "1", "b": "2"}, |
| 4730 | {"a": "1"}, |
| 4731 | {"a": "1", "c": "3"}, |
| 4732 | }, |
| 4733 | daemonTags: []database.StringMap{ |
| 4734 | {"a": "1", "b": "2"}, |
| 4735 | {"a": "1"}, |
| 4736 | {"a": "1", "b": "2", "c": "3"}, |
| 4737 | }, |
| 4738 | queueSizes: []int64{3, 3, 3}, |
| 4739 | queuePositions: []int64{1, 1, 3}, |
| 4740 | }, |
| 4741 | // Skips job at index 0 |
| 4742 | { |
| 4743 | name: "test-case-3", |
| 4744 | jobTags: []database.StringMap{ |
| 4745 | {"a": "1", "b": "2"}, |
| 4746 | {"a": "1"}, |
| 4747 | {"a": "1", "c": "3"}, |
| 4748 | }, |
| 4749 | daemonTags: []database.StringMap{ |
| 4750 | {"a": "1", "b": "2"}, |
| 4751 | {"a": "1"}, |
| 4752 | {"a": "1", "b": "2", "c": "3"}, |
nothing calls this directly
no test coverage detected