mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Remove test again
This commit is contained in:
parent
3aec473755
commit
056a1963e3
1 changed files with 24 additions and 71 deletions
|
|
@ -26,82 +26,35 @@ describe("E2E: Safe chain proxy", () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// it(`safe-chain proxy respects upstream proxy settings`, async () => {
|
it(`safe-chain proxy respects upstream proxy settings`, async () => {
|
||||||
// // Configure and start a proxy inside the container
|
// Configure and start a proxy inside the container
|
||||||
// const proxy = await container.openShell("zsh");
|
const proxy = await container.openShell("zsh");
|
||||||
// await proxy.runCommand(
|
await proxy.runCommand(
|
||||||
// `echo 'BasicAuth user password' >> /etc/tinyproxy/tinyproxy.conf`
|
`echo 'BasicAuth user password' >> /etc/tinyproxy/tinyproxy.conf`
|
||||||
// );
|
);
|
||||||
// await proxy.runCommand("tinyproxy");
|
await proxy.runCommand("tinyproxy");
|
||||||
|
|
||||||
// const shell = await container.openShell("zsh");
|
const shell = await container.openShell("zsh");
|
||||||
// await shell.runCommand(
|
await shell.runCommand(
|
||||||
// 'export HTTPS_PROXY="http://user:password@localhost:8888"'
|
'export HTTPS_PROXY="http://user:password@localhost:8888"'
|
||||||
// );
|
);
|
||||||
// const { output } = await shell.runCommand("npm install axios");
|
const { output } = await shell.runCommand("npm install axios");
|
||||||
|
|
||||||
// // Check if the installation was successful
|
// Check if the installation was successful
|
||||||
// assert(
|
assert(
|
||||||
// output.includes("added") || output.includes("up to date"),
|
output.includes("added") || output.includes("up to date"),
|
||||||
// "npm install did not complete successfully"
|
"npm install did not complete successfully"
|
||||||
// );
|
|
||||||
|
|
||||||
// const proxyLog = await container.openShell("zsh");
|
|
||||||
// const { output: logOutput } = await proxyLog.runCommand(
|
|
||||||
// "cat /var/log/tinyproxy/tinyproxy.log"
|
|
||||||
// );
|
|
||||||
|
|
||||||
// // Check if the proxy log contains entries for the npm install
|
|
||||||
// assert(
|
|
||||||
// logOutput.includes("CONNECT registry.npmjs.org:443"),
|
|
||||||
// "Proxy log does not contain expected entries"
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
|
|
||||||
it(`safe-chain proxy allows to request through a local http registry`, async () => {
|
|
||||||
container.dockerExec("npx -y verdaccio --listen 4873", true);
|
|
||||||
|
|
||||||
// Polling until verdaccio is ready (max 30 seconds)
|
|
||||||
let verdaccioStarted = false;
|
|
||||||
for (let i = 0; i < 60; i++) {
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
||||||
try {
|
|
||||||
const curlOutput = container.dockerExec(
|
|
||||||
"curl -I http://localhost:4873/lodash/-/lodash-4.17.21.tgz"
|
|
||||||
);
|
|
||||||
if (curlOutput.includes("200 OK")) {
|
|
||||||
verdaccioStarted = true;
|
|
||||||
console.log(
|
|
||||||
"Verdaccio started, after " + i * 500 + "ms\n",
|
|
||||||
curlOutput
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// ignore, this means docker exec returned -1 and verdaccio is not yet ready
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!verdaccioStarted) {
|
|
||||||
assert.fail("Verdaccio did not start in time");
|
|
||||||
}
|
|
||||||
|
|
||||||
const shell = await container.openShell("bash");
|
|
||||||
const result = await shell.runCommand(
|
|
||||||
"npm install lodash --registry http://localhost:4873"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log("NPM install output:\n", result.output);
|
const proxyLog = await container.openShell("zsh");
|
||||||
|
const { output: logOutput } = await proxyLog.runCommand(
|
||||||
const curlOutput = container.dockerExec(
|
"cat /var/log/tinyproxy/tinyproxy.log"
|
||||||
"curl -I http://localhost:4873/lodash/-/lodash-4.17.21.tgz"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log("Curl output:\n", curlOutput);
|
// Check if the proxy log contains entries for the npm install
|
||||||
|
assert(
|
||||||
// // Check if the installation was successful
|
logOutput.includes("CONNECT registry.npmjs.org:443"),
|
||||||
// assert(
|
"Proxy log does not contain expected entries"
|
||||||
// result.output.includes("added"),
|
);
|
||||||
// "npm install did not complete successfully, output: " + result.output
|
|
||||||
// );
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue