Skip to content

Commit 590dcc6

Browse files
authored
ci: code updates to get windows builds working (#16178)
1 parent a82ff3b commit 590dcc6

9 files changed

Lines changed: 40 additions & 3 deletions

google/cloud/internal/http_header_test.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// TODO(#16171): MSVC is a lot pickier about the conversion operators.
16+
// Skip for now.
17+
#ifndef _WIN32
18+
1519
#include "google/cloud/internal/http_header.h"
1620
#include <gmock/gmock.h>
1721

@@ -179,3 +183,5 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
179183
} // namespace rest_internal
180184
} // namespace cloud
181185
} // namespace google
186+
187+
#endif

google/cloud/internal/oauth2_gdch_service_account_credentials_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// TODO(#16172): GDCH is not currently supported on Windows.
16+
#ifndef _WIN32
17+
1518
#include "google/cloud/internal/oauth2_gdch_service_account_credentials.h"
1619
#include "google/cloud/credentials.h"
1720
#include "google/cloud/internal/base64_transforms.h"
@@ -464,3 +467,5 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
464467
} // namespace oauth2_internal
465468
} // namespace cloud
466469
} // namespace google
470+
471+
#endif

google/cloud/internal/oauth2_minimal_iam_credentials_rest_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ TEST(MinimalIamCredentialsRestTest, AllowedLocationsAuthorizationFailure) {
364364
EXPECT_THAT(access_token, StatusIs(StatusCode::kPermissionDenied));
365365
}
366366

367+
// TODO(#16177): Update these tests to compile with MSVC.
368+
#ifndef _WIN32
369+
367370
TEST(MinimalIamCredentialsRestTest, AllowedLocationsMalformedResponseFailure) {
368371
std::string service_account = "foo@somewhere.com";
369372
std::chrono::seconds lifetime(3600);
@@ -560,6 +563,8 @@ TEST(MinimalIamCredentialsRestTest, WorkforceIdentityAllowedLocations) {
560563
EXPECT_THAT(allowed_locations->encoded_locations, Eq("0xA30"));
561564
}
562565

566+
#endif
567+
563568
} // namespace
564569
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
565570
} // namespace oauth2_internal

google/cloud/internal/oauth2_regional_access_boundary_token_manager.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,21 @@ class RegionalAccessBoundaryTokenManager
184184
promise<Status> pending_refresh;
185185
pending_refresh_ = pending_refresh.get_future();
186186
auto constexpr kLocation = __func__;
187+
#ifdef _WIN32
188+
auto pending_refresh_fn = [p = std::move(pending_refresh),
189+
weak = weak_from_this(), request,
190+
stub = iam_stub_,
191+
retry_policy = retry_policy_->clone(),
192+
backoff_policy = backoff_policy_->clone(),
193+
options = options_, kLocation]() mutable {
194+
#else
187195
auto pending_refresh_fn = [p = std::move(pending_refresh),
188196
weak = weak_from_this(), request,
189197
stub = iam_stub_,
190198
retry_policy = retry_policy_->clone(),
191199
backoff_policy = backoff_policy_->clone(),
192200
options = options_]() mutable {
201+
#endif
193202
auto refresh_attempt_fn = [stub](rest_internal::RestContext&,
194203
Options const&, Request const& request) {
195204
return stub->AllowedLocations(request);

google/cloud/internal/rest_opentelemetry.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> MakeSpanHttp(
8181
{/*sc::kUrlFull=*/"url.full", request.path()}},
8282
options);
8383
for (auto const& kv : request.headers()) {
84-
auto const name = "http.request.header." + std::string{kv.first};
84+
auto const name = absl::StrCat("http.request.header.", kv.first.name());
8585
if (kv.second.EmptyValues()) {
8686
span->SetAttribute(name, "");
8787
continue;

google/cloud/internal/tracing_rest_client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ StatusOr<std::unique_ptr<RestResponse>> EndResponseSpan(
7171
*context.local_port());
7272
}
7373
for (auto const& kv : context.headers()) {
74-
auto const name = "http.request.header." + std::string{kv.first};
74+
auto const name = absl::StrCat("http.request.header.", kv.first.name());
7575
if (kv.second.EmptyValues()) {
7676
span->SetAttribute(name, "");
7777
continue;

google/cloud/internal/unified_rest_credentials_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,9 @@ TEST(UnifiedRestCredentialsTest, ApiKey) {
571571
IsOkAndHolds(Contains(HttpHeader("x-goog-api-key", "api-key"))));
572572
}
573573

574+
// TODO(#16172): GDCH is not currently supported on Windows.
575+
#ifndef _WIN32
576+
574577
TEST(UnifiedRestCredentialsTest, MakeGDCHServiceAccountUsesAudienceParameter) {
575578
auto constexpr kAudience = "test-audience";
576579
auto const post_response = std::string{R"""({
@@ -617,6 +620,8 @@ TEST(UnifiedRestCredentialsTest, MakeGDCHServiceAccountUsesAudienceParameter) {
617620
"Authorization", "Bearer access-token-value"))));
618621
}
619622

623+
#endif
624+
620625
TEST(UnifiedRestCredentialsTest, LoadError) {
621626
// Create a name for a non-existing file, try to load it, and verify it
622627
// returns errors.

google/cloud/internal/win32/sign_using_sha256.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ StatusOr<std::vector<std::uint8_t>> SignSha256Digest(BCRYPT_KEY_HANDLE key,
135135

136136
} // namespace
137137

138+
// TODO(#16172): GDCH is not currently supported on Windows.
139+
// Only supports RAW signature format as only RSA keys are supported.
138140
StatusOr<std::vector<std::uint8_t>> SignUsingSha256(
139-
std::string const& str, std::string const& pem_contents) {
141+
std::string const& str, std::string const& pem_contents, SignatureFormat) {
140142
auto pem_buffer = DecodePem(pem_contents);
141143
if (!pem_buffer) return std::move(pem_buffer).status();
142144

google/cloud/storage/internal/async/connection_impl_appendable_upload_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,9 @@ TEST_F(AsyncConnectionImplAppendableTest,
764764
next.first.set_value(true);
765765
}
766766

767+
// TODO(#16174): Figure out why this test fails to compile in MSVC.
768+
#ifndef _WIN32
769+
767770
TEST_F(AsyncConnectionImplAppendableTest,
768771
ResumeAppendableObjectUploadWithChecksum) {
769772
auto constexpr kRequestText = R"pb(
@@ -882,6 +885,8 @@ TEST_F(AsyncConnectionImplAppendableTest,
882885
next.first.set_value(true);
883886
}
884887

888+
#endif
889+
885890
} // namespace
886891
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
887892
} // namespace storage_internal

0 commit comments

Comments
 (0)