Application developers may want to test their code with simulated responses, including errors from a spanner::InstanceAdminClient. To do so, construct a spanner::InstanceAdminClient with an instance of this class. Then use the Google Test framework functions to program the behavior of this mock.
Functions
GetInstance(GetInstanceParams)
Return the metadata for the given instance.
This function is implemented using gMock's MOCK_METHOD().
Consult the gMock documentation to use this mock in your tests.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-09 UTC."],[[["This page details the `MockInstanceAdminConnection` class, which is designed to mock the `google::cloud::spanner::InstanceAdminConnection` for testing purposes."],["The `MockInstanceAdminConnection` class facilitates testing by enabling the simulation of responses, including errors, from a `spanner::InstanceAdminClient`, allowing for controlled testing of application code."],["This mock class uses gMock's `MOCK_METHOD()` to implement several functions such as `GetInstance`, `CreateInstance`, `UpdateInstance`, and others, allowing testers to define the behavior of these functions within their tests."],["The page also provides a list of available versions of the spanner library, ranging from the latest `2.37.0-rc` to version `2.11.0`."],["Several functions are available to interact with instances or instance configs, including getting, creating, updating, and deleting them, with an additional range of functions to set, test, or get Iam Policies."]]],[]]