Skip to content

Commit

Permalink
feat: upstream support FQDN (#2118)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxiran committed Sep 3, 2021
1 parent 00d80bb commit 1a0b12b
Show file tree
Hide file tree
Showing 29 changed files with 132 additions and 106 deletions.
6 changes: 3 additions & 3 deletions web/cypress/fixtures/selector.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"checkedSwitcher": ".ant-switch-checked",
"deleteButton": ".ant-btn-dangerous",
"name": "#name",
"nodes_0_host": "#nodes_0_host",
"nodes_0_port": "#nodes_0_port",
"nodes_0_weight": "#nodes_0_weight",
"nodes_0_host": "#submitNodes_0_host",
"nodes_0_port": "#submitNodes_0_port",
"nodes_0_weight": "#submitNodes_0_weight",
"upstream_id": "#upstream_id",
"input": ":input",
"nameSelector": "[title=Name]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ context('Create and delete route with plugin orchestration', () => {
empty: '.ant-empty-normal',
name: '#name',
description: '#desc',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
groupButton: '.ant-radio-group',
canvas: '.x6-graph-svg',
startNode:
Expand Down Expand Up @@ -78,9 +78,6 @@ context('Create and delete route with plugin orchestration', () => {
cy.get(selector.canvasNode)
.click()
.then(() => {
const node2 = cy
.get('#container > svg > g > g.x6-graph-svg-stage > g:nth-child(2) > g > circle')
.eq(0);
const node1 = cy
.get('#container > svg > g > g.x6-graph-svg-stage > g:nth-child(1) > g > circle')
.eq(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ context('Create PluginTemplate Binding To Route', () => {
refresh: '.anticon-reload',
descriptionSelector: '[title=Description]',
name: '#name',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
customSelector: '[title=Custom]',
notificationClose: '.anticon-close',
nameSelector: '[title=Name]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
context('Can select service_id skip upstream in route', () => {
const selector = {
name: '#name',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
notification: '.ant-notification-notice-message',
upstreamSelector: '[data-cy=upstream_selector]',
input: ':input',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ context('Create and Delete Route', () => {
ruleCard: '.ant-modal',
operator: '#operator',
value: '#value',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
pluginCardBordered: '.ant-card-bordered',
disabledSwitcher: '#disable',
checkedSwitcher: '.ant-switch-checked',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ context('Create Route Both use uri and uris', () => {
uris_1: '#uris_1',
remote_addrs_0: '#remote_addrs_0',
remote_addrs_1: '#remote_addrs_1',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
nameSelector: '[title=Name]',
drawer: '.ant-drawer-content',
monacoScroll: '.monaco-scrollable-element',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
context('Create Route without Upstream', () => {
const selector = {
name: '#name',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
input: ':input',
nameSelector: '[title=Name]',
deleteAlert: '.ant-modal-body',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
context('Create Route with advanced matching conditions', () => {
const selector = {
name: '#name',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
deleteAlert: '.ant-modal-body',
notificationCloseIcon: '.ant-notification-close-icon',
notification: '.ant-notification-notice-message',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ context('Create and delete route with api-breaker form', () => {
disabledSwitcher: '#disable',
checkedSwitcher: '.ant-switch-checked',
drawer: '.ant-drawer-content',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
break_response_code: '#break_response_code',
alert: '.ant-form-item-explain-error [role=alert]',
deleteAlert: '.ant-modal-body',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ context('Create and Edit Route With Custom CHash Key Upstream', () => {
defaultCHashKey: '[value="remote_addr"]',
upstreamType: '.ant-select-item-option-content',
hashPosition: '.ant-select-item-option-content',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
nameSelector: '[title=Name]',
chash_key: '#key',
deleteAlert: '.ant-modal-body',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ context('Create and delete route with cors form', () => {
disabledSwitcher: '#disable',
checkedSwitcher: '.ant-switch-checked',
drawer: '.ant-drawer-content',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
deleteAlert: '.ant-modal-body',
notificationCloseIcon: '.ant-notification-close-icon',
notification: '.ant-notification-notice-message',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ context('Create and delete route with limit-count form', () => {
description: '#desc',
disabledSwitcher: '#disable',
drawer: '.ant-drawer-content',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
deleteAlert: '.ant-modal-body',
notificationCloseIcon: '.ant-notification-close-icon',
notification: '.ant-notification-notice-message',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ context('Create and delete route with limit-req form', () => {
drawer: '.ant-drawer-content',
pluginCardBordered: '.ant-card-bordered',
checkedSwitcher: '.ant-switch-checked',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
deleteAlert: '.ant-modal-body',
notificationCloseIcon: '.ant-notification-close-icon',
notification: '.ant-notification-notice-message',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ context('Create and delete route with proxy-mirror form', () => {
drawer: '.ant-drawer-content',
pluginCardBordered: '.ant-card-bordered',
checkedSwitcher: '.ant-switch-checked',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
deleteAlert: '.ant-modal-body',
notificationCloseIcon: '.ant-notification-close-icon',
notification: '.ant-notification-notice-message',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import routeLocaleUS from '../../../src/pages/Route/locales/en-US';
context('create route with proxy-rewrite plugin', () => {
const selector = {
name: '#name',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
nameSelector: '[title=Name]',
deleteAlert: '.ant-modal-body',
notification: '.ant-notification-notice-message',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ context('Create and delete route with referer-restriction form', () => {
name: '#name',
description: '#desc',
pluginCardBordered: '.ant-card-bordered',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
disabledSwitcher: '#disable',
checkedSwitcher: '.ant-switch-checked',
drawer: '.ant-drawer-content',
Expand Down
21 changes: 14 additions & 7 deletions web/cypress/integration/route/create-route-with-upstream.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ context('Create Route with Upstream', () => {
const selector = {
name: '#name',
description: '#desc',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
upstreamSelector: '[data-cy=upstream_selector]',
nameSelector: '[title=Name]',
input: ':input',
Expand All @@ -42,6 +42,7 @@ context('Create Route with Upstream', () => {
routeName: 'test_route',
ip1: '127.0.0.1',
ip2: '127.0.0.2',
FQDN: 'bigserver.mycompany.com',
};

beforeEach(() => {
Expand All @@ -55,8 +56,14 @@ context('Create Route with Upstream', () => {

cy.get(selector.name).type(data.upstreamName);
cy.get(selector.description).type(data.description);
cy.get(selector.nodes_0_host).type(data.host1);
cy.get(selector.nodes_0_port).type(data.port);
cy.get(selector.nodes_0_host).type(data.FQDN);
cy.get('label[title="Port"]').then(($els) => {
const win = $els[0].ownerDocument.defaultView;
const before = win.getComputedStyle($els[0], 'before');
const contentValue = before.getPropertyValue('content');
expect(contentValue).to.eq('none');
});
cy.get(selector.nodes_0_port).clear();
cy.get(selector.nodes_0_weight).type(data.weight);
cy.contains('Next').click();
cy.contains('Submit').click();
Expand All @@ -82,8 +89,8 @@ context('Create Route with Upstream', () => {
cy.get(selector.upstreamSelector).click();
cy.contains('.ant-select-item-option-content', 'Custom').click();

cy.get(selector.nodes_0_host).clear().type(data.ip1);
cy.get(selector.nodes_0_port).type(data.port);
cy.get(selector.nodes_0_host).should('have.value', data.FQDN).clear().type(data.ip1);
cy.get(selector.nodes_0_port).should('have.value', '').type(data.port);
cy.get(selector.nodes_0_weight).type(data.weight);
cy.contains('Next').click();
cy.contains('Next').click();
Expand Down
13 changes: 8 additions & 5 deletions web/cypress/integration/route/import_export_route.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* limitations under the License.
*/
/* eslint-disable no-undef */
/* eslint-disable @typescript-eslint/no-invalid-this */
/* eslint-disable @typescript-eslint/no-loop-func */

import actionBarUS from '../../../src/components/ActionBar/locales/en-US';
import componentLocaleUS from '../../../src/locales/en-US/component';
import menuLocaleUS from '../../../src/locales/en-US/menu';
Expand All @@ -25,9 +28,9 @@ context('import and export routes', () => {
const selector = {
name: '#name',
description: '#desc',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
fileTypeRadio: '[type=radio]',
deleteAlert: '.ant-modal-body',
refresh: '.anticon-reload',
Expand Down Expand Up @@ -72,9 +75,9 @@ context('import and export routes', () => {
// input name, click Next
cy.contains('Next').click().click();
cy.get(selector.name).type(data[`route_name_${i}`]);
//FIXME: only GET in methods
// FIXME: only GET in methods
cy.get('#methods').click();
for (let i = 0; i < 7; i += 1) {
for (let j = 0; j < 7; j += 1) {
cy.get('#methods').type('{backspace}');
}
cy.get('#methods').type('GET');
Expand Down
6 changes: 3 additions & 3 deletions web/cypress/integration/route/search-route.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ context('Create and Search Route', () => {
uris_0: '#uris_0',
labels_0_labelKey: '#labels_0_labelKey',
labels_0_labelValue: '#labels_0_labelValue',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
nameSearchInput: '#name',
pathSearchInput: '#uri',
labelSelect_0: '.ant-select-selection-overflow',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ context('Create and Delete Service ', () => {
const selector = {
name: '#name',
description: '#desc',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
pluginCardBordered: '.ant-card-bordered',
disabledSwitcher: '#disable',
drawer: '.ant-drawer-content',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ context('Create and Edit Service with Custom CHash Key Upstream', () => {
roundRobinSelect: '[title="Round Robin"]',
varSelect: '[title="vars"]',
defaultCHashKey: '[value="remote_addr"]',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
upstreamType: '.ant-select-item-option-content',
hashPosition: '.ant-select-item-option-content',
chash_key: '#key',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ context('Edit Service with not select Upstream', () => {
const selector = {
name: '#name',
description: '#desc',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
input: ':input',
notification: '.ant-notification-notice-message',
nameSearch: '[title=Name]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ context('Edit Service with Upstream', () => {
empty: '.ant-empty-normal',
name: '#name',
description: '#desc',
nodes_0_host: '#nodes_0_host',
nodes_0_port: '#nodes_0_port',
nodes_0_weight: '#nodes_0_weight',
nodes_0_host: '#submitNodes_0_host',
nodes_0_port: '#submitNodes_0_port',
nodes_0_weight: '#submitNodes_0_weight',
notification: '.ant-notification-notice-message',
upstreamSelector: '[data-cy=upstream_selector]',
input: ':input',
Expand Down
Loading

0 comments on commit 1a0b12b

Please sign in to comment.