From e55ebf182ae8dc3b5708e798daacded4c320c3fa Mon Sep 17 00:00:00 2001 From: wutonggg <111254114+wutonggg@users.noreply.github.com> Date: Fri, 2 Sep 2022 10:36:25 -0700 Subject: [PATCH] fix 641: remove vm after test (#644) Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- samples/test/sample.test.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/samples/test/sample.test.js b/samples/test/sample.test.js index 4689a5b1..bbbea928 100644 --- a/samples/test/sample.test.js +++ b/samples/test/sample.test.js @@ -63,7 +63,6 @@ describe('quickstart sample tests', () => { await bucket.create(); await bigquery.createDataset(datasetId, options); await bigquery.dataset(datasetId).exists(); - // [vm] = await zone.vm(vmName, {os: 'ubuntu'}); const [response] = await instancesClient.insert({ instanceResource: { @@ -107,6 +106,22 @@ describe('quickstart sample tests', () => { after(async () => { await bucket.delete(); await bigquery.dataset(datasetId).delete({force: true}).catch(console.warn); + const [response] = await instancesClient.delete({ + instance: instanceName, + project: projectId, + zone, + }); + let operation = response.latestResponse; + const operationsClient = new compute.ZoneOperationsClient(); + + // Wait for the delete operation to complete. + while (operation.status !== 'DONE') { + [operation] = await operationsClient.wait({ + operation: operation.name, + project: projectId, + zone: operation.zone.split('/').pop(), + }); + } }); it('should export assets to specified path', async () => {