!737 分布式调度用例优化

Merge pull request !737 from luowei164/master
This commit is contained in:
openharmony_ci 2024-10-25 02:56:46 +00:00 committed by Gitee
commit 2de3a04628
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1121,29 +1121,29 @@ export default function DmsFwkFaTest() {
let msg = result.reply.readInt(); let msg = result.reply.readInt();
console.info(' SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 msg: ' + msg) console.info(' SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 msg: ' + msg)
expect(msg == 100).assertTrue(); expect(msg == 100).assertTrue();
}).catch((e) => { }).catch((e) => {
console.log('sendRequest error:' + e); console.log('sendRequest error:' + e);
expect().assertFail(); expect().assertFail();
}); });
}, },
onDisConnect: (elementName) => { onDisConnect: (elementName) => {
console.info('SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 onDisConnect: ' + JSON.stringify(elementName)); console.info('SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 onDisConnect: ' + JSON.stringify(elementName));
expect().assertFail(); expect().assertFail();
}, },
onFailed: (code) => { onFailed: (code) => {
console.info('SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 onFailed: ' + code); console.info('SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 onFailed: ' + code);
expect().assertFail(); expect().assertFail();
} }
}); });
} catch (err) { } catch (err) {
console.info('SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 catch: ' + err.code); console.info('SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 catch: ' + err.code);
console.info('SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 catch: ' + err.message); console.info('SUB_DMS_StandardOs_collaboration_connetability_connectRemoteAbility_1300 catch: ' + err.message);
expect().assertFail(); expect().assertFail();
} }
await sleep(1000); await sleep(1000);
done(); done();
@ -1937,19 +1937,6 @@ export default function DmsFwkFaTest() {
}; };
connectId1 = featureAbility.connectAbility(request1, options1); connectId1 = featureAbility.connectAbility(request1, options1);
await sleep(1000) await sleep(1000)
featureAbility.disconnectAbility(connectId, (err, data) => {
console.info('SUB_DMS_StandardOs_collaboration_connectAbility_connectRemoteAbility_0500 disconnectAbility err: ' + err.code);
console.info('SUB_DMS_StandardOs_collaboration_connectAbility_connectRemoteAbility_0500 disconnectAbilityerr: ' + err.message);
expect(err.code).assertEqual(0);
done();
});
await sleep(1000)
featureAbility.disconnectAbility(connectId1, (err, data) => {
console.info('SUB_DMS_StandardOs_collaboration_connectAbility_connectRemoteAbility_0500 disconnectAbility err: ' + err.code);
console.info('SUB_DMS_StandardOs_collaboration_connectAbility_connectRemoteAbility_0500 disconnectAbilityerr: ' + err.message);
expect(err.code).assertEqual(0);
done();
});
console.info("-----------------SUB_DMS_StandardOs_collaboration_connectAbility_connectRemoteAbility_0500 end------------------------"); console.info("-----------------SUB_DMS_StandardOs_collaboration_connectAbility_connectRemoteAbility_0500 end------------------------");
}) })
@ -1990,58 +1977,62 @@ export default function DmsFwkFaTest() {
it("SUB_DMS_StandardOs_stability_StabilityTest_0100", 0, async function (done) { it("SUB_DMS_StandardOs_stability_StabilityTest_0100", 0, async function (done) {
console.info("-----------------SUB_DMS_StandardOs_stability_StabilityTest_0100 start------------------------"); console.info("-----------------SUB_DMS_StandardOs_stability_StabilityTest_0100 start------------------------");
let connectId; let connectId;
try { for (let i = 0; i < 10; i++) {
for (let i = 0; i < 10; i++) { console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 index : ' + i);
connectId = featureAbility.connectAbility({ connectId = featureAbility.connectAbility({
deviceId: dvId, deviceId: dvId,
bundleName: "com.acts.example.dmsfwkstageserver", bundleName: "com.acts.example.dmsfwkstageserver",
abilityName: "ServiceAbility" abilityName: "ServiceAbility"
}, { }, {
onConnect: (elementName, proxy) => { onConnect: function(elementName, proxy) {
let option = new rpc.MessageOption(); let option = new rpc.MessageOption();
let data = new rpc.MessageParcel(); let data = new rpc.MessageParcel();
let reply = new rpc.MessageParcel(); let reply = new rpc.MessageParcel();
data.writeInt(1); data.writeInt(1);
data.writeInt(99); data.writeInt(99);
proxy.sendRequest(1, data, reply, option).then((result) => { proxy.sendRequest(1, data, reply, option).then(async (result) => {
console.log('sendRequest success'); console.log('sendRequest success');
let msg = result.reply.readInt(); let msg = result.reply.readInt();
console.info(' SUB_DMS_StandardOs_stability_StabilityTest_0100 msg: ' + msg) console.info(' SUB_DMS_StandardOs_stability_StabilityTest_0100 msg: ' + msg)
try {
expect(msg == 100).assertTrue(); expect(msg == 100).assertTrue();
done(); } catch (error) {
}).catch((e) => { console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 catch: ' + error);
console.log('sendRequest error:' + e); }
try{
await sleep(2000);
featureAbility.disconnectAbility(connectId, (err) => {
console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 disconnectAbility err: ' + JSON.stringify(err));
try{
expect(err.code).assertEqual(0);
} catch (error) {
console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 catch: ' + error);
}
})
}catch (err) {
console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 catch: ' + err.code);
expect().assertFail(); expect().assertFail();
done(); }
}); await sleep(4000);
}, }).catch((e) => {
onDisConnect: (elementName) => { console.log('sendRequest error:' + e);
console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 onDisConnect: ' + JSON.stringify(elementName));
expect().assertFail(); expect().assertFail();
done(); });
}, },
onFailed: (code) => { onDisConnect: (elementName) => {
console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 onFailed: ' + code); console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 onDisConnect: ' + JSON.stringify(elementName));
expect().assertFail(); expect().assertFail();
done(); },
} onFailed: (code) => {
}); console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 onFailed: ' + code);
featureAbility.disconnectAbility(connectId, (err, data) => { expect().assertFail();
console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 disconnectAbility err: ' + err.code); }
console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 disconnectAbilityerr: ' + err.message); });
expect(err.code).assertEqual(0); await sleep(4000);
done(); console.info("SUB_DMS_StandardOs_stability_StabilityTest_0100 connectId is : " + connectId);
})
console.info("SUB_DMS_StandardOs_stability_StabilityTest_0100 running at : " + i + ",here");
}
} catch (err) {
console.info('SUB_DMS_StandardOs_stability_StabilityTest_0100 catch: ' + err.code);
console.info('SUB_DMS_ConnectAbilitySUB_DMS_StandardOs_stability_StabilityTest_0100_0140 catch: ' + err.message);
expect().assertFail();
done();
} }
await sleep(1000); console.info("-----------------SUB_DMS_StandardOs_stability_StabilityTest_0100 end------------------------");
console.info("-----------------SUB_DMS_StandardOs_stability_StabilityTest_0100 end------------------------"); done();
}); });
}) })
} }