mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-2387] rebalance suites (#1107)
* rebalance suites * try to fix flaky test * fix more related tests * fix retry * reorganise some more suites * move file to another suite
This commit is contained in:
committed by
Martin Muller
parent
39f528af67
commit
1c18f6c555
@@ -27,6 +27,7 @@ import { RepoApi } from '../repo-api';
|
||||
import { NodeBodyCreate } from './node-body-create';
|
||||
import { NodeContentTree, flattenNodeContentTree } from './node-content-tree';
|
||||
import { NodesApi as AdfNodeApi, NodeBodyLock} from '@alfresco/js-api';
|
||||
import { Utils } from '../../../../utilities/utils';
|
||||
|
||||
export class NodesApi extends RepoApi {
|
||||
nodesApi = new AdfNodeApi(this.alfrescoJsApi);
|
||||
@@ -264,6 +265,28 @@ export class NodesApi extends RepoApi {
|
||||
return (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
||||
}
|
||||
|
||||
async isFileLockedWriteWithRetry(nodeId: string, expect: boolean) {
|
||||
const data = {
|
||||
expect: expect,
|
||||
retry: 5
|
||||
};
|
||||
let isLocked;
|
||||
try {
|
||||
const locked = async () => {
|
||||
isLocked = (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
||||
if ( isLocked !== data.expect ) {
|
||||
return Promise.reject(isLocked);
|
||||
} else {
|
||||
return Promise.resolve(isLocked);
|
||||
}
|
||||
}
|
||||
return await Utils.retryCall(locked, data.retry);
|
||||
} catch (error) {
|
||||
console.log('-----> catch isLockedWriteWithRetry: ', error);
|
||||
}
|
||||
return isLocked;
|
||||
}
|
||||
|
||||
async isFileLockedByName(fileName: string, parentId: string) {
|
||||
const id = await this.getNodeIdFromParent(fileName, parentId);
|
||||
return await this.isFileLockedWrite(id);
|
||||
|
Reference in New Issue
Block a user