fix(接口测试): 加强host列表校验

This commit is contained in:
fit2-zhao 2020-09-07 13:42:21 +08:00
parent 92c5215349
commit a92db96844
4 changed files with 274 additions and 271 deletions

View File

@ -65,19 +65,19 @@
</template> </template>
<script> <script>
import MsApiScenarioConfig from "./components/ApiScenarioConfig"; import MsApiScenarioConfig from "./components/ApiScenarioConfig";
import {Test} from "./model/ScenarioModel" import {Test} from "./model/ScenarioModel"
import MsApiReportStatus from "../report/ApiReportStatus"; import MsApiReportStatus from "../report/ApiReportStatus";
import MsApiReportDialog from "./ApiReportDialog"; import MsApiReportDialog from "./ApiReportDialog";
import {checkoutTestManagerOrTestUser, downloadFile} from "@/common/js/utils"; import {checkoutTestManagerOrTestUser, downloadFile} from "@/common/js/utils";
import MsScheduleConfig from "../../common/components/MsScheduleConfig"; import MsScheduleConfig from "../../common/components/MsScheduleConfig";
import ApiImport from "./components/import/ApiImport"; import ApiImport from "./components/import/ApiImport";
import {getUUID} from "../../../../common/js/utils"; import {getUUID} from "../../../../common/js/utils";
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent"; import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
import MsContainer from "@/business/components/common/components/MsContainer"; import MsContainer from "@/business/components/common/components/MsContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer"; import MsMainContainer from "@/business/components/common/components/MsMainContainer";
export default { export default {
name: "MsApiTestConfig", name: "MsApiTestConfig",
components: { components: {
@ -339,26 +339,26 @@ export default {
created() { created() {
this.init(); this.init();
} }
} }
</script> </script>
<style scoped> <style scoped>
.test-container { .test-container {
height: calc(100vh - 155px); height: calc(100vh - 155px);
min-height: 600px; min-height: 600px;
} }
.test-name { .test-name {
width: 600px; width: 600px;
margin-left: -20px; margin-left: -20px;
margin-right: 20px; margin-right: 20px;
} }
.test-project { .test-project {
min-width: 150px; min-width: 150px;
} }
.test-container .more { .test-container .more {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>

View File

@ -123,6 +123,9 @@
validateDomain(domain) { validateDomain(domain) {
let url = {}; let url = {};
try { try {
if (!domain.startsWith("http") || !domain.startsWith("https")) {
domain += "http://";
}
url = new URL(domain); url = new URL(domain);
} catch (e) { } catch (e) {
this.$warning(this.$t('load_test.input_domain')); this.$warning(this.$t('load_test.input_domain'));

View File

@ -504,8 +504,8 @@ export class DNSCacheManager extends DefaultTestElement {
let collectionPropHosts = this.collectionProp('DNSCacheManager.hosts'); let collectionPropHosts = this.collectionProp('DNSCacheManager.hosts');
hosts.forEach(host => { hosts.forEach(host => {
let elementProp = collectionPropHosts.elementProp('', 'StaticHost'); let elementProp = collectionPropHosts.elementProp(host.domain, 'StaticHost');
if (host && host.domain.trim() === domain.trim()) { if (host && host.domain.trim().indexOf(domain.trim()) != -1) {
elementProp.stringProp('StaticHost.Name', host.domain); elementProp.stringProp('StaticHost.Name', host.domain);
elementProp.stringProp('StaticHost.Address', host.ip); elementProp.stringProp('StaticHost.Address', host.ip);
} }

View File

@ -948,8 +948,8 @@ class JMXGenerator {
let name = request.name + " DNSCacheManager"; let name = request.name + " DNSCacheManager";
let hosts = JSON.parse(request.environment.hosts); let hosts = JSON.parse(request.environment.hosts);
if (hosts.length > 0) { if (hosts.length > 0) {
let domain = request.environment.protocol + "://" + request.environment.domain; //let domain = request.environment.protocol + "://" + request.environment.domain;
threadGroup.put(new DNSCacheManager(name, domain, hosts)); threadGroup.put(new DNSCacheManager(name, request.environment.domain, hosts));
} }
} }
} }