Skip to content

Add comparable errors for target_session_attrs. - #33

Open
P1cheneG wants to merge 1 commit into
FirebirdSQL:mainfrom
P1cheneG:add_comparable_errors_for_target_session_attrs
Open

P1cheneG wants to merge 1 commit into
FirebirdSQL:mainfrom
P1cheneG:add_comparable_errors_for_target_session_attrs

Conversation

@P1cheneG

@P1cheneG P1cheneG commented Nov 9, 2026

Copy link
Copy Markdown

No description provided.

@P1cheneG
P1cheneG requested a review from RozmiDan November 9, 2026 08:11
@P1cheneG P1cheneG self-assigned this Nov 9, 2026
@P1cheneG P1cheneG added this to the v0.8.0 milestone Nov 9, 2026
Comment thread fbconn/config.go
Comment on lines +684 to +686
ErrPrimary = errors.New("not replica")
// ErrReplica is returned when a primary connection is required but the connection is replica.
ErrReplica = errors.New("not primary")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems more consistent to use ErrPrimaryConnection and ErrReplicaConnection here. This follows public naming pattern and matches ErrReadOnlyConnection and ErrReadWriteConnection above.

require.ErrorIs(t, err, ErrConnClosed)
}

func TestConnectWithValidateConnectSessionAttributeErrors(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure what this test is intended to verify. It opens a real connection, but the callback returns each sentinel directly, so none of the actual target_session_attrs validators are exercised. The read-only/read-write paths are already covered in fbconn_test.go, while the message and NotPreferredError checks can be unit tests without a database.

@smirnoffjr smirnoffjr added the enhancement New feature or request label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants