Skip to content

Commit 4b4d97b

Browse files
authored
Remove stream-tester (#2743)
* Remove stream-tester * Use random port for network-partition tests * Use random port for connection timeout test * Bump CI version
1 parent f5e87ac commit 4b4d97b

File tree

6 files changed

+24
-74
lines changed

6 files changed

+24
-74
lines changed

Diff for: .github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
1818
strategy:
1919
matrix:
20-
node: ['8', '10', '12', '14', '16', '17']
20+
node: ['8', '10', '12', '14', '16', '18']
2121
os: [ubuntu-latest, windows-latest, macos-latest]
2222
name: Node.js ${{ matrix.node }} (${{ matrix.os }})
2323
steps:
24-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v3
2525
- name: Setup node
26-
uses: actions/setup-node@v2
26+
uses: actions/setup-node@v3
2727
with:
2828
node-version: ${{ matrix.node }}
2929
cache: yarn

Diff for: packages/pg-query-stream/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"mocha": "^7.1.2",
4040
"pg": "^8.7.3",
4141
"stream-spec": "~0.3.5",
42-
"stream-tester": "0.0.5",
4342
"ts-node": "^8.5.4",
4443
"typescript": "^4.0.3"
4544
},

Diff for: packages/pg-query-stream/test/pauses.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
import helper from './helper'
22
import concat from 'concat-stream'
3-
import tester from 'stream-tester'
43
import JSONStream from 'JSONStream'
54
import QueryStream from '../src'
5+
import { Transform, TransformCallback } from 'stream'
6+
7+
class PauseStream extends Transform {
8+
constructor() {
9+
super({ objectMode: true })
10+
}
11+
12+
_transform(chunk, encoding, callback): void {
13+
this.push(chunk, encoding)
14+
setTimeout(callback, 1)
15+
}
16+
}
617

