Skip to content

Commit 496efb4

Browse files
author
alxndrsn
committed
test.replication: remove "down-server"
The naming of the replication test which accessed the "down server" implies it's attempting to connect to a server which is down. The test actually passed for any non-pouchdb server, including: * a hostname which doesn't resolve * a hostname which resolves but server does not respond * a server which responds, but not as a couch server
1 parent f1a9b89 commit 496efb4

File tree

3 files changed

+5
-24
lines changed

3 files changed

+5
-24
lines changed

bin/down-server.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

bin/test-node.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ else
1212
fi
1313

1414
if [ $TYPE = "integration" ]; then
15-
if (: < /dev/tcp/127.0.0.1/3010) 2>/dev/null; then
16-
echo "down-server port already in use"
17-
else
18-
node bin/down-server.js 3010 & export DOWN_SERVER_PID=$!
19-
fi
20-
2115
TESTS_PATH="tests/integration/test.*.js"
2216
fi
2317
if [ $TYPE = "fuzzy" ]; then

tests/integration/test.replication.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4260,15 +4260,14 @@ describe('suite2 test.replication.js-down-test', function () {
42604260
});
42614261

42624262
it('replicate from down server test', async () => {
4263-
const source = new PouchDB('http://127.0.0.1:3010', {
4263+
// localhost port 6 is reserved, and should not be in use. This aims to emulate
4264+
// the original intent of this test, which apparently used a registered domain
4265+
// name which would resolve, but not respond to HTTP requests.
4266+
const source = new PouchDB('http://localhost:6', {
42644267
ajax: {timeout: 10}
42654268
});
42664269
const target = new PouchDB(dbs.name);
4267-
try {
4268-
await source.replicate.to(target);
4269-
} catch (error) {
4270-
should.exist(error);
4271-
}
4270+
await source.replicate.to(target).should.be.rejectedWith(/^Failed to fetch$/);
42724271
});
42734272
});
42744273

0 commit comments

Comments
 (0)