Redo test - start simple

This commit is contained in:
Sander Declerck 2025-10-15 07:42:16 +02:00
parent b567016ddd
commit 24bda852d0
No known key found for this signature in database

View file

@ -59,51 +59,6 @@ describe("E2E: Safe chain proxy", () => {
}); });
it(`safe-chain proxy allows to request through a local http registry`, async () => { 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); container.dockerExec("npx -y verdaccio --listen 4873", true);
// Polling until verdaccio is ready (max 30 seconds) // Polling until verdaccio is ready (max 30 seconds)
@ -112,7 +67,7 @@ describe("E2E: Safe chain proxy", () => {
await new Promise((resolve) => setTimeout(resolve, 500)); await new Promise((resolve) => setTimeout(resolve, 500));
try { try {
const curlOutput = container.dockerExec( 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")) { if (curlOutput.includes("200 OK")) {
verdaccioStarted = true; verdaccioStarted = true;
@ -127,24 +82,24 @@ describe("E2E: Safe chain proxy", () => {
assert.fail("Verdaccio did not start in time"); assert.fail("Verdaccio did not start in time");
} }
const shell = await container.openShell("bash"); // const shell = await container.openShell("bash");
const result = await shell.runCommand( // const result = await shell.runCommand(
"npm install lodash --registry=http://localhost:4873" // "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"
// ); // );
// console.log("Verdaccio log output:", logOutput); // console.log("NPM install output:", result.output);
// Check if the installation was successful // // const verdaccioLog = await container.openShell("bash");
assert( // // const { output: logOutput } = await verdaccioLog.runCommand(
result.output.includes("added"), // // "cat /verdaccio.log"
"npm install did not complete successfully, output: " + result.output // // );
);
// // 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
// );
}); });
}); });