Skip to content

Commit

Permalink
Fixing intermittent failures for spanner unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
masivesky committed Aug 22, 2024
1 parent 2b6a027 commit b029782
Showing 1 changed file with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,43 +196,34 @@ private void testBrowse(SpannerConnector connector) throws IOException {
// browse project
BrowseDetail detail = connector.browse(new MockConnectorContext(new MockConnectorConfigurer()),
BrowseRequest.builder("/").build());
BrowseDetail expected = BrowseDetail.builder()
.setTotalCount(1)
.addEntity(BrowseEntity.builder(instance, "/" + instance, "instance")
BrowseEntity expected = BrowseEntity.builder(instance, "/" + instance, "instance")
.canBrowse(true)
.canSample(false)
.build())
.build();
Assert.assertEquals(expected, detail);
.build();
Assert.assertTrue(detail.getEntities().contains(expected));

// browse instance
detail = connector.browse(new MockConnectorContext(new MockConnectorConfigurer()),
BrowseRequest.builder(instance).build());
expected = BrowseDetail.builder()
.setTotalCount(1)
.addEntity(BrowseEntity.builder(database, String.format("/%s/%s", instance, database), "database")
expected = BrowseEntity.builder(database, String.format("/%s/%s", instance, database), "database")
.canBrowse(true)
.canSample(false)
.build())
.build();
Assert.assertEquals(expected, detail);
.build();
Assert.assertTrue(detail.getEntities().contains(expected));

// browse database
detail = connector.browse(new MockConnectorContext(new MockConnectorConfigurer()),
BrowseRequest.builder(instance + "/" + database).build());
expected = BrowseDetail.builder()
.setTotalCount(1)
.addEntity(BrowseEntity.builder(table, String.format("/%s/%s/%s", instance, database, table), "table")
expected = BrowseEntity.builder(table, String.format("/%s/%s/%s", instance, database, table), "table")
.canBrowse(false)
.canSample(true)
.build())
.build();
Assert.assertEquals(expected, detail);
.build();
Assert.assertTrue(detail.getEntities().contains(expected));

// browse table
detail = connector.browse(new MockConnectorContext(new MockConnectorConfigurer()),
BrowseRequest.builder(instance + "/" + database + "/" + table).build());
Assert.assertEquals(expected, detail);
Assert.assertTrue(detail.getEntities().contains(expected));

// invalid path
Assert.assertThrows(IllegalArgumentException.class, () ->
Expand Down

0 comments on commit b029782

Please sign in to comment.