Clarify limitations in project list filters

Update the documentation to clarify:

- Regex and prefix filters are case sensitive
- Substring filter is case insensitive
- Regex, prefix and substring may not be used together

Add tests for case [in]sensitivity.

Change-Id: I5de7f5f43b6ecc55dd15c4c009e2e11bd7e72567
This commit is contained in:
David Pursehouse
2017-07-13 10:28:37 +09:00
parent 16a1a4b3f0
commit 0c2e4b87e9
2 changed files with 11 additions and 0 deletions

View File

@@ -149,6 +149,8 @@ Prefix(p)::
Limit the results to those projects that start with the specified Limit the results to those projects that start with the specified
prefix. prefix.
+ +
The match is case sensitive. May not be used together with `m` or `r`.
+
List all projects that start with `platform/`: List all projects that start with `platform/`:
+ +
.Request .Request
@@ -182,6 +184,8 @@ Boundary matchers '^' and '$' are implicit. For example: the regex 'test.*' will
match any projects that start with 'test' and regex '.*test' will match any match any projects that start with 'test' and regex '.*test' will match any
project that end with 'test'. project that end with 'test'.
+ +
The match is case sensitive. May not be used together with `m` or `p`.
+
List all projects that match regex `test.*project`: List all projects that match regex `test.*project`:
+ +
.Request .Request
@@ -234,6 +238,8 @@ Query the second project in the project list:
Substring(m):: Substring(m)::
Limit the results to those projects that match the specified substring. Limit the results to those projects that match the specified substring.
+ +
The match is case insensitive. May not be used together with `r` or `p`.
+
List all projects that match substring `test/`: List all projects that match substring `test/`:
+ +
.Request .Request

View File

@@ -112,6 +112,8 @@ public class ListProjectsIT extends AbstractDaemonTest {
assertThatNameList(filter(gApi.projects().list().withPrefix(p).get())) assertThatNameList(filter(gApi.projects().list().withPrefix(p).get()))
.containsExactly(someOtherProject, someProject) .containsExactly(someOtherProject, someProject)
.inOrder(); .inOrder();
p = name("SOME");
assertThatNameList(filter(gApi.projects().list().withPrefix(p).get())).isEmpty();
} }
@Test @Test
@@ -161,6 +163,9 @@ public class ListProjectsIT extends AbstractDaemonTest {
assertThatNameList(filter(gApi.projects().list().withSubstring("some").get())) assertThatNameList(filter(gApi.projects().list().withSubstring("some").get()))
.containsExactly(projectAwesome, someOtherProject, someProject) .containsExactly(projectAwesome, someOtherProject, someProject)
.inOrder(); .inOrder();
assertThatNameList(filter(gApi.projects().list().withSubstring("SOME").get()))
.containsExactly(projectAwesome, someOtherProject, someProject)
.inOrder();
} }
@Test @Test