(t *testing.T)
| 527 | } |
| 528 | |
| 529 | func TestVectorDeadlockwithTimeout(t *testing.T) { |
| 530 | pred := "vtest1" |
| 531 | dc = dgraphtest.NewComposeCluster() |
| 532 | var cleanup func() |
| 533 | client, cleanup, err := dc.Client() |
| 534 | x.Panic(err) |
| 535 | defer cleanup() |
| 536 | |
| 537 | for i := 0; i < 5; i++ { |
| 538 | fmt.Println("Testing iteration: ", i) |
| 539 | ctx, cancel2 := context.WithTimeout(context.Background(), 5*time.Second) |
| 540 | defer cancel2() |
| 541 | err = client.LoginIntoNamespace(ctx, dgraphapi.DefaultUser, |
| 542 | dgraphapi.DefaultPassword, x.RootNamespace) |
| 543 | require.NoError(t, err) |
| 544 | |
| 545 | err = client.Alter(context.Background(), &api.Operation{ |
| 546 | DropAttr: pred, |
| 547 | }) |
| 548 | dropPredicate(pred) |
| 549 | setSchema(fmt.Sprintf(vectorSchemaWithIndex, pred, "4", "euclidean")) |
| 550 | numVectors := 10000 |
| 551 | vectorSize := 1000 |
| 552 | |
| 553 | randomVectors, _ := generateRandomVectors(numVectors, vectorSize, pred) |
| 554 | |
| 555 | txn := client.NewTxn() |
| 556 | ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
| 557 | defer func() { _ = txn.Discard(ctx) }() |
| 558 | defer cancel() |
| 559 | |
| 560 | _, err = txn.Mutate(ctx, &api.Mutation{ |
| 561 | SetNquads: []byte(randomVectors), |
| 562 | CommitNow: true, |
| 563 | }) |
| 564 | require.Error(t, err) |
| 565 | |
| 566 | err = txn.Commit(ctx) |
| 567 | require.Contains(t, err.Error(), "Transaction has already been committed or discarded") |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | func TestVectorMutateDiffrentLengthWithDiffrentIndexes(t *testing.T) { |
| 572 | dropPredicate("vtest") |
nothing calls this directly
no test coverage detected