(t *testing.T, sortType SortType)
| 1777 | } |
| 1778 | |
| 1779 | func testLimitDoesntDeadlock(t *testing.T, sortType SortType) { |
| 1780 | testQueryTypes(t, memIndexTypes, func(qt *queryTest) { |
| 1781 | id := qt.id |
| 1782 | |
| 1783 | const limit = 2 |
| 1784 | for i := 0; i < ExportBufferedConst()+limit+1; i++ { |
| 1785 | pn := id.NewPlannedPermanode(fmt.Sprint(i)) |
| 1786 | id.SetAttribute(pn, "foo", "bar") |
| 1787 | } |
| 1788 | |
| 1789 | req := &SearchQuery{ |
| 1790 | Constraint: &Constraint{ |
| 1791 | Permanode: &PermanodeConstraint{}, |
| 1792 | }, |
| 1793 | Limit: limit, |
| 1794 | Sort: sortType, |
| 1795 | Describe: &DescribeRequest{}, |
| 1796 | } |
| 1797 | h := qt.Handler() |
| 1798 | gotRes := make(chan bool, 1) |
| 1799 | go func() { |
| 1800 | _, err := h.Query(ctxbg, req) |
| 1801 | if err != nil { |
| 1802 | qt.t.Error(err) |
| 1803 | } |
| 1804 | gotRes <- true |
| 1805 | }() |
| 1806 | select { |
| 1807 | case <-gotRes: |
| 1808 | case <-time.After(5 * time.Second): |
| 1809 | t.Error("timeout; deadlock?") |
| 1810 | } |
| 1811 | }) |
| 1812 | } |
| 1813 | |
| 1814 | func prettyJSON(v interface{}) string { |
| 1815 | b, err := json.MarshalIndent(v, "", " ") |
no test coverage detected