From cf135342f97cdf0435430b3c49e528b2a6489911 Mon Sep 17 00:00:00 2001 From: prakashsvmx Date: Mon, 22 May 2023 21:21:02 +0530 Subject: [PATCH] try ci --- src/CredentialProvider.ts | 1 - src/minio.js | 12 ++------- tests/functional/functional-tests.js | 40 +++++++++++++++------------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/CredentialProvider.ts b/src/CredentialProvider.ts index ba224b33..f5e157f0 100644 --- a/src/CredentialProvider.ts +++ b/src/CredentialProvider.ts @@ -51,4 +51,3 @@ export class CredentialProvider { // deprecated default export, please use named exports. // keep for backward compatibility. // eslint-disable-next-line import/no-default-export -export default CredentialProvider diff --git a/src/minio.js b/src/minio.js index d8496865..1219e3fb 100644 --- a/src/minio.js +++ b/src/minio.js @@ -26,7 +26,6 @@ import { TextEncoder } from 'web-encoding' import Xml from 'xml' import xml2js from 'xml2js' -import { AssumeRoleProvider } from './AssumeRoleProvider.ts' import * as errors from './errors.ts' import { extensions } from './extensions.js' import { CopyDestinationOptions, CopySourceOptions, DEFAULT_REGION } from './helpers.ts' @@ -70,17 +69,10 @@ import { postPresignSignatureV4, presignSignatureV4, signV4 } from './signing.ts import * as transformers from './transformers.js' import { parseSelectObjectContentResponse } from './xml-parsers.js' +export * from './AssumeRoleProvider.ts' export * from './helpers.ts' export * from './notification.js' -export { - AssumeRoleProvider, - CopyConditions, - CopyDestinationOptions, - CopySourceOptions, - DEFAULT_REGION, - getVersionId, - PostPolicy, -} +export { CopyConditions, CopyDestinationOptions, CopySourceOptions, DEFAULT_REGION, getVersionId, PostPolicy } export class Client extends TypedClient { // Set application specific information. diff --git a/tests/functional/functional-tests.js b/tests/functional/functional-tests.js index 2584fd7d..c4480f9c 100644 --- a/tests/functional/functional-tests.js +++ b/tests/functional/functional-tests.js @@ -25,19 +25,23 @@ import * as url from 'node:url' import async from 'async' import chai from 'chai' import _ from 'lodash' +import { + // eslint-disable-next-line import/named + AssumeRoleProvider, + Client, + // eslint-disable-next-line import/named + CopyConditions, + // eslint-disable-next-line import/named + CopyDestinationOptions, + // eslint-disable-next-line import/named + CopySourceOptions, + // eslint-disable-next-line import/named + DEFAULT_REGION, +} from 'minio' import { step } from 'mocha-steps' import splitFile from 'split-file' import superagent from 'superagent' import * as uuid from 'uuid' - -let minio -try { - minio = require('../../dist/main/minio.js') -} catch (err) { - minio = require('minio') -} - -const { AssumeRoleProvider, CopyDestinationOptions, CopySourceOptions, DEFAULT_REGION } = minio /** Functional Tests need to be run externally e.g in https://github.com/minio/mint **/ const assert = chai.assert @@ -94,10 +98,10 @@ describe('functional tests', function () { // a directory with files to read from, i.e. /mint/data. var dataDir = process.env['MINT_DATA_DIR'] - var client = new minio.Client(clientConfigParams) + var client = new Client(clientConfigParams) var usEastConfig = clientConfigParams usEastConfig.region = server_region - var clientUsEastRegion = new minio.Client(usEastConfig) + var clientUsEastRegion = new Client(usEastConfig) var traceStream // FUNCTIONAL_TEST_TRACE env variable contains the path to which trace @@ -723,7 +727,7 @@ describe('functional tests', function () { step( `copyObject(bucketName, objectName, srcObject, conditions, cb)_bucketName:${bucketName}, objectName:${_100kbObjectNameCopy}, srcObject:/${bucketName}/${_100kbObjectName}, conditions:ExceptIncorrectEtag_`, (done) => { - var conds = new minio.CopyConditions() + var conds = new CopyConditions() conds.setMatchETagExcept('TestEtag') client.copyObject(bucketName, _100kbObjectNameCopy, '/' + bucketName + '/' + _100kbObjectName, conds, (e) => { if (e) { @@ -737,7 +741,7 @@ describe('functional tests', function () { step( `copyObject(bucketName, objectName, srcObject, conditions, cb)_bucketName:${bucketName}, objectName:${_100kbObjectNameCopy}, srcObject:/${bucketName}/${_100kbObjectName}, conditions:ExceptCorrectEtag_`, (done) => { - var conds = new minio.CopyConditions() + var conds = new CopyConditions() conds.setMatchETagExcept(etag) client .copyObject(bucketName, _100kbObjectNameCopy, '/' + bucketName + '/' + _100kbObjectName, conds) @@ -751,7 +755,7 @@ describe('functional tests', function () { step( `copyObject(bucketName, objectName, srcObject, conditions, cb)_bucketName:${bucketName}, objectName:${_100kbObjectNameCopy}, srcObject:/${bucketName}/${_100kbObjectName}, conditions:MatchCorrectEtag_`, (done) => { - var conds = new minio.CopyConditions() + var conds = new CopyConditions() conds.setMatchETag(etag) client.copyObject(bucketName, _100kbObjectNameCopy, '/' + bucketName + '/' + _100kbObjectName, conds, (e) => { if (e) { @@ -765,7 +769,7 @@ describe('functional tests', function () { step( `copyObject(bucketName, objectName, srcObject, conditions, cb)_bucketName:${bucketName}, objectName:${_100kbObjectNameCopy}, srcObject:/${bucketName}/${_100kbObjectName}, conditions:MatchIncorrectEtag_`, (done) => { - var conds = new minio.CopyConditions() + var conds = new CopyConditions() conds.setMatchETag('TestETag') client .copyObject(bucketName, _100kbObjectNameCopy, '/' + bucketName + '/' + _100kbObjectName, conds) @@ -779,7 +783,7 @@ describe('functional tests', function () { step( `copyObject(bucketName, objectName, srcObject, conditions, cb)_bucketName:${bucketName}, objectName:${_100kbObjectNameCopy}, srcObject:/${bucketName}/${_100kbObjectName}, conditions:Unmodified since ${modifiedDate}`, (done) => { - var conds = new minio.CopyConditions() + var conds = new CopyConditions() conds.setUnmodified(new Date(modifiedDate)) client.copyObject(bucketName, _100kbObjectNameCopy, '/' + bucketName + '/' + _100kbObjectName, conds, (e) => { if (e) { @@ -793,7 +797,7 @@ describe('functional tests', function () { step( `copyObject(bucketName, objectName, srcObject, conditions, cb)_bucketName:${bucketName}, objectName:${_100kbObjectNameCopy}, srcObject:/${bucketName}/${_100kbObjectName}, conditions:Unmodified since 2010-03-26T12:00:00Z_`, (done) => { - var conds = new minio.CopyConditions() + var conds = new CopyConditions() conds.setUnmodified(new Date('2010-03-26T12:00:00Z')) client .copyObject(bucketName, _100kbObjectNameCopy, '/' + bucketName + '/' + _100kbObjectName, conds) @@ -3789,7 +3793,7 @@ describe('functional tests', function () { const aRoleConf = Object.assign({}, clientConfigParams, { credentialsProvider: assumeRoleProvider }) - const assumeRoleClient = new minio.Client(aRoleConf) + const assumeRoleClient = new Client(aRoleConf) assumeRoleClient.region = server_region describe('Put an Object', function () {