ソースを参照

Sanity test fix

Danny Reidenbach 5 年 前
コミット
2a5d987002

+ 0 - 1
include/grpcpp/security/alts_context.h

@@ -54,7 +54,6 @@ class AltsContext {
   std::map<std::string, std::string> peer_attributes();
 
  private:
-  // TODO(ZhenLian): Also plumb field peer_attributes when it is in use
   std::string application_protocol_;
   std::string record_protocol_;
   std::string peer_service_account_;

+ 1 - 1
src/core/tsi/alts/handshaker/alts_handshaker_client.cc

@@ -263,7 +263,7 @@ void alts_handshaker_client_handle_response(alts_handshaker_client* c,
   }
   tsi_handshaker_result* result = nullptr;
   if (is_handshake_finished_properly(resp)) {
-    tsi_result status = 
+    tsi_result status =
         alts_tsi_handshaker_result_create(resp, client->is_client, &result);
     if (status != TSI_OK) {
       gpr_log(GPR_ERROR, "alts_tsi_handshaker_result_create() failed");

+ 6 - 3
src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc

@@ -342,12 +342,15 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp,
   if (grpc_gcp_Identity_has_attributes(
           const_cast<grpc_gcp_Identity*>(peer_identity))) {
     size_t iter = UPB_MAP_BEGIN;
-    grpc_gcp_Identity_AttributesEntry* peer_attributes_entry = grpc_gcp_Identity_attributes_nextmutable(peer_identity, &iter);
+    grpc_gcp_Identity_AttributesEntry* peer_attributes_entry = 
+        grpc_gcp_Identity_attributes_nextmutable(peer_identity, &iter);
     while (peer_attributes_entry != nullptr) {
       upb_strview key = grpc_gcp_Identity_AttributesEntry_key(
-          const_cast<grpc_gcp_Identity_AttributesEntry*>(peer_attributes_entry));
+          const_cast<grpc_gcp_Identity_AttributesEntry*>(
+              peer_attributes_entry));
       upb_strview val = grpc_gcp_Identity_AttributesEntry_value(
-          const_cast<grpc_gcp_Identity_AttributesEntry*>(peer_attributes_entry));
+          const_cast<grpc_gcp_Identity_AttributesEntry*>(
+              peer_attributes_entry));
       grpc_gcp_AltsContext_peer_attributes_set(context, key, val,
                                                context_arena.ptr());
       peer_attributes_entry =

+ 2 - 2
src/cpp/common/alts_context.cc

@@ -87,11 +87,11 @@ AltsContext::AltsContext(const grpc_gcp_AltsContext* ctx) {
     while (peer_attributes_entry != nullptr) {
       upb_strview key =
           grpc_gcp_AltsContext_PeerAttributesEntry_key(peer_attributes_entry);
-      upb_strview val = 
+      upb_strview val =
           grpc_gcp_AltsContext_PeerAttributesEntry_value(peer_attributes_entry);
       peer_attributes_map_[std::string(key.data, key.size)] = 
           std::string(val.data, val.size);
-      peer_attributes_entry = 
+      peer_attributes_entry =
           grpc_gcp_AltsContext_peer_attributes_next(ctx, &iter);
     }
 

+ 10 - 10
test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc

@@ -152,8 +152,8 @@ static grpc_byte_buffer* generate_handshaker_response(
       peer_identity =
           grpc_gcp_HandshakerResult_mutable_peer_identity(result, arena.ptr());
       grpc_gcp_Identity_attributes_set(
-          peer_identity, 
-          upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_KEY), 
+          peer_identity,
+          upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_KEY),
           upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_VALUE),
           arena.ptr());
       grpc_gcp_Identity_set_service_account(
@@ -186,8 +186,8 @@ static grpc_byte_buffer* generate_handshaker_response(
       peer_identity =
           grpc_gcp_HandshakerResult_mutable_peer_identity(result, arena.ptr());
       grpc_gcp_Identity_attributes_set(
-          peer_identity, 
-          upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_KEY), 
+          peer_identity,
+          upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_KEY),
           upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_VALUE),
           arena.ptr());
       grpc_gcp_Identity_set_service_account(
@@ -342,7 +342,7 @@ static void on_client_next_success_cb(tsi_result status, void* user_data,
   GPR_ASSERT(memcmp(ALTS_TSI_HANDSHAKER_TEST_LOCAL_IDENTITY, local_account.data,
                     local_account.size) == 0);
   size_t iter = UPB_MAP_BEGIN;
-  grpc_gcp_AltsContext_PeerAttributesEntry* peer_attributes_entry = 
+  grpc_gcp_AltsContext_PeerAttributesEntry* peer_attributes_entry =
       grpc_gcp_AltsContext_peer_attributes_nextmutable(ctx, &iter);
   GPR_ASSERT(peer_attributes_entry != nullptr);
   while (peer_attributes_entry != nullptr) {
@@ -355,9 +355,9 @@ static void on_client_next_success_cb(tsi_result status, void* user_data,
     GPR_ASSERT(upb_strview_eql(
         key, upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_KEY)));
     GPR_ASSERT(upb_strview_eql(
-        val, 
+        val,
         upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_VALUE)));
-    peer_attributes_entry = 
+    peer_attributes_entry =
         grpc_gcp_AltsContext_peer_attributes_nextmutable(ctx, &iter);
   }
   /* Validate security level. */
@@ -436,7 +436,7 @@ static void on_server_next_success_cb(tsi_result status, void* user_data,
                     local_account.size) == 0);
 
   size_t iter = UPB_MAP_BEGIN;
-  grpc_gcp_AltsContext_PeerAttributesEntry* peer_attributes_entry = 
+  grpc_gcp_AltsContext_PeerAttributesEntry* peer_attributes_entry =
       grpc_gcp_AltsContext_peer_attributes_nextmutable(ctx, &iter);
   GPR_ASSERT(peer_attributes_entry != nullptr);
   while (peer_attributes_entry != nullptr) {
@@ -449,9 +449,9 @@ static void on_server_next_success_cb(tsi_result status, void* user_data,
     GPR_ASSERT(upb_strview_eql(
         key, upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_KEY)));
     GPR_ASSERT(upb_strview_eql(
-        val, 
+        val,
         upb_strview_makez(ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_VALUE)));
-    peer_attributes_entry = 
+    peer_attributes_entry =
         grpc_gcp_AltsContext_peer_attributes_nextmutable(ctx, &iter);
   }
   /* Check security level. */

+ 3 - 3
test/cpp/common/alts_util_test.cc

@@ -101,9 +101,9 @@ TEST(AltsUtilTest, AuthContextWithGoodAltsContextWithoutRpcVersions) {
       upb_strview_make(expected_local.data(), expected_local.length()));
   grpc_gcp_AltsContext_peer_attributes_set(
       context,
-      upb_strview_make(expected_peer_atrributes_key.data(), 
+      upb_strview_make(expected_peer_atrributes_key.data(),
                        expected_peer_atrributes_key.length()),
-      upb_strview_make(expected_peer_atrributes_value.data(), 
+      upb_strview_make(expected_peer_atrributes_value.data(),
                        expected_peer_atrributes_value.length()),
       context_arena.ptr()); 
   size_t serialized_ctx_length;
@@ -127,7 +127,7 @@ TEST(AltsUtilTest, AuthContextWithGoodAltsContextWithoutRpcVersions) {
   EXPECT_EQ(0, rpc_protocol_versions.max_rpc_version.minor_version);
   EXPECT_EQ(0, rpc_protocol_versions.min_rpc_version.major_version);
   EXPECT_EQ(0, rpc_protocol_versions.min_rpc_version.minor_version);
-  EXPECT_EQ(expected_peer_atrributes_value, 
+  EXPECT_EQ(expected_peer_atrributes_value,
             alts_context->peer_attributes()[expected_peer_atrributes_key]);
 }