Skip to content

Commit d122374

Browse files
author
Arthur Granado
committed
chore: replace needle get request for curl on kind setup
The last nodejs version, 12.16.3, created an issue with needle lib for redirect requests, that was breaking the test suites which needed to download a KinD binary. To workaround the issue the needle get request was replaced for a curl command on KinD setup to download KinD binary.
1 parent 653ed0e commit d122374

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

test/setup/platforms/kind.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { exec } from 'child-process-promise';
22
import { accessSync, chmodSync, constants, writeFileSync } from 'fs';
33
import { platform } from 'os';
44
import { resolve } from 'path';
5-
import * as needle from 'needle';
65

76
const clusterName = 'kind';
87

@@ -60,17 +59,9 @@ async function download(osDistro: string): Promise<void> {
6059
} catch (error) {
6160
console.log('Downloading KinD...');
6261

63-
const bodyData = null;
64-
// eslint-disable-next-line @typescript-eslint/camelcase
65-
const requestOptions = { follow_max: 2 };
66-
await needle('get',
67-
`https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-${osDistro}-amd64`,
68-
bodyData,
69-
requestOptions,
70-
).then((response) => {
71-
writeFileSync('kind', response.body);
72-
chmodSync('kind', 0o755); // rwxr-xr-x
73-
});
62+
const url = `https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-${osDistro}-amd64`;
63+
await exec(`curl -Lo ./kind ${url}`);
64+
chmodSync('kind', 0o755); // rwxr-xr-x
7465

7566
console.log('KinD downloaded!');
7667
}

0 commit comments

Comments
 (0)