Skip to content

Commit 78f6e51

Browse files
committed
reset cert pools only in a test
1 parent 56adce4 commit 78f6e51

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

base/dcp_feed_type.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,3 @@ func setCbgtRootCertsForBucket(bucketUUID string, pool *x509.CertPool) {
302302
defer cbgtGlobalsLock.Unlock()
303303
cbgtRootCertPools[bucketUUID] = pool
304304
}
305-
306-
// removeCbgtRootCertsForBucket removes all the root certificates for a bucket. See the comment of cbgtRootCAsProvider for usage details.
307-
func removeCbgtRootCertsForBucket(bucketUUID string) {
308-
cbgtGlobalsLock.Lock()
309-
defer cbgtGlobalsLock.Unlock()
310-
delete(cbgtRootCertPools, bucketUUID)
311-
}

base/dcp_sharded.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ func (c *CbgtContext) Stop() {
451451

452452
func (c *CbgtContext) RemoveFeedCredentials(dbName string) {
453453
removeCbgtCredentials(dbName)
454-
removeCbgtRootCertsForBucket(c.sourceUUID)
454+
// CBG-4394: removing root certs for the bucket should be done, but it is keyed based on the bucket UUID, and multiple dbs can use the same bucket
455455
}
456456

457457
// Format of dest key for retrieval of import dest from cbgtDestFactories

base/util_testing.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"io"
2020
"io/fs"
2121
"log"
22+
"maps"
2223
"math/rand"
2324
"os"
2425
"path/filepath"
@@ -978,3 +979,14 @@ func numFilesInDir(t *testing.T, dir string, recursive bool) int {
978979
require.NoError(t, err)
979980
return numFiles
980981
}
982+
983+
// ResetCBGTCertPools resets the cert pools used for cbgt in a test.
984+
func ResetCBGTCertPools(t *testing.T) {
985+
// CBG-4394: removing root certs for the bucket should be done, but it is keyed based on the bucket UUID, and multiple dbs can use the same bucket
986+
cbgtGlobalsLock.Lock()
987+
defer cbgtGlobalsLock.Unlock()
988+
oldRootCAs := maps.Clone(cbgtRootCertPools)
989+
t.Cleanup(func() {
990+
cbgtRootCertPools = oldRootCAs
991+
})
992+
}

rest/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3140,6 +3140,7 @@ func TestRevCacheMemoryLimitConfig(t *testing.T) {
31403140
}
31413141

31423142
func TestTLSWithoutCerts(t *testing.T) {
3143+
base.ResetCBGTCertPools(t) // CBG-4394: removing root certs for the bucket should be done, but it is keyed based on the bucket UUID, and multiple dbs can use the same bucket
31433144
rt := NewRestTester(t, &RestTesterConfig{
31443145
PersistentConfig: true,
31453146
MutateStartupConfig: func(config *StartupConfig) {

0 commit comments

Comments
 (0)