Skip to content

Commit 03f01be

Browse files
author
Amir Moualem
authored
Merge pull request #321 from snyk/amir/ohgod
Amir/ohgod
2 parents c226aa0 + fdb7f1d commit 03f01be

File tree

3 files changed

+8
-27
lines changed

3 files changed

+8
-27
lines changed

test/integration/kubernetes.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,10 @@ import * as kubectl from '../helpers/kubectl';
1313

1414
let integrationId: string;
1515

16-
async function tearDown() {
16+
tap.tearDown(async() => {
1717
console.log('Begin removing the snyk-monitor...');
1818
await setup.removeMonitor();
1919
console.log('Removed the snyk-monitor!');
20-
}
21-
22-
tap.tearDown(tearDown);
23-
24-
tap.test('start with clean environment', async () => {
25-
try {
26-
await tearDown();
27-
} catch (error) {
28-
console.log(`could not start with a clean environment: ${error.message}`);
29-
}
3020
});
3121

3222
// Make sure this runs first -- deploying the monitor for the next tests

test/integration/package-manager.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ if (!packageManager) {
1919
throw new Error('Missing PACKAGE_MANAGER environment variable');
2020
}
2121

22-
async function tearDown() {
22+
tap.tearDown(async () => {
2323
console.log('Begin removing the snyk-monitor...');
2424
await removeMonitor();
2525
console.log('Removed the snyk-monitor!');
26-
}
27-
28-
tap.tearDown(tearDown);
26+
});
2927

3028
// Make sure this runs first -- deploying the monitor for the next tests
3129
tap.test('deploy snyk-monitor', async (t) => {

test/setup/index.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { readFileSync, unlinkSync, writeFileSync } from 'fs';
1+
import { readFileSync, writeFileSync } from 'fs';
22
import * as sleep from 'sleep-promise';
33
import * as uuidv4 from 'uuid/v4';
44
import { parse, stringify } from 'yaml';
@@ -67,16 +67,6 @@ export async function removeMonitor(): Promise<void> {
6767
} catch (error) {
6868
console.log(`Could not remove the Kubernetes-Monitor: ${error.message}`);
6969
}
70-
71-
console.log('Removing KUBECONFIG environment variable...');
72-
delete process.env.KUBECONFIG;
73-
74-
console.log('Removing test YAML file...');
75-
try {
76-
unlinkSync('snyk-monitor-test-deployment.yaml');
77-
} catch (error) {
78-
console.log(`Could not delete the test YAML file: ${error.message}`);
79-
}
8070
}
8171

8272
async function createEnvironment(): Promise<void> {
@@ -145,9 +135,12 @@ export async function deployMonitor(): Promise<string> {
145135
await kubectl.downloadKubectl();
146136
if (createCluster) {
147137
await platforms[testPlatform].create();
138+
await platforms[testPlatform].config();
139+
} else {
140+
await platforms[testPlatform].config();
141+
await platforms[testPlatform].clean();
148142
}
149143
const remoteImageName = await platforms[testPlatform].loadImage(imageNameAndTag);
150-
await platforms[testPlatform].config();
151144
await createEnvironment();
152145
await createSecretForGcrIoAccess();
153146

0 commit comments

Comments
 (0)