Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: minor test enhancements #551

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ To run the tests, you need to add the following line to your `/etc/hosts`:

```
# Used by proxy-chain NPM package tests
127.0.0.1 localhost
127.0.0.1 localhost-test
```

This is a workaround to PhantomJS' behavior where it skips proxy servers for localhost addresses.
The `localhost` entry is for avoiding dual-stack issues, e.g. when the test server listens at ::1
(results of getaddrinfo have specifed order) and the client attempts to connect to 127.0.0.1 .

The `localhost-test` entry is a workaround to PhantomJS' behavior where it skips proxy servers for
localhost addresses.
7 changes: 6 additions & 1 deletion test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,12 @@ const createTestSuite = ({
// For SSL, we need to return curl's stderr to check what kind of error was there
const output = await curlGet(curlUrl, `http://bad:[email protected]:${mainProxyServerPort}`, !useSsl);
if (useSsl) {
expect(output).to.contain('Received HTTP code 407 from proxy after CONNECT');
expect(output).to.contain.oneOf([
// Old error message before dafdb20a26d0c890e83dea61a104b75408481ebd
'Received HTTP code 407 from proxy after CONNECT',
// and that after
'CONNECT tunnel failed, response 407',
]);
} else {
expect(output).to.contain('Proxy credentials required');
}
Expand Down
Loading