Skip to content

Commit

Permalink
small update
Browse files Browse the repository at this point in the history
  • Loading branch information
yangminzhu committed Aug 22, 2018
1 parent 5a88dbc commit 4a207ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/istio/control/http/attributes_builder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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/"
}
}
)";
Expand Down Expand Up @@ -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";
}
Expand Down Expand Up @@ -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";
}
Expand Down
8 changes: 4 additions & 4 deletions src/istio/control/tcp/attributes_builder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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";
}
Expand Down
2 changes: 2 additions & 0 deletions src/istio/utils/utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 4a207ab

Please sign in to comment.