diff --git a/src/istio/control/http/attributes_builder_test.cc b/src/istio/control/http/attributes_builder_test.cc index 5f04a597616..83bad095c51 100644 --- a/src/istio/control/http/attributes_builder_test.cc +++ b/src/istio/control/http/attributes_builder_test.cc @@ -221,19 +221,19 @@ attributes { attributes { key: "source.namespace" value { - string_value: "test_ns" + string_value: "ns_ns" } } attributes { key: "source.principal" value { - string_value: "sa/test_user/ns/test_ns/" + string_value: "sa/test_user/ns/ns_ns/" } } attributes { key: "source.user" value { - string_value: "sa/test_user/ns/test_ns/" + string_value: "sa/test_user/ns/ns_ns/" } } attributes { @@ -492,19 +492,19 @@ fields { fields { key: "source.namespace" value { - string_value: "test_ns" + string_value: "ns_ns" } } fields { key: "source.principal" value { - string_value: "sa/test_user/ns/test_ns/" + string_value: "sa/test_user/ns/ns_ns/" } } fields { key: "source.user" value { - string_value: "sa/test_user/ns/test_ns/" + string_value: "sa/test_user/ns/ns_ns/" } } )"; @@ -562,7 +562,7 @@ TEST(AttributesBuilderTest, TestCheckAttributesWithoutAuthnFilter) { EXPECT_CALL(mock_data, GetPrincipal(_, _)) .WillRepeatedly(Invoke([](bool peer, std::string *user) -> bool { if (peer) { - *user = "sa/test_user/ns/test_ns/"; + *user = "sa/test_user/ns/ns_ns/"; } else { *user = "destination_user"; } @@ -636,7 +636,7 @@ TEST(AttributesBuilderTest, TestCheckAttributes) { EXPECT_CALL(mock_data, GetPrincipal(_, _)) .WillRepeatedly(Invoke([](bool peer, std::string *user) -> bool { if (peer) { - *user = "sa/test_user/ns/test_ns/"; + *user = "sa/test_user/ns/ns_ns/"; } else { *user = "destination_user"; } diff --git a/src/istio/control/tcp/attributes_builder_test.cc b/src/istio/control/tcp/attributes_builder_test.cc index 6de42b7cf95..faa78ccc06e 100644 --- a/src/istio/control/tcp/attributes_builder_test.cc +++ b/src/istio/control/tcp/attributes_builder_test.cc @@ -77,19 +77,19 @@ attributes { attributes { key: "source.namespace" value { - string_value: "test_ns" + string_value: "ns_ns" } } attributes { key: "source.principal" value { - string_value: "cluster.local/sa/test_user/ns/test_ns/" + string_value: "cluster.local/sa/test_user/ns/ns_ns/" } } attributes { key: "source.user" value { - string_value: "cluster.local/sa/test_user/ns/test_ns/" + string_value: "cluster.local/sa/test_user/ns/ns_ns/" } } attributes { @@ -379,7 +379,7 @@ TEST(AttributesBuilderTest, TestCheckAttributes) { EXPECT_CALL(mock_data, GetPrincipal(_, _)) .WillRepeatedly(Invoke([](bool peer, std::string* user) -> bool { if (peer) { - *user = "cluster.local/sa/test_user/ns/test_ns/"; + *user = "cluster.local/sa/test_user/ns/ns_ns/"; } else { *user = "destination_user"; } diff --git a/src/istio/utils/utils_test.cc b/src/istio/utils/utils_test.cc index dd3c34feff4..4282e4edccd 100644 --- a/src/istio/utils/utils_test.cc +++ b/src/istio/utils/utils_test.cc @@ -50,7 +50,9 @@ TEST_F(UtilsTest, GetSourceNamespace) { checkTrue("cluster.local/ns//", ""); checkTrue("cluster.local/sa/user/ns/", ""); checkTrue("cluster.local/ns//sa/user", ""); + checkTrue("cluster.local/ns//ns/ns", ""); + checkTrue("cluster.local/ns/ns/ns/ns", "ns"); checkTrue("cluster.local/ns/abc_ns", "abc_ns"); checkTrue("cluster.local/ns/abc_ns/", "abc_ns"); checkTrue("cluster.local/ns/abc_ns/sa/user_ns", "abc_ns");