Skip to content

Commit 4faf159

Browse files
fix unit tests
1 parent 9dd4ef0 commit 4faf159

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

.evergreen/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4805,6 +4805,7 @@ buildvariants:
48054805
- test-socks5
48064806
- test-socks5-csfle
48074807
- test-socks5-tls
4808+
- test-snappy-compression
48084809
- test-zstd-1.x-compression
48094810
- test-zstd-2.x-compression
48104811
- test-tls-support-latest
@@ -4863,6 +4864,7 @@ buildvariants:
48634864
- test-socks5
48644865
- test-socks5-csfle
48654866
- test-socks5-tls
4867+
- test-snappy-compression
48664868
- test-zstd-1.x-compression
48674869
- test-zstd-2.x-compression
48684870
- test-tls-support-latest
@@ -4921,6 +4923,7 @@ buildvariants:
49214923
- test-socks5
49224924
- test-socks5-csfle
49234925
- test-socks5-tls
4926+
- test-snappy-compression
49244927
- test-zstd-1.x-compression
49254928
- test-zstd-2.x-compression
49264929
- test-tls-support-latest
@@ -5083,6 +5086,7 @@ buildvariants:
50835086
- test-latest-server-v1-api
50845087
- test-socks5
50855088
- test-socks5-tls
5089+
- test-snappy-compression
50865090
- test-zstd-1.x-compression
50875091
- test-zstd-2.x-compression
50885092
- test-tls-support-latest
@@ -5129,6 +5133,7 @@ buildvariants:
51295133
- test-latest-server-v1-api
51305134
- test-socks5
51315135
- test-socks5-tls
5136+
- test-snappy-compression
51325137
- test-zstd-1.x-compression
51335138
- test-zstd-2.x-compression
51345139
- test-tls-support-latest
@@ -5175,6 +5180,7 @@ buildvariants:
51755180
- test-latest-server-v1-api
51765181
- test-socks5
51775182
- test-socks5-tls
5183+
- test-snappy-compression
51785184
- test-zstd-1.x-compression
51795185
- test-zstd-2.x-compression
51805186
- test-tls-support-latest

.evergreen/generate_evergreen_tasks.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -803,15 +803,6 @@ BUILD_VARIANTS.push({
803803
tasks: ['.resource-management']
804804
});
805805

806-
// TODO(NODE-4575): unskip zstd and snappy on node 16
807-
for (const variant of BUILD_VARIANTS.filter(
808-
variant => variant.expansions && [16, 18, 20].includes(variant.expansions.NODE_LTS_VERSION)
809-
)) {
810-
variant.tasks = variant.tasks.filter(
811-
name => !['test-snappy-compression'].includes(name)
812-
);
813-
}
814-
815806
// TODO(NODE-4897): Debug socks5 tests on node latest
816807
for (const variant of BUILD_VARIANTS.filter(
817808
variant => variant.expansions && ['latest'].includes(variant.expansions.NODE_LTS_VERSION)

test/unit/cmap/wire_protocol/compression.test.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as zstd from '@mongodb-js/zstd';
12
import { expect } from 'chai';
23

34
import { compress, Compressor, decompress } from '../../../mongodb';
@@ -12,20 +13,8 @@ describe('compression', function () {
1213

1314
it('compresses the data', async function () {
1415
const data = await compress(options, buffer);
15-
const zstdMagicNumber = data.reverse().toString('hex').substring(16, 26);
16-
// Zstd magic number first set of bytes is is 0xFD2FB528
17-
expect(zstdMagicNumber).to.equal('00fd2fb528');
18-
});
19-
});
20-
21-
context('when a level is provided', function () {
22-
const options = { agreedCompressor: 'zstd' as const, zlibCompressionLevel: 2 };
23-
24-
it('compresses the data', async function () {
25-
const data = await compress(options, buffer);
26-
const zstdMagicNumber = data.reverse().toString('hex').substring(16, 26);
27-
// Zstd magic number first set of bytes is is 0xFD2FB528
28-
expect(zstdMagicNumber).to.equal('00fd2fb528');
16+
// decompress throws if the message is not zstd compresed
17+
expect(await zstd.decompress(data)).to.deep.equal(buffer);
2918
});
3019
});
3120
});

0 commit comments

Comments
 (0)