Skip to content

Add behaviour scenarios for clustered TypeDB#392

Merged
farost merged 19 commits into
masterfrom
cluster-support-feature-branch
May 2, 2026
Merged

Add behaviour scenarios for clustered TypeDB#392
farost merged 19 commits into
masterfrom
cluster-support-feature-branch

Conversation

@farost
Copy link
Copy Markdown
Member

@farost farost commented Nov 19, 2025

Usage and product changes

Add BDD tests for cluster driver support.

  • Cluster driver tests (driver/cluster.feature): server discovery, roles, terms, single-server connection, server routing modes, failover retries configuration. Expected to run against a 3-node cluster.
  • Driver option tests (driver/connection.feature): request_timeout_millis configuration and timeout failure.
  • Error message update (user.feature): "User does not exist" → "User not found" to match the error message pattern.

Implementation

New BDD steps requiring driver implementations:

  • connection has {int} server(s) — query server list, assert count
  • connection primary server exists — find server with primary role
  • connection get server({address}) exists / does not exist — lookup by address
  • connection get server({address}) has term — assert term is present
  • connection servers have roles: — data table of expected roles
  • connection opens to single server with default authentication — connect via single address
  • set operation server routing to: {routing} — configure auto or direct(address) routing
  • set driver option {option} to: {value} — configure primary_failover_retries, request_timeout_millis

@farost farost force-pushed the cluster-support-feature-branch branch from f8ec7b8 to 8cba4bc Compare February 11, 2026 16:42
@farost farost force-pushed the cluster-support-feature-branch branch from b3382e8 to 0b81151 Compare March 31, 2026 15:08
@farost farost changed the title Introduce cluster support Add behaviour scenarios for clustered TypeDB Apr 16, 2026
@farost farost marked this pull request as ready for review April 16, 2026 11:25
Comment thread driver/cluster.feature
Scenario: Driver can discover servers in a cluster
Then connection has 3 servers
Then connection primary server exists
Then connection get server(127.0.0.1:11729) exists
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Was thinking about something abstract like "Nth address", but it only added headache
It will be better when we dissolve typedb-behaviour and move the scenarios into typedb-driver, where these constants exists across the whole repo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes - this is ok though!

Comment thread driver/cluster.feature
Then connection get server(127.0.0.1:11729) exists
Then connection get server(127.0.0.1:21729) exists
Then connection get server(127.0.0.1:31729) exists

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just need a single newline between scenarios i think! Check what others are doing

Copy link
Copy Markdown
Member Author

@farost farost Apr 20, 2026

Choose a reason for hiding this comment

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

Nah. I enforced 2 newlines between the scenarios everywhere so we could logically split parts of each scenario with single newlines with the 3.x release, most of the files follow the same convention

Comment thread driver/cluster.feature
Scenario: Driver can inspect server roles
Then connection has 3 servers
Then connection servers have roles:
| primary |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

are these ordered? Do you want to key them on port or something, or is this just a set of roles that need to satisfied one each

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, it's just a set. The server roles are not fixed, we can only enforce it by timely restarting them, but it's too much control for these BDDs. The keys won't work here, so we just basically ensure the counts

Copy link
Copy Markdown
Member

@flyingsilverfin flyingsilverfin left a comment

Choose a reason for hiding this comment

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

Approved w comments

@farost farost force-pushed the cluster-support-feature-branch branch from f9b4618 to 88a5ded Compare April 21, 2026 14:31
@farost farost force-pushed the cluster-support-feature-branch branch from f3dfda7 to d249cf2 Compare April 28, 2026 14:04
@farost farost merged commit d3bb013 into master May 2, 2026
1 check passed
@farost farost deleted the cluster-support-feature-branch branch May 2, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants