Skip to content

Commit 940832d

Browse files
FlorentinDs1ck
andcommitted
Test querying TaskStore by user
Co-authored-by: Martin Junghanns <martin.junghanns@neotechnology.com>
1 parent 93eea6b commit 940832d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

core/src/test/java/org/neo4j/gds/core/utils/progress/GlobalTaskStoreTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ void shouldCountAcrossUsers() {
5959
assertThat(taskStore.taskCount()).isEqualTo(3);
6060
}
6161

62+
@Test
63+
void shouldQueryByUser() {
64+
var taskStore = new GlobalTaskStore();
65+
taskStore.store("alice", new JobId("42"), Tasks.leaf("leaf"));
66+
taskStore.store("alice", new JobId("666"), Tasks.leaf("leaf"));
67+
taskStore.store("bob", new JobId("1337"), Tasks.leaf("other"));
68+
69+
assertThat(taskStore.query("alice")).hasSize(2)
70+
.allMatch(task -> task.username().equals("alice"));
71+
72+
assertThat(taskStore.query("alice", new JobId("42"))).isPresent()
73+
.get()
74+
.matches(task -> task.jobId().asString().equals("42"))
75+
.matches(task -> task.username().equals("alice"));
76+
}
77+
6278
@Test
6379
void shouldQueryMultipleUsers() {
6480
var taskStore = new GlobalTaskStore();

0 commit comments

Comments
 (0)