googleapis / googleapis/google-cloud-cpp

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

未关闭
#14,428 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
api: storage type: cleanup
主要语言
C++
星标
659
派生
463
平均合并
1 天 2 小时
30 天内合并 PR
89

描述

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.

贡献指南

打开贡献指南

调研方向

首先阅读 storage/tests/error_injection_integration_test,并确定低级 socket 错误的设置方式。用 MockRestClient 替换该依赖,同时将 RestClient 错误代码的覆盖交由其自身的测试或 testbench(视情况而定)。完成的标准是,storage 测试不再直接强制产生 socket 错误,并且仍然验证预期的错误处理。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
testing
Issue 类型
重构
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。