Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System tests not removing stale dataset resources #715

Closed
steffnay opened this issue Jun 9, 2020 · 1 comment
Closed

System tests not removing stale dataset resources #715

steffnay opened this issue Jun 9, 2020 · 1 comment
Assignees
Labels
api: bigquery Issues related to the googleapis/nodejs-bigquery API.

Comments

@steffnay
Copy link
Contributor

steffnay commented Jun 9, 2020

The system tests are expected to delete stale testing datasets (identified by the GCLOUD_TESTS_PREFIX label) that are at east 24 hours old.

  async function deleteDatasets() {
    const [datasets] = await bigquery.getDatasets({
      filter: `labels.${GCLOUD_TESTS_PREFIX}`,
    });

    const deleteDatasetPromises = datasets
      .filter(dataset => {
        const creationTime = dataset.metadata.creationTime;
        return creationTime && isResourceStale(creationTime);
      })
      .map(dataset => {
        return dataset.delete({force: true});
      });

    await Promise.all(deleteDatasetPromises);
  }

The deleteDatasets() method attempts to access the dataset's creation time via metadata on the dataset object returned by bigquery.getDatasets(), however these objects do not contain the creationTime field. Because of this, the ages of the datasets are never calculated and the resources persist indefinitely.

@steffnay
Copy link
Contributor Author

Fixed by #717

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/nodejs-bigquery API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants