@@ -467,23 +467,44 @@ func TestResyncRequireResyncDefaultMetadataID(t *testing.T) {
467467 rt .WaitForDatabaseState (db2Name , db .RunStateString [db .DBOnline ])
468468}
469469
470- func TestResyncPartitionsMaximumValidation (t * testing.T ) {
470+ func TestResyncPartitionsValidation (t * testing.T ) {
471471 rt := rest .NewRestTester (t , & rest.RestTesterConfig {
472472 PersistentConfig : true ,
473473 })
474474 defer rt .Close ()
475475
476- dbConfig := rt .NewDbConfig ()
477- numVBuckets , err := rt .TestBucket .GetMaxVbno (base .TestCtx (t ))
476+ numVBuckets , err := rt .TestBucket .GetMaxVbno (rt .Context ())
478477 require .NoError (t , err )
479- invalidPartitions := numVBuckets + 1
480- dbConfig .Unsupported = & db.UnsupportedOptions {
481- ResyncPartitions : & invalidPartitions ,
482- }
483478
484- resp := rt .CreateDatabase ("db1" , dbConfig )
485- rest .RequireStatus (t , resp , http .StatusInternalServerError )
486- assert .Contains (t , resp .Body .String (), "resync_partitions must be between 1 and" )
479+ t .Run ("invalid partitions exceeding vbucket count are rejected" , func (t * testing.T ) {
480+ // Partition count validation only applies when using sharded DCP (EE + CBS).
481+ if ! base .IsEnterpriseEdition () || base .UnitTestUrlIsWalrus () {
482+ t .Skip ("Partition count validation only applies to EE with CBS" )
483+ }
484+ dbConfig := rt .NewDbConfig ()
485+ invalidPartitions := numVBuckets + 1
486+ dbConfig .Unsupported = & db.UnsupportedOptions {
487+ ResyncPartitions : & invalidPartitions ,
488+ }
489+ resp := rt .CreateDatabase ("db1" , dbConfig )
490+ rest .RequireStatus (t , resp , http .StatusInternalServerError )
491+ assert .Contains (t , resp .Body .String (), "resync_partitions must be between 1 and" )
492+ })
493+
494+ t .Run ("valid custom partitions are used by ResyncManagerDCP" , func (t * testing.T ) {
495+ dbConfig := rt .NewDbConfig ()
496+ customPartitions := uint16 (16 )
497+ dbConfig .Unsupported = & db.UnsupportedOptions {
498+ ResyncPartitions : & customPartitions ,
499+ }
500+ resp := rt .CreateDatabase ("db2" , dbConfig )
501+ rest .RequireStatus (t , resp , http .StatusCreated )
502+
503+ dbCtx , err := rt .ServerContext ().GetDatabase (rt .Context (), "db2" )
504+ require .NoError (t , err )
505+
506+ assert .Equal (t , customPartitions , dbCtx .GetResyncPartitionCount ())
507+ })
487508}
488509
489510// TestDistributedResync is a long-running dev-time test used to validate cbgt rebalance behavior during resync.
0 commit comments