|
21 | 21 | import io.weaviate.client6.v1.api.collections.vectorindex.Hnsw; |
22 | 22 | import io.weaviate.client6.v1.api.collections.vectorizers.SelfProvidedVectorizer; |
23 | 23 | import io.weaviate.containers.Container; |
| 24 | +import io.weaviate.containers.Weaviate; |
24 | 25 |
|
25 | 26 | public class CollectionsITest extends ConcurrentTest { |
26 | 27 | private static WeaviateClient client = Container.WEAVIATE.getClient(); |
@@ -95,31 +96,34 @@ public void testCrossReferences() throws IOException { |
95 | 96 | } |
96 | 97 |
|
97 | 98 | @Test |
98 | | - public void testListDeleteAll() throws IOException { |
99 | | - var nsA = ns("A"); |
100 | | - var nsB = ns("B"); |
101 | | - var nsC = ns("C"); |
102 | | - |
103 | | - client.collections.create(nsA); |
104 | | - client.collections.create(nsB); |
105 | | - client.collections.create(nsC); |
106 | | - |
107 | | - Assertions.assertThat(client.collections.exists(nsA)).isTrue(); |
108 | | - Assertions.assertThat(client.collections.exists(nsB)).isTrue(); |
109 | | - Assertions.assertThat(client.collections.exists(nsC)).isTrue(); |
110 | | - Assertions.assertThat(client.collections.exists(ns("X"))).isFalse(); |
111 | | - |
112 | | - var all = client.collections.list(); |
113 | | - Assertions.assertThat(all) |
114 | | - .hasSizeGreaterThanOrEqualTo(3) |
115 | | - .extracting(CollectionConfig::collectionName) |
116 | | - .contains(nsA, nsB, nsC); |
117 | | - |
118 | | - client.collections.deleteAll(); |
119 | | - |
120 | | - all = client.collections.list(); |
121 | | - Assertions.assertThat(all.isEmpty()); |
122 | | - |
| 99 | + public void testListDeleteAll() throws Exception { |
| 100 | + // Use a separate container for this test so as not to interfere |
| 101 | + // with other tests. |
| 102 | + try (final var _client = Weaviate.createDefault().getBareClient()) { |
| 103 | + var nsA = ns("A"); |
| 104 | + var nsB = ns("B"); |
| 105 | + var nsC = ns("C"); |
| 106 | + |
| 107 | + _client.collections.create(nsA); |
| 108 | + _client.collections.create(nsB); |
| 109 | + _client.collections.create(nsC); |
| 110 | + |
| 111 | + Assertions.assertThat(_client.collections.exists(nsA)).isTrue(); |
| 112 | + Assertions.assertThat(_client.collections.exists(nsB)).isTrue(); |
| 113 | + Assertions.assertThat(_client.collections.exists(nsC)).isTrue(); |
| 114 | + Assertions.assertThat(_client.collections.exists(ns("X"))).isFalse(); |
| 115 | + |
| 116 | + var all = _client.collections.list(); |
| 117 | + Assertions.assertThat(all) |
| 118 | + .hasSizeGreaterThanOrEqualTo(3) |
| 119 | + .extracting(CollectionConfig::collectionName) |
| 120 | + .contains(nsA, nsB, nsC); |
| 121 | + |
| 122 | + _client.collections.deleteAll(); |
| 123 | + |
| 124 | + all = _client.collections.list(); |
| 125 | + Assertions.assertThat(all.isEmpty()); |
| 126 | + } |
123 | 127 | } |
124 | 128 |
|
125 | 129 | @Test |
|
0 commit comments