github.com/kyma-project/kyma-environment-broker@v0.0.1/testing/e2e/skr/skr-test/provision/deprovision-skr.js (about)

     1  const {deprovisionSKR} = require('../../kyma-environment-broker');
     2  const {keb, kcp} = require('../helpers');
     3  
     4  async function deprovisionAndUnregisterSKR(options, deprovisioningTimeout, skipProvisioning, ensureSuccess) {
     5    if (!skipProvisioning) {
     6      await deprovisionSKRInstance(options, deprovisioningTimeout, ensureSuccess);
     7    } else {
     8      console.log('An external SKR cluster was used, de-provisioning skipped');
     9    }
    10  }
    11  
    12  async function deprovisionSKRInstance(options, timeout, ensureSuccess=true) {
    13    try {
    14      await deprovisionSKR(keb, kcp, options.instanceID, timeout, ensureSuccess);
    15    } catch (e) {
    16      throw new Error(`De-provisioning failed: ${e.toString()}`);
    17    } finally {
    18      const runtimeStatus = await kcp.getRuntimeStatusOperations(options.instanceID);
    19      const events = await kcp.getRuntimeEvents(options.instanceID);
    20      console.log(`\nRuntime status after de-provisioning: ${runtimeStatus}\nEvents:\n${events}`);
    21      await kcp.reconcileInformationLog(runtimeStatus);
    22    }
    23  }
    24  
    25  module.exports = {
    26    deprovisionAndUnregisterSKR,
    27  };