Fix security connector tests.

pull/34876/head
Matthew Stevenson 1 year ago
parent 54b4fc7b88
commit 1cb9d084ea
  1. 5
      test/core/handshake/client_ssl.cc
  2. 2
      test/core/security/security_connector_test.cc
  3. 28
      test/core/security/tls_security_connector_test.cc

@ -392,10 +392,7 @@ static bool client_ssl_test(char* server_alpn_preferred) {
}
TEST(ClientSslTest, MainTest) {
// Handshake succeeeds when the server has grpc-exp as the ALPN preference.
ASSERT_TRUE(client_ssl_test(const_cast<char*>("grpc-exp")));
// Handshake succeeeds when the server has h2 as the ALPN preference. This
// covers legacy gRPC servers which don't support grpc-exp.
// Handshake succeeeds when the server has h2 as the ALPN preference.
ASSERT_TRUE(client_ssl_test(const_cast<char*>("h2")));
// TODO(gtcooke94) Figure out why test is failing with OpenSSL and fix it.

@ -718,7 +718,7 @@ static void test_default_ssl_roots(void) {
static void test_peer_alpn_check(void) {
#if TSI_OPENSSL_ALPN_SUPPORT
tsi_peer peer;
const char* alpn = "grpc";
const char* alpn = "h2";
const char* wrong_alpn = "wrong";
// peer does not have a TSI_SSL_ALPN_SELECTED_PROTOCOL property.
ASSERT_EQ(tsi_construct_peer(1, &peer), TSI_OK);

@ -392,7 +392,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -428,7 +428,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -581,7 +581,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -617,7 +617,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -655,7 +655,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(7, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -703,7 +703,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(7, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.com",
@ -761,8 +761,8 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
EXPECT_EQ(tsi_construct_peer(2, &peer), TSI_OK);
EXPECT_EQ(
tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "grpc",
strlen("grpc"), &peer.properties[0]),
tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2",
strlen("h2"), &peer.properties[0]),
TSI_OK);
EXPECT_EQ(tsi_construct_string_peer_property_from_cstring(
TSI_X509_VERIFIED_ROOT_CERT_SUBECT_PEER_PROPERTY,
@ -1012,7 +1012,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -1043,7 +1043,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -1078,7 +1078,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -1111,7 +1111,7 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL,
"grpc", strlen("grpc"),
"h2", strlen("h2"),
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, "foo.bar.com",
@ -1150,8 +1150,8 @@ TEST_F(TlsSecurityConnectorTest,
tsi_peer peer;
EXPECT_EQ(tsi_construct_peer(2, &peer), TSI_OK);
EXPECT_EQ(
tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "grpc",
strlen("grpc"), &peer.properties[0]),
tsi_construct_string_peer_property(TSI_SSL_ALPN_SELECTED_PROTOCOL, "h2",
strlen("h2"), &peer.properties[0]),
TSI_OK);
EXPECT_EQ(tsi_construct_string_peer_property_from_cstring(
TSI_X509_VERIFIED_ROOT_CERT_SUBECT_PEER_PROPERTY,

Loading…
Cancel
Save