718
helper('pauses', function (client) {
819
it('pauses', function (done) {
@@ -12,7 +23,7 @@ helper('pauses', function (client) {
1223
highWaterMark: 2,
1324
})
1425
const query = client.query(stream)
15-
const pauser = tester.createPauseStream(0.1, 100)
26+
const pauser = new PauseStream()
1627
query
1728
.pipe(JSONStream.stringify())
1829
.pipe(pauser)

Diff for: packages/pg/test/integration/client/connection-timeout-tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ suite.test('successful connection', (done) => {
6767
})
6868

6969
suite.test('expired connection timeout', (done) => {
70-
const opts = { ...options, port: 54322 }
70+
const opts = { ...options, port: options.port + 1 }
7171
serverWithConnectionTimeout(opts.port, opts.connectionTimeoutMillis * 2, (closeServer) => {
7272
const timeoutId = setTimeout(() => {
7373
throw new Error('Client should have emitted an error but it did not.')

Diff for: packages/pg/test/integration/client/network-partition-tests.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ var Server = function (response) {
1111
this.response = response
1212
}
1313

14-
let port = 54321
1514
Server.prototype.start = function (cb) {
1615
// this is our fake postgres server
1716
// it responds with our specified response immediatley after receiving every buffer
@@ -40,14 +39,13 @@ Server.prototype.start = function (cb) {
4039
}.bind(this)
4140
)
4241

43-
port = port + 1
44-
45-
var options = {
46-
host: 'localhost',
47-
port: port,
48-
}
49-
this.server.listen(options.port, options.host, function () {
50-
cb(options)
42+
const host = 'localhost'
43+
this.server.listen({ host, port: 0 }, () => {
44+
const port = this.server.address().port
45+
cb({
46+
host,
47+
port,
48+
})
5149
})
5250
}
5351

Diff for: yarn.lock

-58
Original file line numberDiff line numberDiff line change
@@ -1334,15 +1334,6 @@ assertion-error@^1.1.0:
13341334
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
13351335
integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
13361336

1337-
assertions@~2.3.0:
1338-
version "2.3.4"
1339-
resolved "https://registry.yarnpkg.com/assertions/-/assertions-2.3.4.tgz#a9433ced1fce57cc999af0965d1008e96c2796e6"
1340-
integrity sha1-qUM87R/OV8yZmvCWXRAI6WwnluY=
1341-
dependencies:
1342-
fomatto "git://github.com/BonsaiDen/Fomatto.git#468666f600b46f9067e3da7200fd9df428923ea6"
1343-
render "0.1"
1344-
traverser "1"
1345-
13461337
assign-symbols@^1.0.0:
13471338
version "1.0.0"
13481339
resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
@@ -2010,11 +2001,6 @@ currently-unhandled@^0.4.1:
20102001
dependencies:
20112002
array-find-index "^1.0.1"
20122003

2013-
2014-
version "0.0.4"
2015-
resolved "https://registry.yarnpkg.com/curry/-/curry-0.0.4.tgz#1750d518d919c44f3d37ff44edc693de1f0d5fcb"
2016-
integrity sha1-F1DVGNkZxE89N/9E7caT3h8NX8s=
2017-
20182004
cyclist@^1.0.1:
20192005
version "1.0.1"
20202006
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
@@ -2755,10 +2741,6 @@ flush-write-stream@^1.0.0:
27552741
inherits "^2.0.3"
27562742
readable-stream "^2.3.6"
27572743

2758-
"fomatto@git://github.com/BonsaiDen/Fomatto.git#468666f600b46f9067e3da7200fd9df428923ea6":
2759-
version "0.6.0"
2760-
resolved "git://github.com/BonsaiDen/Fomatto.git#468666f600b46f9067e3da7200fd9df428923ea6"
2761-
27622744
for-in@^1.0.2:
27632745
version "1.0.2"
27642746
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
@@ -2793,11 +2775,6 @@ from2@^2.1.0:
27932775
inherits "^2.0.1"
27942776
readable-stream "^2.0.0"
27952777

2796-
from@~0.0.2:
2797-
version "0.0.2"
2798-
resolved "https://registry.yarnpkg.com/from/-/from-0.0.2.tgz#7fffac647a2f99b20d57b8e28379455cbb4189d0"
2799-
integrity sha1-f/+sZHovmbINV7jig3lFXLtBidA=
2800-
28012778
fs-extra@^8.1.0:
28022779
version "8.1.0"
28032780
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
@@ -5215,13 +5192,6 @@ regexpp@^3.0.0, regexpp@^3.1.0:
52155192
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2"
52165193
integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==
52175194

5218-
5219-
version "0.1.4"
5220-
resolved "https://registry.yarnpkg.com/render/-/render-0.1.4.tgz#cfb33a34e26068591d418469e23d8cc5ce1ceff5"
5221-
integrity sha1-z7M6NOJgaFkdQYRp4j2Mxc4c7/U=
5222-
dependencies:
5223-
traverser "0.0.x"
5224-
52255195
repeat-element@^1.1.2:
52265196
version "1.1.3"
52275197
resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce"
@@ -5683,15 +5653,6 @@ stream-spec@~0.3.5:
56835653
dependencies:
56845654
macgyver "~1.10"
56855655

5686-
5687-
version "0.0.5"
5688-
resolved "https://registry.yarnpkg.com/stream-tester/-/stream-tester-0.0.5.tgz#4f86f2531149adaf6dd4b3ff262edf64ae9a171a"
5689-
integrity sha1-T4byUxFJra9t1LP/Ji7fZK6aFxo=
5690-
dependencies:
5691-
assertions "~2.3.0"
5692-
from "~0.0.2"
5693-
through "~0.0.3"
5694-
56955656
string-width@^1.0.1:
56965657
version "1.0.2"
56975658
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
@@ -5944,11 +5905,6 @@ through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6:
59445905
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
59455906
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
59465907

5947-
through@~0.0.3:
5948-
version "0.0.4"
5949-
resolved "https://registry.yarnpkg.com/through/-/through-0.0.4.tgz#0bf2f0fffafaac4bacbc533667e98aad00b588c8"
5950-
integrity sha1-C/Lw//r6rEusvFM2Z+mKrQC1iMg=
5951-
59525908
tmp@^0.0.33:
59535909
version "0.0.33"
59545910
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
@@ -6013,20 +5969,6 @@ tr46@~0.0.3:
60135969
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
60145970
integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=
60155971

6016-
6017-
version "0.0.5"
6018-
resolved "https://registry.yarnpkg.com/traverser/-/traverser-0.0.5.tgz#c66f38c456a0c21a88014b1223580c7ebe0631eb"
6019-
integrity sha1-xm84xFagwhqIAUsSI1gMfr4GMes=
6020-
dependencies:
6021-
curry "0.0.x"
6022-
6023-
traverser@1:
6024-
version "1.0.0"
6025-
resolved "https://registry.yarnpkg.com/traverser/-/traverser-1.0.0.tgz#6f59e5813759aeeab3646b8f4513fd4a62e4fe20"
6026-
integrity sha1-b1nlgTdZruqzZGuPRRP9SmLk/iA=
6027-
dependencies:
6028-
curry "0.0.x"
6029-
60305972
trim-newlines@^1.0.0:
60315973
version "1.0.0"
60325974
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"

0 commit comments

Comments
 (0)