<commit_before>import assert from 'assert';

import { S3 } from 'aws-sdk';
import { timesLimit, waterfall } from 'async';

import getConfig from '../support/config';

const bucket = `bigmpu-test-bucket-${Date.now()}`;
const key = 'mpuKey';
const body = 'abc';
const eTag = '900150983cd24fb0d6963f7d28e17f72';

function uploadPart(n, uploadId, s3, next) {
    const params = {
        Bucket: bucket,
        Key: key,
        PartNumber: n + 1,
        UploadId: uploadId,
        Body: body,
    };
    if (params.PartNumber % 20 === 0) {
        process.stdout.write(`uploading PartNumber: ${params.PartNumber}\n`);
    }
    s3.uploadPart(params, err => {
        if (err) {
            process.stdout.write('error putting part: ', err);
            return next(err);
        }
        return next();
    });
}

describe('large mpu', function tester() {
    this.timeout(600000);
    let s3;
    before(done => {
        const config = getConfig('default', { signatureVersion: 'v4' });
        s3 = new S3(config);
        s3.createBucket({ Bucket: bucket }, done);
    });

    after(done => {
        s3.deleteObject({ Bucket: bucket, Key: key }, err => {
            if (err) {
                process.stdout.write('err deleting object in after: ', err);
                return done(err);<commit_msg>FIX: disable retries for large mpu test<commit_after>import assert from 'assert';

import { S3 } from 'aws-sdk';
import { timesLimit, waterfall } from 'async';

import getConfig from '../support/config';

const bucket = `bigmpu-test-bucket-${Date.now()}`;
const key = 'mpuKey';
const body = 'abc';
const eTag = '900150983cd24fb0d6963f7d28e17f72';

function uploadPart(n, uploadId, s3, next) {
    const params = {
        Bucket: bucket,
        Key: key,
        PartNumber: n + 1,
        UploadId: uploadId,
        Body: body,
    };
    if (params.PartNumber % 20 === 0) {
        process.stdout.write(`uploading PartNumber: ${params.PartNumber}\n`);
    }
    s3.uploadPart(params, err => {
        if (err) {
            process.stdout.write('error putting part: ', err);
            return next(err);
        }
        return next();
    });
}

// NOTE: This test has a history of failing in end-to-end Integration tests.
// See Integration#449 for more details. A possible cause for its flakiness
// could be poor system resources.
describe('large mpu', function tester() {
    this.timeout(600000);
    let s3;
    before(done => {
        const config = getConfig('default', { signatureVersion: 'v4' });
        s3 = new S3(config);
        // disable retries so sdk will not resend request because complete mpu
        // is taking long, the retry causing test to fail (see Integration#449)
        s3.config.update({ maxRetries: 0 });
        s3.createBucket({ Bucket: bucket }, done);
    });

    after(done => {
        s3.deleteObject({ Bucket: bucket, Key: key }, err => {
            if (err) {
                process.stdout.write('err deleting object in after: ', err);
                return done(err);
{'fraction_non_alphanumeric': 0.13861386138613863, 'fraction_numerical': 0.030363036303630363, 'mean_word_length': 2.448236632536974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6032376', 'n_tokens_mistral': 986, 'n_tokens_neox': 927, 'n_words': 264}