Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,19 @@ also known as namespace in some environments.

```
Type: string
Valid values: comma-separated list of key=value session properties
Valid values: semicolon-separated list of key:value session properties (e.g. key1:value1;key2:value2)
Default: empty
```

The `session_properties` parameter must contain valid parameters accepted by
the Trino server. Run `SHOW SESSION` in Trino to get the current list.

Example:

```
session_properties=query_max_run_time:2s;query_priority:1
```

##### `custom_client`

```
Expand Down Expand Up @@ -256,7 +262,7 @@ http://user@localhost:8080?source=hello&catalog=default&schema=foobar
```

```
https://user@localhost:8443?session_properties=query_max_run_time=10m,query_priority=2
https://user@localhost:8443?session_properties=query_max_run_time:10m;query_priority:2
```

## Data types
Expand Down
18 changes: 18 additions & 0 deletions trino/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,23 @@ func waitForContainerHealth(containerID, containerName string) {
}
}

func waitForTrinoReady(t *testing.T, db *sql.DB) {
if err := pool.Retry(func() error {
row := db.QueryRow("SELECT count(*) FROM system.runtime.nodes WHERE state = 'active'")
var count int
if row.Scan(&count) != nil {
t.Logf("Failed to query nodes: %v", row.Err())
return errors.New("Not ready")
}
if count > 0 {
return nil
}
return errors.New("Not ready")
}); err != nil {
log.Fatal("Timed out waiting for Trino to be ready")
}
}

func generateCerts(dir string) error {
priv, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil {
Expand Down Expand Up @@ -474,6 +491,7 @@ func integrationOpen(t *testing.T, dsn ...string) *sql.DB {
if err != nil {
t.Fatal(err)
}
waitForTrinoReady(t, db)
Copy link
Member

@nineinchnick nineinchnick Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should not be receiving t, and logging of any errors should happen here.

Also, it because it queries the system catalog, it makes some tests redundant, like TestIntegrationSelectQueryIterator. Would executing a SELECT 1 query be sufficient? If yes, can we execute this query using the trino command inside the container, after https://github.com/trinodb/trino-go-client/blob/master/trino/integration_test.go ? This way it'll be independent of the correctness of this driver.

In any case, this should be done in a separate commit.

How does the failure manifest itself? We use a single node instance in these tests.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the recent changes to the integration test logic:

​​Reason for modification​​
I encountered intermittent No nodes available to run query errors during local test execution. While we check container health via waitForContainerHealth, there appears to be a gap between container readiness and actual service availability. My changes address this by adding explicit service-level verification before executing queries.

CI pipeline issue​​
For the GitHub CI failure observed here, I'm currently investigating but would appreciate your insights.

return db
}

Expand Down