Skip to content

Commit

Permalink
Fix flakiness in BigQueryCowTest.listDataset() (#104)
Browse files Browse the repository at this point in the history
* Add comments to buildSrc/build.gradle

* Fix flakiness in BigQueryCowTest.listDataset()

* Fix javadoc

* Bump versions
  • Loading branch information
melissachang authored Jan 6, 2022
1 parent 537bc4e commit fdf26f8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ plugins {
id 'groovy-gradle-plugin'
}

// Specify repositories for plugins used in buildSrc/src/*.gradle.
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}

// Specify versions for plugins used in buildSrc/src/*.gradle.
dependencies {
implementation group: 'com.diffplug.spotless', name: 'spotless-plugin-gradle', version: '3.27.2'
}
2 changes: 1 addition & 1 deletion google-bigquery/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Please update platform to consume version updates, see here for more:
# https://github.com/DataBiosphere/terra-cloud-resource-lib#publishing-an-update
version = 0.12.0
version = 0.13.0
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ private List(Bigquery.Datasets.List list) {
this.list = list;
}

/** See {@link Bigquery.Datasets.List#setMaxResults(Long)} */
public List setMaxResults(Long maxResults) {
this.list.setMaxResults(maxResults);
return this;
}

public String getProjectId() {
return list.getProjectId();
}
Expand All @@ -211,6 +217,7 @@ public String getProjectId() {
protected JsonObject serialize() {
JsonObject result = new JsonObject();
result.addProperty("projectId", getProjectId());
result.addProperty("maxResults", list.getMaxResults());
return result;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ public void listDataset() throws IOException {
Dataset dataset1 = createDataset();
Dataset dataset2 = createDataset();

DatasetList fetchedDatasets = bigQueryCow.datasets().list(projectId).execute();
// By default, Datasets.List returns 50 results. There may be more than 50 datasets, so increase
// maxResults to make
// sure we get all datasets.
DatasetList fetchedDatasets =
bigQueryCow.datasets().list(projectId).setMaxResults(1000L).execute();

// Because this project has been used for testing before, it may have other datasets lying
// around waiting for cleanup.
assertTrue(fetchedDatasets.getDatasets().size() >= 2);
Expand Down
2 changes: 1 addition & 1 deletion platform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
constraints {
api group: 'bio.terra.cloud-resource-lib', name: 'common', version: '0.11.0'
api group: 'bio.terra.cloud-resource-lib', name: 'google-api-services-common', version: '0.10.0'
api group: 'bio.terra.cloud-resource-lib', name: 'google-bigquery', version: '0.12.0'
api group: 'bio.terra.cloud-resource-lib', name: 'google-bigquery', version: '0.13.0'
api group: 'bio.terra.cloud-resource-lib', name: 'google-billing', version: '0.11.0'
api group: 'bio.terra.cloud-resource-lib', name: 'google-cloudresourcemanager', version: '1.4.0'
api group: 'bio.terra.cloud-resource-lib', name: 'google-compute', version: '0.14.0'
Expand Down

0 comments on commit fdf26f8

Please sign in to comment.