(t *testing.T)
| 475 | } |
| 476 | |
| 477 | func TestTimeout(t *testing.T) { |
| 478 | // Instantiate a new QueryOptions struct with a 1-second timeout |
| 479 | options := NewQueryOptions().SetTimeout(1) |
| 480 | |
| 481 | // Verify that the timeout was set properly |
| 482 | assert.Equal(t, 1, options.GetTimeout()) |
| 483 | |
| 484 | // Issue a long-running query with a 1-millisecond timeout. |
| 485 | res, err := graph.QueryWithOptions("UNWIND range(0, 1000000) AS v RETURN v", options) |
| 486 | assert.Nil(t, res) |
| 487 | assert.NotNil(t, err) |
| 488 | |
| 489 | params := make(map[string]interface{}) |
| 490 | params["ub"] = 1000000 |
| 491 | res, err = graph.ParameterizedQueryWithOptions("UNWIND range(0, $ub) AS v RETURN v", params, options); |
| 492 | assert.Nil(t, res) |
| 493 | assert.NotNil(t, err) |
| 494 | } |
nothing calls this directly
no test coverage detected