Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mocking storage::Client. #2710

Closed
5 tasks done
coryan opened this issue May 31, 2019 · 4 comments
Closed
5 tasks done

Support mocking storage::Client. #2710

coryan opened this issue May 31, 2019 · 4 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@coryan
Copy link
Member

coryan commented May 31, 2019

We got this feature request from at least two users, recording it here.

Mocking most functions in this class is not hard:

class MockClient : public google::cloud::storage::internal::RawClient {

The hard thing is to mock Client::ReadObject() and Client::WriteObject().

  • Mock typical unary operations.
  • Mock ReadObject for "a read that works".
  • Mock WriteObject for "a write that works".
  • Mock ReadObject for a failure.
  • Mock WriteObject for a failure.
@coryan coryan added api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels May 31, 2019
@manish-qlogic manish-qlogic self-assigned this Jun 1, 2019
@manish-qlogic
Copy link
Contributor

manish-qlogic commented Jun 12, 2019

example of mocking WriteStreamBuf

class MockStreambuf : public internal::ObjectWriteStreambuf {

@coryan
Copy link
Member Author

coryan commented Jun 12, 2019

Yes, that is the one. For ObjectReadStreambuf you probably have to go one level deeper and mock the internal::ObjectReadSource class.

In both cases it would be nice to have an example that uses these mocks to read (or write) some data pre-defined by the user.

@manish-qlogic
Copy link
Contributor

we will keep this task open as storage_client_mock_samples.cc need examples on failed scenarios.

void MockReadObject(int& argc, char* argv[]) {

@coryan
Copy link
Member Author

coryan commented Aug 14, 2019

I think this was fixed in #2924

@coryan coryan closed this as completed Aug 14, 2019
Customer Issues automation moved this from High priority to Closed Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
Customer Issues
  
Closed
Development

No branches or pull requests

2 participants