(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func TestFDLeak(t *testing.T) { |
| 141 | if testing.Short() { |
| 142 | t.Skip("Skipping in short mode.") |
| 143 | } |
| 144 | fd0 := numFDs(t) |
| 145 | t.Logf("fd0 = %d", fd0) |
| 146 | |
| 147 | s, clean := newSorted(t) |
| 148 | defer clean() |
| 149 | |
| 150 | bm := s.BeginBatch() |
| 151 | const numRows = 150 // 3x the batchSize of 50 in sqlindex.go; to guarantee we do multiple batches |
| 152 | for i := 0; i < numRows; i++ { |
| 153 | bm.Set(fmt.Sprintf("key:%05d", i), fmt.Sprint(i)) |
| 154 | } |
| 155 | if err := s.CommitBatch(bm); err != nil { |
| 156 | t.Fatal(err) |
| 157 | } |
| 158 | for i := 0; i < 5; i++ { |
| 159 | it := s.Find("key:", "key~") |
| 160 | n := 0 |
| 161 | for it.Next() { |
| 162 | n++ |
| 163 | } |
| 164 | if n != numRows { |
| 165 | t.Errorf("iterated over %d rows; want %d", n, numRows) |
| 166 | } |
| 167 | it.Close() |
| 168 | t.Logf("fd after iteration %d = %d", i, numFDs(t)) |
| 169 | } |
| 170 | } |
nothing calls this directly
no test coverage detected