Skip to content

Commit 6a079ed

Browse files
authored
Merge pull request #8637 from liranmauda/liran-convert-test-file-writer
CI | Reduce run time | Convert test_file_writer to jest
2 parents eec9e18 + 3d7ed57 commit 6a079ed

File tree

3 files changed

+18
-37
lines changed

3 files changed

+18
-37
lines changed

src/test/unit_tests/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ require('./test_bucket_chunks_builder');
5757
require('./test_mirror_writer');
5858
require('./test_namespace_fs');
5959
require('./test_ns_list_objects');
60-
require('./test_file_writer');
6160
require('./test_namespace_fs_mpu');
6261
require('./test_nb_native_fs');
6362
require('./test_s3select');
Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,52 @@
11
/* Copyright (C) 2020 NooBaa */
2-
/* eslint-disable no-invalid-this */
32
'use strict';
43

5-
const mocha = require('mocha');
6-
const config = require('../../../config');
7-
const file_writer_hashing = require('../../tools/file_writer_hashing');
4+
const config = require('../../../../config');
5+
const file_writer_hashing = require('../../../tools/file_writer_hashing');
86
const orig_iov_max = config.NSFS_DEFAULT_IOV_MAX;
97

108
// on iov_max small tests we need to use smaller amount of parts and chunks to ensure that the test will finish
119
// in a reasonable period of time because we will flush max 1/2 buffers at a time.
1210
const small_iov_num_parts = 20;
1311

14-
15-
mocha.describe('FileWriter', function() {
12+
describe('FileWriter', () => {
1613
const RUN_TIMEOUT = 10 * 60 * 1000;
1714

18-
mocha.afterEach(function() {
15+
afterEach(() => {
1916
config.NSFS_DEFAULT_IOV_MAX = orig_iov_max;
2017
});
2118

22-
mocha.it('Concurrent FileWriter with hash target', async function() {
23-
const self = this;
24-
self.timeout(RUN_TIMEOUT);
19+
it('Concurrent FileWriter with hash target', async () => {
2520
await file_writer_hashing.hash_target();
26-
});
21+
}, RUN_TIMEOUT);
2722

28-
mocha.it('Concurrent FileWriter with file target', async function() {
29-
const self = this;
30-
self.timeout(RUN_TIMEOUT);
23+
it('Concurrent FileWriter with file target', async () => {
3124
await file_writer_hashing.file_target();
32-
});
25+
}, RUN_TIMEOUT);
3326

34-
mocha.it('Concurrent FileWriter with hash target - iov_max=1', async function() {
35-
const self = this;
36-
self.timeout(RUN_TIMEOUT);
27+
it('Concurrent FileWriter with hash target - iov_max=1', async () => {
3728
await file_writer_hashing.hash_target(undefined, small_iov_num_parts, 1);
38-
});
29+
}, RUN_TIMEOUT);
3930

40-
mocha.it('Concurrent FileWriter with file target - iov_max=1', async function() {
41-
const self = this;
42-
self.timeout(RUN_TIMEOUT);
31+
it('Concurrent FileWriter with file target - iov_max=1', async () => {
4332
await file_writer_hashing.file_target(undefined, small_iov_num_parts, 1);
44-
});
33+
}, RUN_TIMEOUT);
4534

46-
mocha.it('Concurrent FileWriter with hash target - iov_max=2', async function() {
47-
const self = this;
48-
self.timeout(RUN_TIMEOUT);
35+
it('Concurrent FileWriter with hash target - iov_max=2', async () => {
4936
await file_writer_hashing.hash_target(undefined, small_iov_num_parts, 2);
50-
});
37+
}, RUN_TIMEOUT);
5138

52-
mocha.it('Concurrent FileWriter with file target - iov_max=2', async function() {
53-
const self = this;
54-
self.timeout(RUN_TIMEOUT);
39+
it('Concurrent FileWriter with file target - iov_max=2', async () => {
5540
await file_writer_hashing.file_target(undefined, small_iov_num_parts, 2);
56-
});
41+
}, RUN_TIMEOUT);
5742

58-
mocha.it('Concurrent FileWriter with file target - produce num_chunks > 1024 && total_chunks_size < config.NSFS_BUF_SIZE_L', async function() {
59-
const self = this;
60-
self.timeout(RUN_TIMEOUT);
43+
it('Concurrent FileWriter with file target - produce num_chunks > 1024 && total_chunks_size < config.NSFS_BUF_SIZE_L', async () => {
6144
// The goal of this test is to produce num_chunks > 1024 && total_chunks_size < config.NSFS_BUF_SIZE_L
6245
// so we will flush buffers because of reaching max num of buffers and not because we reached the max NSFS buf size
6346
// chunk size = 100, num_chunks = (10 * 1024 * 1024)/100 < 104587, 104587 = num_chunks > 1024
6447
// chunk size = 100, total_chunks_size after having 1024 chunks is = 100 * 1024 < config.NSFS_BUF_SIZE_L
6548
const chunk_size = 100;
6649
const parts_s = 50;
6750
await file_writer_hashing.file_target(chunk_size, parts_s);
68-
});
51+
}, RUN_TIMEOUT);
6952
});

src/test/unit_tests/nc_index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ coretest.setup();
77

88
require('./test_namespace_fs');
99
require('./test_ns_list_objects');
10-
require('./test_file_writer');
1110
require('./test_namespace_fs_mpu');
1211
require('./test_nb_native_fs');
1312
require('./test_nc_nsfs_cli');

0 commit comments

Comments
 (0)