github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/blobs/testutils.go (about) 1 // Copyright 2019 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package blobs 12 13 import ( 14 "context" 15 16 "github.com/cockroachdb/cockroach/pkg/roachpb" 17 ) 18 19 // TestBlobServiceClient can be used as a mock BlobClient 20 // in tests that use nodelocal storage. 21 func TestBlobServiceClient(externalIODir string) BlobClientFactory { 22 return func(ctx context.Context, dialing roachpb.NodeID) (BlobClient, error) { 23 return newLocalClient(externalIODir) 24 } 25 } 26 27 // TestEmptyBlobClientFactory can be used as a mock BlobClient 28 // in tests that create ExternalStorage but do not use 29 // nodelocal storage. 30 var TestEmptyBlobClientFactory = func( 31 ctx context.Context, dialing roachpb.NodeID, 32 ) (BlobClient, error) { 33 return nil, nil 34 }