googleapis / googleapis/google-cloud-cpp

Use a `MockRestClient` in `storage/tests/error_injection_integration_test`

Open
#14,428 0 comments 0 reactions 0 assignees View on GitHub
api: storage type: cleanup
Dominant language
C++
Stars
659
Forks
462
Avg merge
1d 2h
Merged PRs (30d)
89

Description

This test does some low-level black magic to force a specific type of socket error.

1. The storage library should not be testing this, if anywhere, this belongs in the `RestClient` tests,
2. The storage library should just mock `RestClient` and assume it works.

Even if we decided to "move" these tests: it seems better to assume libcurl works, and just returns the right error code. If we want to make sure our wrappers work when libcurl returns the error codes corresponding to socket errors then (as libcurl cannot be easily mocked) we can use the testbench to force the error type we want.

Contributor guide

Open the contributing guide

Research direction

Start by reading storage/tests/error_injection_integration_test and identify the low-level socket-error setup. Replace that dependency with a MockRestClient, while leaving RestClient error-code coverage to its own tests or the testbench as appropriate. Done means the storage test no longer forces socket errors directly and still verifies the intended error handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.