diff options
author | Spencer T Brody <spencer@10gen.com> | 2013-10-02 15:50:36 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2013-10-02 17:29:49 -0400 |
commit | e0daa0e656c7bf5ad1c7dca806b989795f52814d (patch) | |
tree | e8d0284330d943bfb9ef2364a85c0b31ab3927d5 /src/mongo/db/auth/role_graph_test.cpp | |
parent | d2651c8f82d90d097f5a53f69ab7edddc0844d47 (diff) | |
download | mongo-e0daa0e656c7bf5ad1c7dca806b989795f52814d.tar.gz |
SERVER-9515 Track indirect roles for roles in the RoleGraph
Diffstat (limited to 'src/mongo/db/auth/role_graph_test.cpp')
-rw-r--r-- | src/mongo/db/auth/role_graph_test.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mongo/db/auth/role_graph_test.cpp b/src/mongo/db/auth/role_graph_test.cpp index 6f907cc67d3..3abb14974a1 100644 --- a/src/mongo/db/auth/role_graph_test.cpp +++ b/src/mongo/db/auth/role_graph_test.cpp @@ -108,6 +108,30 @@ namespace { } ASSERT_FALSE(it.more()); + it = graph.getIndirectSubordinates(roleA); // should have roleB, roleC and roleD + bool hasB = false; + bool hasC = false; + bool hasD = false; + int num = 0; + while (it.more()) { + ++num; + RoleName cur = it.next(); + if (cur == roleB) { + hasB = true; + } else if (cur == roleC) { + hasC = true; + } else if (cur == roleD) { + hasD = true; + } else { + FAIL(mongoutils::str::stream() << "unexpected role returned: " << + cur.getFullName()); + } + } + ASSERT_EQUALS(3, num); + ASSERT(hasB); + ASSERT(hasC); + ASSERT(hasD); + it = graph.getDirectSubordinates(roleB); // should be roleC and roleD, order doesn't matter cur = it.next(); if (cur == roleC) { |