mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Redo test - start simple
This commit is contained in:
parent
b567016ddd
commit
24bda852d0
1 changed files with 17 additions and 62 deletions
|
|
@ -59,51 +59,6 @@ describe("E2E: Safe chain proxy", () => {
|
|||
});
|
||||
|
||||
it(`safe-chain proxy allows to request through a local http registry`, async () => {
|
||||
const configShell = await container.openShell("bash");
|
||||
// await configShell.runCommand("touch /.verdaccio-config.yaml");
|
||||
// // verdaccio.yaml
|
||||
// /*
|
||||
// storage: ./storage
|
||||
// uplinks:
|
||||
// npmjs:
|
||||
// url: https://registry.npmjs.org/
|
||||
// packages:
|
||||
// "**":
|
||||
// access: $all
|
||||
// proxy: npmjs
|
||||
// log: { type: file, path: ./verdaccio.log, level: trace, colors: false }
|
||||
// */
|
||||
// await configShell.runCommand(
|
||||
// `echo 'storage: ./storage' >> /.verdaccio-config.yaml`
|
||||
// );
|
||||
// await configShell.runCommand(`echo 'auth:' >> /.verdaccio-config.yaml`);
|
||||
// await configShell.runCommand(
|
||||
// `echo ' htpasswd:' >> /.verdaccio-config.yaml`
|
||||
// );
|
||||
// await configShell.runCommand(
|
||||
// `echo ' file: ./htpasswd' >> /.verdaccio-config.yaml`
|
||||
// );
|
||||
// await configShell.runCommand(
|
||||
// `echo ' max_users: 100' >> /.verdaccio-config.yaml`
|
||||
// );
|
||||
// await configShell.runCommand(`echo 'uplinks:' >> /.verdaccio-config.yaml`);
|
||||
// await configShell.runCommand(`echo ' npmjs:' >> /.verdaccio-config.yaml`);
|
||||
// await configShell.runCommand(
|
||||
// `echo ' url: https://registry.npmjs.org/' >> /.verdaccio-config.yaml`
|
||||
// );
|
||||
// await configShell.runCommand(`echo 'packages:' >> /.verdaccio-config.yaml`);
|
||||
// await configShell.runCommand(`echo ' "**":' >> /.verdaccio-config.yaml`);
|
||||
// await configShell.runCommand(
|
||||
// `echo ' access: $all' >> /.verdaccio-config.yaml`
|
||||
// );
|
||||
// await configShell.runCommand(
|
||||
// `echo ' proxy: npmjs' >> /.verdaccio-config.yaml`
|
||||
// );
|
||||
// await configShell.runCommand(
|
||||
// `echo 'log: { type: file, path: ./verdaccio.log, level: trace, colors: false }' >> /.verdaccio-config.yaml`
|
||||
// );
|
||||
|
||||
// Start a local npm registry (verdaccio) inside the container
|
||||
container.dockerExec("npx -y verdaccio --listen 4873", true);
|
||||
|
||||
// Polling until verdaccio is ready (max 30 seconds)
|
||||
|
|
@ -112,7 +67,7 @@ describe("E2E: Safe chain proxy", () => {
|
|||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
try {
|
||||
const curlOutput = container.dockerExec(
|
||||
"curl -I http://localhost:4873/lodash"
|
||||
"curl -I http://localhost:4873/lodash/-/lodash-4.17.21.tgz"
|
||||
);
|
||||
if (curlOutput.includes("200 OK")) {
|
||||
verdaccioStarted = true;
|
||||
|
|
@ -127,24 +82,24 @@ describe("E2E: Safe chain proxy", () => {
|
|||
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:", result.output);
|
||||
|
||||
// const verdaccioLog = await container.openShell("bash");
|
||||
// const { output: logOutput } = await verdaccioLog.runCommand(
|
||||
// "cat /verdaccio.log"
|
||||
// const shell = await container.openShell("bash");
|
||||
// const result = await shell.runCommand(
|
||||
// "npm install lodash --registry=http://localhost:4873"
|
||||
// );
|
||||
|
||||
// console.log("Verdaccio log output:", logOutput);
|
||||
// console.log("NPM install output:", result.output);
|
||||
|
||||
// Check if the installation was successful
|
||||
assert(
|
||||
result.output.includes("added"),
|
||||
"npm install did not complete successfully, output: " + result.output
|
||||
);
|
||||
// // const verdaccioLog = await container.openShell("bash");
|
||||
// // const { output: logOutput } = await verdaccioLog.runCommand(
|
||||
// // "cat /verdaccio.log"
|
||||
// // );
|
||||
|
||||
// // console.log("Verdaccio log output:", logOutput);
|
||||
|
||||
// // Check if the installation was successful
|
||||
// assert(
|
||||
// result.output.includes("added"),
|
||||
// "npm install did not complete successfully, output: " + result.output
|
||||
// );
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue