Google Cloud Spanner C++ Client
A C++ Client Library for Google Cloud Spanner
Classes | Functions
google::cloud::spanner_testing::v0 Namespace Reference

An inlined, versioned namespace for the testing helpers. More...

Classes

class  DatabaseEnvironment
 
class  MockDatabaseAdminStub
 
class  MockInstanceAdminStub
 
class  MockSpannerStub
 

Functions

 MATCHER_P (IsProtoEqual, value, "")
 
 MATCHER_P2 (HasSessionAndTransactionId, session_id, transaction_id, "Verifies a Transaction has the expected Session and Transaction IDs")
 Verifies a Transaction has the expected Session and Transaction IDs. More...
 
std::string RandomDatabaseName (google::cloud::internal::DefaultPRNG &generator)
 Create a random database name given a PRNG generator. More...
 
Status IsContextMDValid (grpc::ClientContext &context, std::string const &method, std::string const &api_client_header)
 Verify that the metadata in the context is appropriate for a gRPC method. More...
 

Detailed Description

An inlined, versioned namespace for the testing helpers.

Function Documentation

◆ IsContextMDValid()

Status google::cloud::spanner_testing::v0::IsContextMDValid ( grpc::ClientContext &  context,
std::string const &  method,
std::string const &  api_client_header 
)

Verify that the metadata in the context is appropriate for a gRPC method.

ClientContext should instruct gRPC to set a x-goog-request-params HTTP header with a value dictated by a google.api.http option in the gRPC service specification. This function checks if the header is set and whether it has a valid value.

Parameters
contextthe context to validate
methoda gRPC method which which this context will be passed to
api_client_headerexpected value for the x-goog-api-client metadata header.
Warning
the context will be destroyed and shouldn't be used after passing it to this function.
Returns
an OK status if the context is properly set up

Definition at line 37 of file validate_metadata.cc.

◆ MATCHER_P()

google::cloud::spanner_testing::v0::MATCHER_P ( IsProtoEqual  ,
value  ,
""   
)

Definition at line 30 of file matchers.h.

◆ MATCHER_P2()

google::cloud::spanner_testing::v0::MATCHER_P2 ( HasSessionAndTransactionId  ,
session_id  ,
transaction_id  ,
"Verifies a Transaction has the expected Session and Transaction IDs"   
)

Verifies a Transaction has the expected Session and Transaction IDs.

Definition at line 40 of file matchers.h.

◆ RandomDatabaseName()

std::string google::cloud::spanner_testing::v0::RandomDatabaseName ( google::cloud::internal::DefaultPRNG &  generator)

Create a random database name given a PRNG generator.

Definition at line 21 of file random_database_name.cc.