1- import * as fsExtra from 'fs-extra' ;
21import * as nock from 'nock' ;
3- import { copyFile , readFile , mkdir , exists } from 'fs' ;
42import { promisify } from 'util' ;
3+ import { randomUUID } from 'crypto' ;
4+ import * as fsExtra from 'fs-extra' ;
5+ import * as sleep from 'sleep-promise' ;
56import { resolve as resolvePath } from 'path' ;
6- import { v4 as uuid } from 'uuid ' ;
7+ import { copyFile , readFile , mkdir , exists } from 'fs ' ;
78
89import * as kubectl from '../helpers/kubectl' ;
910import * as kind from '../setup/platforms/kind' ;
@@ -32,6 +33,9 @@ async function tearDown() {
3233 console . log ( 'Begin removing the snyk-monitor...' ) ;
3334 try {
3435 await kind . deleteCluster ( ) ;
36+
37+ // Workaround. Tests are failing, cos deleting cluster finishes after the test
38+ await sleep ( 15 * 1000 ) ;
3539 } catch ( err ) {
3640 console . log ( 'Could not cleanly tear down the environment' , err . message ) ;
3741 }
@@ -52,7 +56,7 @@ test('Kubernetes-Monitor with KinD', async (jestDoneCallback) => {
5256 . spyOn ( fsExtra , 'emptyDirSync' )
5357 . mockReturnValue ( { } ) ;
5458
55- const agentId = uuid ( ) ;
59+ const agentId = randomUUID ( ) ;
5660 const retryKubernetesApiRequestMock = jest
5761 . spyOn ( kubernetesApiWrappers , 'retryKubernetesApiRequest' )
5862 . mockResolvedValueOnce ( {
0 commit comments