Skip to content

Harden config overrides and Windows test reliability#471

Open
zedanazad43 wants to merge 1 commit intopk910:masterfrom
zedanazad43:master
Open

Harden config overrides and Windows test reliability#471
zedanazad43 wants to merge 1 commit intopk910:masterfrom
zedanazad43:master

Conversation

@zedanazad43
Copy link

No description provided.

Copilot AI review requested due to automatic review settings March 17, 2026 00:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves deploy-time configuration flexibility by adding environment-variable overrides for key faucet settings, and aims to reduce CI flakiness—especially on Windows—by adjusting or skipping unstable tests and making the test scripts more cross-platform.

Changes:

  • Add POWFAUCET_* environment variable overrides to loadFaucetConfig() and document the supported override keys.
  • Improve cross-platform test execution (Windows-friendly cp + env var handling) and relax/skip selected flaky tests (notably on Windows).
  • Add a Docker container healthcheck endpoint probe (/api/getVersion).

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/config/FaucetConfig.ts Applies a new set of POWFAUCET_* environment overrides after config load.
tests/FaucetConfig.spec.ts Adds coverage for environment override behavior.
tests/modules/PoWModule.spec.ts Adjusts websocket readiness waits and relaxes some error assertions; skips suite on Windows.
tests/MySQLDatabase.spec.ts Skips MySQL driver suite on Windows.
tests/modules/PassportModule.spec.ts Widens timing tolerance to reduce flakiness.
tests/ModuleManager.spec.ts Increases timeouts to reduce flakiness.
tests/FaucetProcess.spec.ts Avoids signal-based assertions on Windows; hardens CLI arg cleanup with try/finally.
package.json Uses cross-env and shx to make test scripts Windows-compatible.
package-lock.json Locks added dev dependencies and their transitive deps.
docs/ZEDANAZAD43_FORK_QUICKSTART.md Documents env overrides and the container healthcheck.
Dockerfile Adds a HEALTHCHECK probing /api/getVersion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +494 to +497
if(errorMsg.length > 1) {
expect(errorMsg[1].data.code).to.equal("CLIENT_KILLED", "unexpected error2 code");
expect(errorMsg[1].data.message).to.matches(/session failed/i, "unexpected error2 message");
}
}))
expect(fakeSocket.isReady).to.equal(true, "client is not ready");
await ensureSocketReady(fakeSocket);
await awaitSleepPromise(1000, () => !fakeSocket.isReady);
Comment on lines +678 to +681
if(errorMsg.length > 1) {
expect(errorMsg[1].data.code).to.equal("CLIENT_KILLED", "unexpected error2 code");
expect(errorMsg[1].data.message).to.matches(/session failed/i, "unexpected error2 message");
}
Comment on lines 53 to 56
"nyc": "^18.0.0",
"cross-env": "^7.0.3",
"shx": "^0.3.4",
"sinon": "^21.0.0",
POWFAUCET_SECRET: (value) => faucetConfig.faucetSecret = value,
POWFAUCET_RPC_HOST: (value) => faucetConfig.ethRpcHost = value,
POWFAUCET_WALLET_KEY: (value) => faucetConfig.ethWalletKey = value,
POWFAUCET_CHAIN_ID: (value) => faucetConfig.ethChainId = parseInt(value, 10),
}))
expect(fakeSocket.isReady).to.equal(true, "client is not ready");
await ensureSocketReady(fakeSocket);
await awaitSleepPromise(1000, () => !fakeSocket.isReady);
Comment on lines +583 to +586
if(errorMsg.length > 1) {
expect(errorMsg[1].data.code).to.equal("CLIENT_KILLED", "unexpected error2 code");
expect(errorMsg[1].data.message).to.matches(/session failed/i, "unexpected error2 message");
}
}))
expect(fakeSocket.isReady).to.equal(true, "client is not ready");
await ensureSocketReady(fakeSocket);
await awaitSleepPromise(1000, () => !fakeSocket.isReady);
Comment on lines 88 to +90
it("Check process event handler: SIGUSR1", async () => {
if(process.platform === "win32") {
return;
Comment on lines +7 to +21
const originalEnv = { ...process.env };

afterEach(() => {
process.env = { ...originalEnv };
});

it('applies sensitive config overrides from environment variables', () => {
process.env.POWFAUCET_SECRET = 'env-secret';
process.env.POWFAUCET_RPC_HOST = 'https://rpc.example.org';
process.env.POWFAUCET_WALLET_KEY = 'abc123';
process.env.POWFAUCET_CORS_ALLOW_ORIGIN = 'https://a.example, https://b.example';
process.env.POWFAUCET_CAPTCHA_SECRET = 'captcha-secret';

loadFaucetConfig(true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants