|
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | 15 | #include "google/cloud/storage/internal/rest/stub.h" |
| 16 | +#include "google/cloud/storage/internal/feature_tracker.h" |
16 | 17 | #include "google/cloud/storage/internal/hash_function.h" |
17 | 18 | #include "google/cloud/storage/testing/canonical_errors.h" |
18 | 19 | #include "google/cloud/internal/api_client_header.h" |
@@ -1028,6 +1029,27 @@ TEST(RestStubTest, UploadChunkIntermediate) { |
1028 | 1029 | StatusIs(PermanentError().code(), PermanentError().message())); |
1029 | 1030 | } |
1030 | 1031 |
|
| 1032 | +TEST(RestStubTest, FeatureTrackerHeaderAppearsInRequest) { |
| 1033 | + auto tracker = std::make_shared<FeatureTracker>(); |
| 1034 | + tracker->RegisterFeature(TrackedFeature::kPCU); |
| 1035 | + auto options = Options{}.set<FeatureTrackerOption>(tracker); |
| 1036 | + |
| 1037 | + auto mock = std::make_shared<MockRestClient>(); |
| 1038 | + EXPECT_CALL( |
| 1039 | + *mock, |
| 1040 | + Get(An<RestContext&>(), |
| 1041 | + ResultOf( |
| 1042 | + "request includes feature tracker header", |
| 1043 | + [](RestRequest const& r) { return r.headers(); }, |
| 1044 | + Contains(Pair(kFeatureTrackerHeaderName, |
| 1045 | + ElementsAre(tracker->HeaderValue())))))) |
| 1046 | + .WillOnce(Return(PermanentError())); |
| 1047 | + |
| 1048 | + auto tested = std::make_unique<RestStub>(options, mock, mock); |
| 1049 | + RestContext context; |
| 1050 | + tested->ListBuckets(context, options, ListBucketsRequest()); |
| 1051 | +} |
| 1052 | + |
1031 | 1053 | } // namespace |
1032 | 1054 | } // namespace internal |
1033 | 1055 | GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END |
|
0 commit comments