|
36 | 36 | import com.google.cloud.logging.SinkInfo.Destination.DatasetDestination;
|
37 | 37 | import com.google.common.collect.ImmutableList;
|
38 | 38 | import com.google.common.collect.ImmutableMap;
|
39 |
| -import com.google.common.collect.ImmutableSet; |
40 | 39 | import com.google.common.collect.Iterators;
|
41 | 40 | import com.google.common.collect.Sets;
|
42 | 41 | import com.google.protobuf.Any;
|
|
47 | 46 | import org.junit.rules.ExpectedException;
|
48 | 47 | import org.junit.rules.Timeout;
|
49 | 48 |
|
50 |
| -import java.util.HashSet; |
51 | 49 | import java.util.Iterator;
|
52 | 50 | import java.util.Set;
|
53 | 51 | import java.util.concurrent.ExecutionException;
|
|
60 | 58 | */
|
61 | 59 | public abstract class BaseSystemTest {
|
62 | 60 |
|
63 |
| - private static final Set<String> DESCRIPTOR_TYPES = ImmutableSet.of("gce_instance", "gae_app", |
64 |
| - "cloudsql_database", "api", "gcs_bucket", "global", "dataflow_step", "build", |
65 |
| - "app_script_function", "dataproc_cluster", "ml_job", "bigquery_resource", "container", |
66 |
| - "gke_cluster", "cloud_debugger_resource", "http_load_balancer", "aws_ec2_instance", |
67 |
| - "client_auth_config_brand", "client_auth_config_client", "logging_log", "logging_sink", |
68 |
| - "metric", "project", "testservice_matrix", "service_account", "deployment"); |
69 |
| - |
70 | 61 | @Rule
|
71 | 62 | public ExpectedException thrown = ExpectedException.none();
|
72 | 63 |
|
@@ -214,27 +205,25 @@ public void testListSinksAsync() throws ExecutionException, InterruptedException
|
214 | 205 | public void testListMonitoredResourceDescriptors() {
|
215 | 206 | Iterator<MonitoredResourceDescriptor> iterator =
|
216 | 207 | logging().listMonitoredResourceDescriptors(Logging.ListOption.pageSize(1)).iterateAll();
|
217 |
| - Set<String> descriptorTypes = new HashSet<>(); |
| 208 | + int count = 0; |
218 | 209 | while (iterator.hasNext()) {
|
219 |
| - descriptorTypes.add(iterator.next().getType()); |
220 |
| - } |
221 |
| - for (String type : DESCRIPTOR_TYPES) { |
222 |
| - assertTrue(descriptorTypes.contains(type)); |
| 210 | + assertNotNull(iterator.next().getType()); |
| 211 | + count += 1; |
223 | 212 | }
|
| 213 | + assertTrue(count > 0); |
224 | 214 | }
|
225 | 215 |
|
226 | 216 | @Test
|
227 | 217 | public void testListMonitoredResourceDescriptorsAsync()
|
228 | 218 | throws ExecutionException, InterruptedException {
|
229 | 219 | Iterator<MonitoredResourceDescriptor> iterator = logging()
|
230 | 220 | .listMonitoredResourceDescriptorsAsync(Logging.ListOption.pageSize(1)).get().iterateAll();
|
231 |
| - Set<String> descriptorTypes = new HashSet<>(); |
| 221 | + int count = 0; |
232 | 222 | while (iterator.hasNext()) {
|
233 |
| - descriptorTypes.add(iterator.next().getType()); |
234 |
| - } |
235 |
| - for (String type : DESCRIPTOR_TYPES) { |
236 |
| - assertTrue(descriptorTypes.contains(type)); |
| 223 | + assertNotNull(iterator.next().getType()); |
| 224 | + count += 1; |
237 | 225 | }
|
| 226 | + assertTrue(count > 0); |
238 | 227 | }
|
239 | 228 |
|
240 | 229 | @Test
|
|
0 commit comments