MCPcopy Create free account
hub / github.com/RedisGraph/redisgraph-go / TestTimeout

Function TestTimeout

client_test.go:477–494  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

475}
476
477func 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}

Callers

nothing calls this directly

Calls 5

NewQueryOptionsFunction · 0.85
SetTimeoutMethod · 0.80
GetTimeoutMethod · 0.80
QueryWithOptionsMethod · 0.80

Tested by

no test coverage detected