MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GetNonDefaultDatastoreNames

Function GetNonDefaultDatastoreNames

base/util_testing.go:978–998  ·  view source on GitHub ↗

GetNonDefaultDatastoreNames returns a list of non-default datastore names from the given bucket.

(t testing.TB, bucket Bucket)

Source from the content-addressed store, hash-verified

976
977// GetNonDefaultDatastoreNames returns a list of non-default datastore names from the given bucket.
978func GetNonDefaultDatastoreNames(t testing.TB, bucket Bucket) []sgbucket.DataStoreName {
979 allDataStoreNames, err := bucket.ListDataStores()
980 require.NoError(t, err)
981 var keyspaces []string
982 for _, name := range allDataStoreNames {
983 if IsDefaultCollection(name.ScopeName(), name.CollectionName()) {
984 continue
985 }
986 keyspaces = append(keyspaces, fmt.Sprintf("%s.%s", name.ScopeName(), name.CollectionName()))
987 }
988 sort.Strings(keyspaces)
989 var nonDefaultDataStoreNames []sgbucket.DataStoreName
990 for _, keyspace := range keyspaces {
991 scopeAndCollection := strings.Split(keyspace, ScopeCollectionSeparator)
992 nonDefaultDataStoreNames = append(nonDefaultDataStoreNames,
993 ScopeAndCollectionName{
994 Scope: scopeAndCollection[0],
995 Collection: scopeAndCollection[1]})
996 }
997 return nonDefaultDataStoreNames
998}
999
1000// TestClusterSpec returns the cluster spec for the test bucket pool.
1001func TestClusterSpec(t *testing.T) CouchbaseClusterSpec {

Callers 2

GetScopesOptionsFunction · 0.92

Calls 4

IsDefaultCollectionFunction · 0.85
ListDataStoresMethod · 0.45
ScopeNameMethod · 0.45
CollectionNameMethod · 0.45

Tested by

no test coverage detected