Skip to content

Commit a283e0d

Browse files
committed
add more tests
1 parent 580c4a3 commit a283e0d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTreeTests.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,22 @@ public void testBasicExclusiveAccess() {
236236
assertThat(tree.canWrite(path("foo/baz")), is(false));
237237
assertThat(tree.canRead(path("foo/bar")), is(false));
238238
assertThat(tree.canWrite(path("foo/bar")), is(false));
239+
tree = accessTree(
240+
entitlement("foo", "read", "foo.xml", "read", "foo/bar.xml", "read_write"),
241+
exclusivePaths("test-component", "diff-module", "foo/bar")
242+
);
243+
assertThat(tree.canRead(path("foo")), is(true));
244+
assertThat(tree.canWrite(path("foo")), is(false));
245+
assertThat(tree.canRead(path("foo.xml")), is(true));
246+
assertThat(tree.canWrite(path("foo.xml")), is(false));
247+
assertThat(tree.canRead(path("foo/baz")), is(true));
248+
assertThat(tree.canWrite(path("foo/baz")), is(false));
249+
assertThat(tree.canRead(path("foo/bar")), is(false));
250+
assertThat(tree.canWrite(path("foo/bar")), is(false));
251+
assertThat(tree.canRead(path("foo/bar.xml")), is(true));
252+
assertThat(tree.canWrite(path("foo/bar.xml")), is(true));
253+
assertThat(tree.canRead(path("foo/bar.baz")), is(true));
254+
assertThat(tree.canWrite(path("foo/bar.baz")), is(false));
239255
}
240256

241257
public void testInvalidExclusiveAccess() {

0 commit comments

Comments
 (0)