From 9ba8fcf08e61a938c85b0e3ee902ff5ae275c14a Mon Sep 17 00:00:00 2001 From: Florian Schade Date: Wed, 2 Dec 2020 14:18:11 +0100 Subject: [PATCH] simplify playbooks and api --- tests/k6/src/lib/api/api.ts | 31 +- tests/k6/src/lib/api/dav.ts | 143 ++----- tests/k6/src/lib/api/index.ts | 1 - tests/k6/src/lib/api/users.ts | 26 -- tests/k6/src/lib/playbook/dav.ts | 399 +++++------------- tests/k6/src/lib/playbook/playbook.ts | 19 + tests/k6/src/lib/types.ts | 4 +- .../jira/ocis/1007/folder-listing/flat.ts | 18 +- .../jira/ocis/1007/folder-listing/nested.ts | 24 +- .../1007/simple-down-and-upload/many-small.ts | 18 +- .../1007/simple-down-and-upload/some-large.ts | 18 +- 11 files changed, 233 insertions(+), 468 deletions(-) delete mode 100644 tests/k6/src/lib/api/users.ts create mode 100644 tests/k6/src/lib/playbook/playbook.ts diff --git a/tests/k6/src/lib/api/api.ts b/tests/k6/src/lib/api/api.ts index 1957edcd4d..7ba632d1b8 100644 --- a/tests/k6/src/lib/api/api.ts +++ b/tests/k6/src/lib/api/api.ts @@ -1,7 +1,10 @@ import encoding from 'k6/encoding'; import * as types from '../types'; +import * as defaults from "../defaults"; +import {merge} from 'lodash'; +import http, {RefinedParams, RefinedResponse, RequestBody, ResponseType} from "k6/http"; -export const headersDefault = ({credential}: { credential: types.Credential }): { [key: string]: string } => { +export const buildHeaders = ({credential}: { credential: types.Credential }): { [key: string]: string } => { const isOIDCGuard = (credential as types.Token).tokenType !== undefined; const authOIDC = credential as types.Token; const authBasic = credential as types.Account; @@ -9,4 +12,30 @@ export const headersDefault = ({credential}: { credential: types.Credential }): return { Authorization: isOIDCGuard ? `${authOIDC.tokenType} ${authOIDC.accessToken}` : `Basic ${encoding.b64encode(`${authBasic.login}:${authBasic.password}`)}`, } +} + +export const buildURL = ({path}: { path: string }): string => { + return [ + defaults.ENV.HOST, + ...path.split('/').filter(Boolean) + ].join('/') +} + +export const request = ({method, path, body = {}, params = {}, credential}: { + method: 'PROPFIND' | 'PUT' | 'GET' | 'DELETE' | 'MKCOL', + path: string, + credential: types.Credential; + body?: RequestBody | null, + params?: RefinedParams | null +}): RefinedResponse => { + return http.request( + method, + buildURL({path}), + body, + merge({ + headers: { + ...buildHeaders({credential}) + } + }, params) + ); } \ No newline at end of file diff --git a/tests/k6/src/lib/api/dav.ts b/tests/k6/src/lib/api/dav.ts index ed78e70a24..722e3ad0b5 100644 --- a/tests/k6/src/lib/api/dav.ts +++ b/tests/k6/src/lib/api/dav.ts @@ -1,150 +1,59 @@ -import http, {RefinedResponse, ResponseType} from 'k6/http'; +import {RefinedResponse, ResponseType} from 'k6/http'; import * as api from './api' -import * as defaults from '../defaults'; import * as types from '../types'; -export const fileUpload = ( - { - credential, - userName, - path = '', - asset, - tags, - }: { +export class Upload { + public static exec({credential, userName, path = '', asset, tags}: { credential: types.Credential; userName: string; asset: types.Asset; path?: string; - tags?: { [key: string]: string }; + tags?: types.Tags; + }): RefinedResponse { + return api.request({method: 'PUT', credential, path: `/remote.php/dav/files/${userName}/${path}/${asset.name}`, params: {tags}, body: asset.bytes as any}) } -): RefinedResponse => { - - return http.put( - [ - defaults.ENV.HOST, - ...`/remote.php/dav/files/${userName}/${path}/${asset.name}`.split('/').filter(Boolean) - ].join('/'), - asset.bytes as any, - { - tags, - headers: { - ...api.headersDefault({credential}) - } - } - ); } -export const fileDownload = ( - { - credential, - userName, - path, - tags, - }: { +export class Download { + public static exec({credential, userName, path, tags}: { credential: types.Credential; userName: string; path: string; - tags?: { [key: string]: string }; + tags?: types.Tags; + }): RefinedResponse { + return api.request({method: 'GET', credential, path: `/remote.php/dav/files/${userName}/${path}`, params: {tags}}) } -): RefinedResponse => { - return http.get( - [ - defaults.ENV.HOST, - ...`/remote.php/dav/files/${userName}/${path}`.split('/').filter(Boolean) - ].join('/'), - { - tags, - headers: { - ...api.headersDefault({credential}) - } - } - ); } -export const fileDelete = ( - { - credential, - userName, - path, - tags, - }: { +export class Delete { + public static exec({credential, userName, path, tags}: { credential: types.Credential; userName: string; path: string; - tags?: { [key: string]: string }; + tags?: types.Tags; + }): RefinedResponse { + return api.request({method: 'DELETE', credential, path: `/remote.php/dav/files/${userName}/${path}`, params: {tags}}) } -): RefinedResponse => { - return http.del( - [ - defaults.ENV.HOST, - ...`/remote.php/dav/files/${userName}/${path}`.split('/').filter(Boolean) - ].join('/'), - {}, - { - tags, - headers: { - ...api.headersDefault({credential}) - } - } - ); } -export const folderCreate = ( - { - credential, - userName, - path, - tags, - }: { +export class Create { + public static exec({credential, userName, path, tags}: { credential: types.Credential; userName: string; path: string; - tags?: { [key: string]: string }; + tags?: types.Tags; + }): RefinedResponse { + return api.request({method: 'MKCOL', credential, path: `/remote.php/dav/files/${userName}/${path}`, params: {tags}}) } -): RefinedResponse => { - return http.request( - 'MKCOL', - [ - defaults.ENV.HOST, - ...`/remote.php/dav/files/${userName}/${path}`.split('/').filter(Boolean) - ].join('/'), - {}, - { - tags, - headers: { - ...api.headersDefault({credential}) - } - } - ); } -export const folderDelete = fileDelete - -export const propfind = ( - { - credential, - userName, - path = '', - tags, - }: { +export class Propfind { + public static exec({credential, userName, path = '', tags}: { credential: types.Credential; userName: string; path?: string; - tags?: { [key: string]: string }; + tags?: types.Tags; + }): RefinedResponse { + return api.request({method: 'PROPFIND', credential, path: `/remote.php/dav/files/${userName}/${path}`, params: {tags}}) } -): RefinedResponse => { - return http.request( - 'PROPFIND', - [ - defaults.ENV.HOST, - ...`/remote.php/dav/files/${userName}/${path}`.split('/').filter(Boolean) - ].join('/'), - {}, - { - tags, - headers: { - ...api.headersDefault({credential}) - } - } - ); } \ No newline at end of file diff --git a/tests/k6/src/lib/api/index.ts b/tests/k6/src/lib/api/index.ts index 52cba2cff5..9219d4ba2a 100644 --- a/tests/k6/src/lib/api/index.ts +++ b/tests/k6/src/lib/api/index.ts @@ -1,3 +1,2 @@ export * as api from './api' export * as dav from './dav' -export * as users from './users' \ No newline at end of file diff --git a/tests/k6/src/lib/api/users.ts b/tests/k6/src/lib/api/users.ts deleted file mode 100644 index 027f6d6321..0000000000 --- a/tests/k6/src/lib/api/users.ts +++ /dev/null @@ -1,26 +0,0 @@ -import http, {RefinedResponse, ResponseType} from 'k6/http'; -import * as api from './api' -import * as defaults from '../defaults'; -import * as types from '../types'; - -export const userInfo = ( - { - credential, - userName, - tags, - }: { - credential: types.Credential; - userName: string; - tags?: { [name: string]: string }; - } -): RefinedResponse => { - return http.get( - `${defaults.ENV.HOST}/ocs/v1.php/cloud/users/${userName}`, - { - tags, - headers: { - ...api.headersDefault({credential}) - }, - } - ); -} \ No newline at end of file diff --git a/tests/k6/src/lib/playbook/dav.ts b/tests/k6/src/lib/playbook/dav.ts index ac648c5faa..07f97d3e41 100644 --- a/tests/k6/src/lib/playbook/dav.ts +++ b/tests/k6/src/lib/playbook/dav.ts @@ -1,308 +1,141 @@ -import {Gauge, Trend} from 'k6/metrics'; import * as api from '../api'; import {check} from 'k6'; import * as types from '../types'; import {RefinedResponse, ResponseType} from 'k6/http'; +import {Play} from "./playbook"; -export const fileUpload = ({name, metricID = 'default'}: { name?: string; metricID?: string; }) => { - const playName = name || `oc_${metricID}_play_dav_file_upload`; - const metricTrendName = `${playName}_trend`; - const metricTrend = new Trend(metricTrendName, true); - const metricErrorRateName = `${playName}_error_rate`; - const metricErrorRate = new Gauge(metricErrorRateName); - - return { - playName, - metricTrendName, - metricErrorRateName, - exec: ( - { - credential, - userName, - path, - asset, - tags, - }: { - credential: types.Credential; - path?: string; - userName: string; - asset: types.Asset; - tags?: { [key: string]: string }; - } - ): { - response: RefinedResponse; - tags: { [key: string]: string }; - } => { - tags = {play: playName, ...tags}; - - const response = api.dav.fileUpload({ - credential: credential as types.Credential, - asset, - userName, - tags, - path, - }); - - check(response, { - 'file upload status is 201': () => response.status === 201, - }, tags) || metricErrorRate.add(1, tags); - - metricTrend.add(response.timings.duration, tags) - - return { - response, - tags, - } - } +export class Upload extends Play { + constructor({name, metricID = 'default'}: { name?: string; metricID?: string; }) { + super({name: name || `oc_${metricID}_play_dav_upload`}); } -}; -export const fileDelete = ({name, metricID = 'default'}: { name?: string; metricID?: string; }) => { - const playName = name || `oc_${metricID}_play_dav_file_delete`; - const metricTrendName = `${playName}_trend`; - const metricTrend = new Trend(metricTrendName, true); - const metricErrorRateName = `${playName}_error_rate`; - const metricErrorRate = new Gauge(metricErrorRateName); - - return { - playName, - metricTrendName, - metricErrorRateName, - exec: ( - { - credential, - userName, - path, - tags, - }: { - credential: types.Credential; - userName: string; - path: string; - tags?: { [key: string]: string }; - } - ): { - response: RefinedResponse; - tags: { [key: string]: string }; - } => { - tags = {play: playName, ...tags}; - - const response = api.dav.fileDelete({ - credential: credential as types.Credential, - path, - userName, - tags, - }); - - check(response, { - 'file delete status is 204': () => response.status === 204, - }, tags) || metricErrorRate.add(1, tags); - - metricTrend.add(response.timings.duration, tags) - - return { - response, - tags, - } + public exec( + {credential, userName, path, asset, tags}: { + credential: types.Credential; + path?: string; + userName: string; + asset: types.Asset; + tags?: types.Tags; } + ): { response: RefinedResponse; tags: types.Tags; } { + tags = {...this.tags, ...tags}; + + const response = api.dav.Upload.exec({credential: credential as types.Credential, asset, userName, tags, path}); + + check(response, { + 'upload status is 201': () => response.status === 201, + }, tags) || this.metricErrorRate.add(1, tags); + + this.metricTrend.add(response.timings.duration, tags) + + return {response, tags} } -}; +} -export const fileDownload = ({name, metricID = 'default'}: { name?: string; metricID?: string; }) => { - const playName = name || `oc_${metricID}_play_dav_file_download`; - const metricTrendName = `${playName}_trend`; - const metricTrend = new Trend(metricTrendName, true); - const metricErrorRateName = `${playName}_error_rate`; - const metricErrorRate = new Gauge(metricErrorRateName); +export class Delete extends Play { + constructor({name, metricID = 'default'}: { name?: string; metricID?: string; }) { + super({name: name || `oc_${metricID}_play_dav_delete`}); + } - return { - playName, - metricTrendName, - metricErrorRateName, - exec: ( - { - credential, - userName, - path, - tags, - }: { - credential: types.Credential; - userName: string; - path: string; - tags?: { [key: string]: string }; - } - ): { - response: RefinedResponse; - tags: { [key: string]: string }; - } => { - tags = {play: playName, ...tags}; - - const response = api.dav.fileDownload({ - credential: credential as types.Credential, - path, - userName, - tags, - }); - - check(response, { - 'file download status is 200': () => response.status === 200, - }, tags) || metricErrorRate.add(1, tags); - - metricTrend.add(response.timings.duration, tags) - - return { - response, - tags, - } + public exec( + {credential, userName, path, tags}: { + credential: types.Credential; + path: string; + userName: string; + tags?: types.Tags; } + ): { response: RefinedResponse; tags: types.Tags; } { + tags = {...this.tags, ...tags}; + + const response = api.dav.Delete.exec({credential: credential as types.Credential, userName, tags, path}); + + check(response, { + 'delete status is 204': () => response.status === 204, + }, tags) || this.metricErrorRate.add(1, tags); + + this.metricTrend.add(response.timings.duration, tags) + + return {response, tags} } -}; +} -export const folderCreate = ({name, metricID = 'default'}: { name?: string; metricID?: string; }) => { - const playName = name || `oc_${metricID}_play_dav_folder_create`; - const metricTrendName = `${playName}_trend`; - const metricTrend = new Trend(metricTrendName, true); - const metricErrorRateName = `${playName}_error_rate`; - const metricErrorRate = new Gauge(metricErrorRateName); +export class Download extends Play { + constructor({name, metricID = 'default'}: { name?: string; metricID?: string; }) { + super({name: name || `oc_${metricID}_play_dav_download`}); + } - return { - playName, - metricTrendName, - metricErrorRateName, - exec: ( - { - credential, - userName, - path, - tags, - }: { - credential: types.Credential; - userName: string; - path: string; - tags?: { [key: string]: string }; - } - ): { - response: RefinedResponse; - tags: { [key: string]: string }; - } => { - tags = {play: playName, ...tags}; - - const response = api.dav.folderCreate({ - credential: credential as types.Credential, - path, - userName, - tags, - }); - - check(response, { - 'folder create status is 201': () => response.status === 201, - }, tags) || metricErrorRate.add(1, tags); - - metricTrend.add(response.timings.duration, tags) - - return { - response, - tags, - } + public exec( + {credential, userName, path, tags}: { + credential: types.Credential; + path: string; + userName: string; + tags?: types.Tags; } + ): { response: RefinedResponse; tags: types.Tags; } { + tags = {...this.tags, ...tags}; + + const response = api.dav.Download.exec({credential: credential as types.Credential, userName, tags, path}); + + check(response, { + 'download status is 200': () => response.status === 200, + }, tags) || this.metricErrorRate.add(1, tags); + + this.metricTrend.add(response.timings.duration, tags) + + return {response, tags} } -}; +} -export const folderDelete = ({name, metricID = 'default'}: { name?: string; metricID?: string; }) => { - const playName = name || `oc_${metricID}_play_dav_folder_delete`; - const metricTrendName = `${playName}_trend`; - const metricTrend = new Trend(metricTrendName, true); - const metricErrorRateName = `${playName}_error_rate`; - const metricErrorRate = new Gauge(metricErrorRateName); +export class Create extends Play { + constructor({name, metricID = 'default'}: { name?: string; metricID?: string; }) { + super({name: name || `oc_${metricID}_play_dav_create`}); + } - return { - playName, - metricTrendName, - metricErrorRateName, - exec: ( - { - credential, - userName, - path, - tags, - }: { - credential: types.Credential; - userName: string; - path: string; - tags?: { [key: string]: string }; - } - ): { - response: RefinedResponse; - tags: { [key: string]: string }; - } => { - tags = {play: playName, ...tags}; - - const response = api.dav.folderDelete({ - credential: credential as types.Credential, - path, - userName, - tags, - }); - - check(response, { - 'folder delete status is 204': () => response.status === 204, - }, tags) || metricErrorRate.add(1, tags); - - metricTrend.add(response.timings.duration, tags) - - return { - response, - tags, - } + public exec( + {credential, userName, path, tags}: { + credential: types.Credential; + path: string; + userName: string; + tags?: types.Tags; } + ): { response: RefinedResponse; tags: types.Tags; } { + tags = {...this.tags, ...tags}; + + const response = api.dav.Create.exec({credential: credential as types.Credential, userName, tags, path}); + + check(response, { + 'create status is 201': () => response.status === 201, + }, tags) || this.metricErrorRate.add(1, tags); + + this.metricTrend.add(response.timings.duration, tags) + + return {response, tags} } -}; +} -export const propfind = ({name, metricID = 'default'}: { name?: string; metricID?: string; }) => { - const playName = name || `oc_${metricID}_play_dav_propfind`; - const metricTrendName = `${playName}_trend`; - const metricTrend = new Trend(metricTrendName, true); - const metricErrorRateName = `${playName}_error_rate`; - const metricErrorRate = new Gauge(metricErrorRateName); +export class Propfind extends Play { + constructor({name, metricID = 'default'}: { name?: string; metricID?: string; }) { + super({name: name || `oc_${metricID}_play_dav_propfind`}); + } - return { - playName, - metricTrendName, - metricErrorRateName, - exec: ( - { - credential, - userName, - path, - tags, - }: { - credential: types.Credential; - userName: string; - path?: string; - tags?: { [key: string]: string }; - } - ): { - response: RefinedResponse; - tags: { [key: string]: string }; - } => { - tags = {play: playName, ...tags}; - - const response = api.dav.propfind({ - credential: credential as types.Credential, - path, - userName, - tags, - }); - - check(response, { - 'propfind status is 207': () => response.status === 207, - }, tags) || metricErrorRate.add(1, tags); - - metricTrend.add(response.timings.duration, tags) - - return { - response, - tags, - } + public exec( + {credential, userName, path, tags}: { + credential: types.Credential; + path?: string; + userName: string; + tags?: types.Tags; } + ): { response: RefinedResponse; tags: types.Tags; } { + tags = {...this.tags, ...tags}; + + const response = api.dav.Propfind.exec({credential: credential as types.Credential, userName, tags, path}); + + check(response, { + 'propfind status is 207': () => response.status === 207, + }, tags) || this.metricErrorRate.add(1, tags); + + this.metricTrend.add(response.timings.duration, tags) + + return {response, tags} } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/tests/k6/src/lib/playbook/playbook.ts b/tests/k6/src/lib/playbook/playbook.ts new file mode 100644 index 0000000000..e85dd292ad --- /dev/null +++ b/tests/k6/src/lib/playbook/playbook.ts @@ -0,0 +1,19 @@ +import {Gauge, Trend} from "k6/metrics"; + +export class Play { + public readonly name: string; + public readonly metricTrendName: string; + public readonly metricErrorRateName: string; + public readonly metricTrend: Trend; + public readonly metricErrorRate: Gauge; + protected tags: { [key: string]: string }; + + constructor({name}: { name: string; }) { + this.name = name; + this.metricTrendName = `${this.name}_trend`; + this.metricErrorRateName = `${this.name}_error_rate`; + this.metricTrend = new Trend(this.metricTrendName, true); + this.metricErrorRate = new Gauge(this.metricErrorRateName); + this.tags = {play: this.name} + } +} \ No newline at end of file diff --git a/tests/k6/src/lib/types.ts b/tests/k6/src/lib/types.ts index 8cecf6e408..bcd5cd8082 100644 --- a/tests/k6/src/lib/types.ts +++ b/tests/k6/src/lib/types.ts @@ -23,4 +23,6 @@ export interface AuthProvider { credential: Credential } -export type AssetUnit = 'KB' | 'MB' | 'GB' \ No newline at end of file +export type AssetUnit = 'KB' | 'MB' | 'GB' + +export type Tags = { [key: string]: string } \ No newline at end of file diff --git a/tests/k6/src/test/issue/jira/ocis/1007/folder-listing/flat.ts b/tests/k6/src/test/issue/jira/ocis/1007/folder-listing/flat.ts index 884b7b06e1..e4e11794aa 100644 --- a/tests/k6/src/test/issue/jira/ocis/1007/folder-listing/flat.ts +++ b/tests/k6/src/test/issue/jira/ocis/1007/folder-listing/flat.ts @@ -10,18 +10,18 @@ const files: { }[] = times(1000, () => ({size: 1, unit: 'KB'})) const authFactory = new auth.default(utils.buildAccount({login: defaults.ACCOUNTS.EINSTEIN})); const plays = { - fileUpload: playbook.dav.fileUpload({}), - propfind: playbook.dav.propfind({}), - fileDelete: playbook.dav.fileDelete({}), + davUpload: new playbook.dav.Upload({}), + davPropfind: new playbook.dav.Propfind({}), + davDelete: new playbook.dav.Delete({}), } export const options: Options = { insecureSkipTLSVerify: true, iterations: 3, vus: 1, thresholds: files.reduce((acc: any, c) => { - acc[`${plays.fileUpload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] - acc[`${plays.propfind.metricTrendName}`] = [] - acc[`${plays.fileDelete.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davUpload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davPropfind.metricTrendName}`] = [] + acc[`${plays.davDelete.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] return acc }, {}), }; @@ -38,7 +38,7 @@ export default (): void => { size: f.size, }) - plays.fileUpload.exec({ + plays.davUpload.exec({ credential, asset, userName: account.login, @@ -48,13 +48,13 @@ export default (): void => { filesUploaded.push({id, name: asset.name}) }) - plays.propfind.exec({ + plays.davPropfind.exec({ credential, userName: account.login, }) filesUploaded.forEach(f => { - plays.fileDelete.exec({ + plays.davDelete.exec({ credential, userName: account.login, path: f.name, diff --git a/tests/k6/src/test/issue/jira/ocis/1007/folder-listing/nested.ts b/tests/k6/src/test/issue/jira/ocis/1007/folder-listing/nested.ts index 2af298381c..097fda0b41 100644 --- a/tests/k6/src/test/issue/jira/ocis/1007/folder-listing/nested.ts +++ b/tests/k6/src/test/issue/jira/ocis/1007/folder-listing/nested.ts @@ -10,20 +10,20 @@ const files: { }[] = times(1000, () => ({size: 1, unit: 'KB'})) const authFactory = new auth.default(utils.buildAccount({login: defaults.ACCOUNTS.EINSTEIN})); const plays = { - fileUpload: playbook.dav.fileUpload({}), - propfind: playbook.dav.propfind({}), - folderCreate: playbook.dav.folderCreate({}), - folderDelete: playbook.dav.folderDelete({}), + davUpload: new playbook.dav.Upload({}), + davPropfind: new playbook.dav.Propfind({}), + davCreate: new playbook.dav.Create({}), + davDelete: new playbook.dav.Delete({}), } export const options: Options = { insecureSkipTLSVerify: true, iterations: 3, vus: 1, thresholds: files.reduce((acc: any, c) => { - acc[`${plays.fileUpload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] - acc[`${plays.propfind.metricTrendName}`] = [] - acc[`${plays.folderCreate.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] - acc[`${plays.folderDelete.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davUpload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davPropfind.metricTrendName}`] = [] + acc[`${plays.davCreate.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davDelete.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] return acc }, {}), }; @@ -43,7 +43,7 @@ export default (): void => { const folder = times(utils.randomNumber({min: 1, max: 10}), () => utils.randomString()).reduce((acc: string[], c) => { acc.push(c) - plays.folderCreate.exec({ + plays.davCreate.exec({ credential, path: acc.join('/'), userName: account.login, @@ -54,7 +54,7 @@ export default (): void => { }, []).join('/') - plays.fileUpload.exec({ + plays.davUpload.exec({ credential, asset, path: folder, @@ -65,13 +65,13 @@ export default (): void => { filesUploaded.push({id, name: asset.name, folder}) }) - plays.propfind.exec({ + plays.davPropfind.exec({ credential, userName: account.login, }) filesUploaded.forEach(f => { - plays.folderDelete.exec({ + plays.davDelete.exec({ credential, userName: account.login, path: f.folder.split('/')[0], diff --git a/tests/k6/src/test/issue/jira/ocis/1007/simple-down-and-upload/many-small.ts b/tests/k6/src/test/issue/jira/ocis/1007/simple-down-and-upload/many-small.ts index 299c95b702..b7ab3d1829 100644 --- a/tests/k6/src/test/issue/jira/ocis/1007/simple-down-and-upload/many-small.ts +++ b/tests/k6/src/test/issue/jira/ocis/1007/simple-down-and-upload/many-small.ts @@ -14,18 +14,18 @@ const files: { ] const authFactory = new auth.default(utils.buildAccount({login: defaults.ACCOUNTS.EINSTEIN})); const plays = { - fileUpload: playbook.dav.fileUpload({}), - fileDownload: playbook.dav.fileDownload({}), - fileDelete: playbook.dav.fileDelete({}), + davUpload: new playbook.dav.Upload({}), + davDownload: new playbook.dav.Download({}), + davDelete: new playbook.dav.Delete({}), } export const options: Options = { insecureSkipTLSVerify: true, iterations: 3, vus: 1, thresholds: files.reduce((acc: any, c) => { - acc[`${plays.fileUpload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] - acc[`${plays.fileDownload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] - acc[`${plays.fileDelete.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davUpload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davDownload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davDelete.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] return acc }, {}), }; @@ -42,7 +42,7 @@ export default (): void => { size: f.size, }) - plays.fileUpload.exec({ + plays.davUpload.exec({ credential, asset, userName: account.login, @@ -53,7 +53,7 @@ export default (): void => { }) filesUploaded.forEach(f => { - plays.fileDownload.exec({ + plays.davDownload.exec({ credential, userName: account.login, path: f.name, @@ -62,7 +62,7 @@ export default (): void => { }) filesUploaded.forEach(f => { - plays.fileDelete.exec({ + plays.davDelete.exec({ credential, userName: account.login, path: f.name, diff --git a/tests/k6/src/test/issue/jira/ocis/1007/simple-down-and-upload/some-large.ts b/tests/k6/src/test/issue/jira/ocis/1007/simple-down-and-upload/some-large.ts index 02d22570d2..82ef129a6a 100644 --- a/tests/k6/src/test/issue/jira/ocis/1007/simple-down-and-upload/some-large.ts +++ b/tests/k6/src/test/issue/jira/ocis/1007/simple-down-and-upload/some-large.ts @@ -16,18 +16,18 @@ const files: { ] const authFactory = new auth.default(utils.buildAccount({login: defaults.ACCOUNTS.EINSTEIN})); const plays = { - fileUpload: playbook.dav.fileUpload({}), - fileDownload: playbook.dav.fileDownload({}), - fileDelete: playbook.dav.fileDelete({}), + davUpload: new playbook.dav.Upload({}), + davDownload: new playbook.dav.Download({}), + davDelete: new playbook.dav.Delete({}), } export const options: Options = { insecureSkipTLSVerify: true, iterations: 3, vus: 1, thresholds: files.reduce((acc: any, c) => { - acc[`${plays.fileUpload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] - acc[`${plays.fileDownload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] - acc[`${plays.fileDelete.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davUpload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davDownload.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] + acc[`${plays.davDelete.metricTrendName}{asset:${c.unit + c.size.toString()}`] = [] return acc }, {}), }; @@ -45,7 +45,7 @@ export default (): void => { size: f.size, }) - plays.fileUpload.exec({ + plays.davUpload.exec({ credential, asset, userName: account.login, @@ -56,7 +56,7 @@ export default (): void => { }) filesUploaded.forEach(f => { - plays.fileDownload.exec({ + plays.davDownload.exec({ credential, userName: account.login, path: f.name, @@ -65,7 +65,7 @@ export default (): void => { }) filesUploaded.forEach(f => { - plays.fileDelete.exec({ + plays.davDelete.exec({ credential, userName: account.login, path: f.name,