Skip to content

Conversation

@RIT3shSapata
Copy link
Contributor

@RIT3shSapata RIT3shSapata commented Oct 17, 2025

CBG-4895

Describe your PR here...

  • Currently dcp_read_buffer and kv_buffer are only supported if CBS is serverless, need to enable them for regular CBS as well for perf tests in capella
  • remove serverless check for unsupported config options such as dcp_read_buffer and kv_buffer

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

  • Link upstream PRs
  • Update Go module dependencies when merged

Integration Tests

Copilot AI review requested due to automatic review settings October 17, 2025 09:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the serverless-only gating of dcp_read_buffer and kv_buffer connection string parameters so they can be tuned for regular Couchbase Server deployments, and adds a test to validate expected connection string formation.

  • Removes the IsServerless() conditional, applying DefaultServerlessGoCBConnStringParams unconditionally.
  • Adds a new test (TestUnsupportedOptions) covering explicit and default parameter cases in a serverless test configuration.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
rest/server_context.go Removes serverless check so serverless-specific default connection params are always applied; enables unsupported tuning options for all deployments.
rest/api_test.go Adds TestUnsupportedOptions to assert connection string parameters with and without explicitly provided unsupported options.

rest/api_test.go Outdated
base.DebugfCtx(t.Context(), base.KeySGTest, "additional logs")
}

func TestUnsupportedOptions( t *testing.T){
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

Extraneous space after '(' in the test function signature deviates from standard Go formatting (gofmt would produce func TestUnsupportedOptions(t *testing.T)). Remove the space to keep consistency.

Suggested change
func TestUnsupportedOptions( t *testing.T){
func TestUnsupportedOptions(t *testing.T){

Copilot uses AI. Check for mistakes.
rest/api_test.go Outdated
tb.GetName(), base.TestsDisableGSI()))
RequireStatus(t, resp, http.StatusCreated)
}
assert.Equal(t, test.expectedConnStr, sc.getBucketSpec("db").Server)
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The test asserts exact string equality of the full connection string, making it brittle to harmless reordering of query parameters. Consider parsing the query portion and asserting key-value presence (e.g. using url.Parse + comparison of a map) rather than relying on order-specific full-string matching.

Copilot uses AI. Check for mistakes.
rest/api_test.go Outdated
}

func TestUnsupportedOptions(t *testing.T) {
RequireBucketSpecificCredentials(t)
Copy link
Collaborator

Choose a reason for hiding this comment

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

RequireBucketSpecificCredentials should be changed to specify that it needs CBS RBAC credentials.

This test probably needs SG_TEST_BACKING_STORE=couchbase to fall into the gocb sections, but it would actually be served by a function that said:

	if base.UnitTestUrlIsWalrus() {
		t.Skip("This test only works against Couchbase Server since it requires a gocb bucket")
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is applicable, given, the unit test has been refactored to directly generate the bucketspec

@torcolvin torcolvin assigned RIT3shSapata and unassigned torcolvin Oct 17, 2025
if serverConfig.IsServerless() {
params := base.DefaultServerlessGoCBConnStringParams()

if strings.HasPrefix(server, "couchbase") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if strings.HasPrefix(server, "couchbase") {
if !base.ServerIsWalrus(server) {

}

if !base.ServerIsWalrus(server) {
if !base.ServerIsWalrus(server) && server != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is production code so I'm cautious about modifying it, what's an example test that fails? It feels like we should define a Server in all cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TestDeleteDatabasePointingAtSameBucket kept failing if I did not add server != "". When I dug into it, the test tries to create a db on the same bucket.
When the createDB handler handles this request and then tries to setup the config passed here, it updates the config string to "" from nil, while inheriting the connection string from bootstrapConfig, here. Since this is a unit test, so we do not set the bootstrap config, therefore, I think it is expected for the Config.Server to be set to "".
This is why I added this additional check, I know this condition looks very suspicious, but I'm not not sure as to how else do I prevent the test from failing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A slight correction to my comment earlier,

while inheriting the connection string from bootstrapConfig, here. Since this is a unit test, so we do not set the bootstrap config, therefore, I think it is expected for the Config.Server to be set to "".

It does not inherit the existing Bootstrap config, instead it inherits an empty bootstrap config


var server string
if config.Server != nil {
if config.Server != nil && *config.Server != "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved the check for empty string from _getOrAddDatabaseFromConfig, i'm doing the check inside the GetBucketSpec

@RIT3shSapata RIT3shSapata removed their assignment Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants