(t *testing.T)
| 209 | } |
| 210 | |
| 211 | func TestGetScalarList(t *testing.T) { |
| 212 | dir, err := os.MkdirTemp("", "storetest_") |
| 213 | x.Check(err) |
| 214 | defer os.RemoveAll(dir) |
| 215 | |
| 216 | opt := badger.DefaultOptions(dir) |
| 217 | ps, err := badger.OpenManaged(opt) |
| 218 | x.Check(err) |
| 219 | pstore = ps |
| 220 | posting.Init(ps, 0, false) |
| 221 | Init(ps) |
| 222 | err = schema.ParseBytes([]byte("scalarPredicateCount4: uid ."), 1) |
| 223 | require.NoError(t, err) |
| 224 | |
| 225 | runM := func(startTs, commitTs uint64, edges []*pb.DirectedEdge) { |
| 226 | txn := posting.Oracle().RegisterStartTs(startTs) |
| 227 | for _, edge := range edges { |
| 228 | x.Check(runMutation(context.Background(), edge, txn)) |
| 229 | } |
| 230 | txn.Update() |
| 231 | writer := posting.NewTxnWriter(pstore) |
| 232 | require.NoError(t, txn.CommitToDisk(writer, commitTs)) |
| 233 | require.NoError(t, writer.Flush()) |
| 234 | txn.UpdateCachedKeys(commitTs) |
| 235 | } |
| 236 | |
| 237 | attr := x.AttrInRootNamespace("scalarPredicateCount4") |
| 238 | |
| 239 | runM(5, 7, []*pb.DirectedEdge{{ |
| 240 | ValueId: 3, |
| 241 | ValueType: pb.Posting_UID, |
| 242 | Attr: attr, |
| 243 | Entity: 1, |
| 244 | Op: pb.DirectedEdge_SET, |
| 245 | }}) |
| 246 | |
| 247 | key := x.DataKey(attr, 1) |
| 248 | rollup(t, key, ps, 8) |
| 249 | |
| 250 | runM(9, 11, []*pb.DirectedEdge{{ |
| 251 | ValueId: 5, |
| 252 | ValueType: pb.Posting_UID, |
| 253 | Attr: attr, |
| 254 | Entity: 1, |
| 255 | Op: pb.DirectedEdge_SET, |
| 256 | }}) |
| 257 | |
| 258 | txn := posting.Oracle().RegisterStartTs(13) |
| 259 | l, err := txn.Get(key) |
| 260 | require.Nil(t, err) |
| 261 | uids, err := l.Uids(posting.ListOptions{ReadTs: 13}) |
| 262 | require.Nil(t, err) |
| 263 | require.Equal(t, 1, len(uids.Uids)) |
| 264 | } |
| 265 | |
| 266 | func TestMultipleTxnListCount(t *testing.T) { |
| 267 | dir, err := os.MkdirTemp("", "storetest_") |
nothing calls this directly
no test coverage detected