Skip to content

Commit 8bee0cf

Browse files
authored
feat: cluster scope adds hostnames (#356)
Signed-off-by: zhaoxinxin <1186037180@qq.com>
1 parent ac60432 commit 8bee0cf

File tree

17 files changed

+477
-165
lines changed

17 files changed

+477
-165
lines changed

cypress/e2e/clusters/cluster.cy.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ describe('Cluster', () => {
171171
cy.get('.MuiDialogContent-root').should('be.visible').and('contain', '10.0.0.0/8');
172172

173173
cy.get('body').click('topLeft');
174+
175+
cy.get(':nth-child(4) > .MuiPaper-root > .information_cidrsTags__4sKxa')
176+
.should('be.visible')
177+
.and('contain', 'cluster-1');
174178
});
175179

176180
it('can display config', () => {
@@ -373,6 +377,7 @@ describe('Cluster', () => {
373377
).click();
374378

375379
cy.get('.information_clusterContainer__l8H8p > :nth-child(1) > .MuiTypography-subtitle1')
380+
.scrollIntoView()
376381
.should('be.visible')
377382
.and('contain', 'cluster-10');
378383

@@ -444,6 +449,7 @@ describe('Cluster', () => {
444449
).click();
445450

446451
cy.get('.information_clusterContainer__l8H8p > :nth-child(1) > .MuiTypography-subtitle1')
452+
.scrollIntoView()
447453
.should('be.visible')
448454
.and('contain', 'cluster-1');
449455

@@ -516,6 +522,7 @@ describe('Cluster', () => {
516522
).click();
517523

518524
cy.get('.information_clusterContainer__l8H8p > :nth-child(1) > .MuiTypography-subtitle1')
525+
.scrollIntoView()
519526
.should('be.visible')
520527
.and('contain', 'cluster-10');
521528

@@ -565,6 +572,7 @@ describe('Cluster', () => {
565572
).click();
566573

567574
cy.get('.information_clusterContainer__l8H8p > :nth-child(1) > .MuiTypography-subtitle1')
575+
.scrollIntoView()
568576
.should('be.visible')
569577
.and('contain', 'cluster-10');
570578

cypress/e2e/clusters/create-cluster.cy.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ describe('Create cluster', () => {
280280
it('try to verify scopes', () => {
281281
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
282282
const location = _.times(101, () => _.sample(characters)).join('');
283+
const hostnames = _.times(31, () => _.sample(characters)).join('');
283284

284285
// Name is a required attribute.
285286
cy.get('#name').type('cluster-12');
@@ -323,6 +324,22 @@ describe('Create cluster', () => {
323324

324325
// Verification passed.
325326
cy.get('#cidrs-helper-text').should('not.exist');
327+
328+
// Should display cidrs the validation error message.
329+
cy.get(':nth-child(4) > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root').type('sigma');
330+
cy.get('#save').click();
331+
cy.url().should('include', '/clusters/new');
332+
cy.get('#hostnames-helper-text')
333+
.should('be.visible')
334+
.and('contain', `Please press ENTER to end the Hostnames creation.`);
335+
cy.get(':nth-child(4) > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root').type(
336+
'hostname{enter}',
337+
);
338+
cy.get(':nth-child(4) > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root').type(hostnames);
339+
340+
cy.get('#hostnames-helper-text')
341+
.should('be.visible')
342+
.and('contain', `Fill in the characters, the length is 1-30.`);
326343
});
327344

328345
it('try to verify config', () => {

cypress/e2e/clusters/update-cluster.cy.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ describe('Update cluster', () => {
6666
.and('contain', '192.168.0.0/16')
6767
.and('contain', '172.16.0.0/12');
6868

69+
cy.get(':nth-child(4) > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root')
70+
.should('contain', 'cluster-1')
71+
.and('contain', 'cluster-2')
72+
.and('contain', 'cluster-3');
73+
6974
// Show config.
7075
cy.get('#seedPeerLoadLimit').should('have.value', 300);
7176
cy.get('#peerLoadLimit').should('have.value', 51);
@@ -332,6 +337,22 @@ describe('Update cluster', () => {
332337
'192.168.40.0/24{enter}',
333338
);
334339
cy.get('#cidrs-helper-text').should('not.exist');
340+
341+
// Should display hostnames the validation error message.
342+
cy.get(':nth-child(4) > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root').type('cluster-2');
343+
344+
cy.get('#save').click();
345+
cy.url().should('include', '/clusters/1/edit');
346+
347+
// Show verification error message.
348+
cy.get('#hostnames-helper-text')
349+
.should('be.visible')
350+
.and('contain', `Please press ENTER to end the Hostnames creation.`);
351+
352+
cy.get(':nth-child(4) > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root').type(
353+
'cluster-1{enter}',
354+
);
355+
cy.get('#hostnames-helper-text').should('not.exist');
335356
});
336357

337358
it('try to verify config', () => {

cypress/e2e/job/preheats/create-preheat.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,12 @@ describe('Create preheat', () => {
359359
// Incorrect header value entered.
360360
cy.get('.new_headersValueInput__zn-9E > .MuiInputBase-root').type(value);
361361

362-
// Show header value verification error message.
362+
// Show header value verification error message.
363363
cy.get('.new_headersValueInput__zn-9E > .MuiFormHelperText-root')
364364
.should('be.visible')
365365
.and('have.text', 'Fill in the characters, the length is 1-1000.');
366366

367-
// Show header value verification error message.
367+
// Show header value verification error message.
368368
cy.get('.new_headersValueInput__zn-9E > .MuiFormHelperText-root')
369369
.should('be.visible')
370370
.and('have.text', 'Fill in the characters, the length is 1-1000.');

cypress/e2e/seed-peers/seed-peers.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe('Seed peers', () => {
183183

184184
describe('pagination', () => {
185185
it('pagination updates results and page number', () => {
186-
cy.get('#seed-peer-table').should('be.visible');
186+
cy.get('#seed-peer-table').scrollIntoView().should('be.visible');
187187

188188
// Check number of pagination.
189189
cy.get('#seed-peer-pagination > .MuiPagination-ul').children().should('have.length', 5);
@@ -470,6 +470,8 @@ describe('Seed peers', () => {
470470
.should('be.visible')
471471
.and('contain', 'Inactive');
472472

473+
cy.get(':nth-child(5) > :nth-child(9) > .MuiButtonBase-root').click();
474+
473475
cy.intercept({ method: 'DELETE', url: '/api/v1/seed-peers/9' }, (req) => {
474476
req.reply({
475477
statusCode: 200,
@@ -488,8 +490,6 @@ describe('Seed peers', () => {
488490
},
489491
);
490492

491-
cy.get(':nth-child(5) > :nth-child(9) > .MuiButtonBase-root').click();
492-
493493
cy.get('#deleteSeedPeer').click();
494494

495495
// Delete success message.

cypress/fixtures/clusters/cluster/cluster.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"scopes": {
66
"idc": "Hangzhou|Shanghai|Beijing",
77
"location": "China|Hang|Zhou",
8-
"cidrs": ["10.0.0.0/8", "192.168.0.0/16", "172.16.0.0/12"]
8+
"cidrs": ["10.0.0.0/8", "192.168.0.0/16", "172.16.0.0/12"],
9+
"hostnames": ["cluster-1", "cluster-2", "cluster-3"]
910
},
1011
"scheduler_cluster_id": 1,
1112
"seed_peer_cluster_id": 1,

cypress/fixtures/clusters/cluster/update-cluster.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"scopes": {
66
"idc": "Hangzhou|Shanghai",
77
"location": "China|Shang|Hai",
8-
"cidrs": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "192.168.20.2"]
8+
"cidrs": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "192.168.20.2"],
9+
"hostnames": ["cluster-1"]
910
},
1011
"scheduler_cluster_id": 1,
1112
"seed_peer_cluster_id": 1,

cypress/fixtures/clusters/create-cluster.json

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"scopes": {
3232
"idc": "",
3333
"location": "",
34-
"cidrs": []
34+
"cidrs": [],
35+
"hostnames": []
3536
},
3637
"scheduler_cluster_id": 2,
3738
"seed_peer_cluster_id": 2,
@@ -56,7 +57,8 @@
5657
"scopes": {
5758
"idc": "Korea",
5859
"location": "Seoul|Korea",
59-
"cidrs": ["192.168.0.0/16", "172.16.0.0/12"]
60+
"cidrs": ["192.168.0.0/16", "172.16.0.0/12"],
61+
"hostnames": []
6062
},
6163
"scheduler_cluster_id": 3,
6264
"seed_peer_cluster_id": 3,
@@ -81,7 +83,8 @@
8183
"scopes": {
8284
"idc": "hz|dl",
8385
"location": "China|Hang|Zhou",
84-
"cidrs": ["10.0.0.0/8", "192.168.0.0/16"]
86+
"cidrs": ["10.0.0.0/8", "192.168.0.0/16"],
87+
"hostnames": []
8588
},
8689
"scheduler_cluster_id": 4,
8790
"seed_peer_cluster_id": 4,
@@ -106,7 +109,8 @@
106109
"scopes": {
107110
"idc": "cq|cd",
108111
"location": "China|Chong|Qing",
109-
"cidrs": ["10.0.0.0/8", "192.168.0.0/16"]
112+
"cidrs": ["10.0.0.0/8", "192.168.0.0/16"],
113+
"hostnames": []
110114
},
111115
"scheduler_cluster_id": 5,
112116
"seed_peer_cluster_id": 5,
@@ -131,7 +135,8 @@
131135
"scopes": {
132136
"idc": "cq|cd",
133137
"location": "China|Chong|Du",
134-
"cidrs": ["10.0.0.0/8", "192.168.0.0/16"]
138+
"cidrs": ["10.0.0.0/8", "192.168.0.0/16"],
139+
"hostnames": []
135140
},
136141
"scheduler_cluster_id": 6,
137142
"seed_peer_cluster_id": 6,
@@ -156,7 +161,8 @@
156161
"scopes": {
157162
"idc": "cd",
158163
"location": "China|Cheng|Du",
159-
"cidrs": ["10.0.0.0/8", "172.16.0.0/19"]
164+
"cidrs": ["10.0.0.0/8", "172.16.0.0/19"],
165+
"hostnames": []
160166
},
161167
"scheduler_cluster_id": 7,
162168
"seed_peer_cluster_id": 7,
@@ -181,7 +187,8 @@
181187
"scopes": {
182188
"idc": "js",
183189
"location": "China|Jiang|Su",
184-
"cidrs": ["10.0.0.0/5", "172.16.0.0/19"]
190+
"cidrs": ["10.0.0.0/5", "172.16.0.0/19"],
191+
"hostnames": []
185192
},
186193
"scheduler_cluster_id": 8,
187194
"seed_peer_cluster_id": 8,
@@ -206,7 +213,8 @@
206213
"scopes": {
207214
"idc": "hz|hf",
208215
"location": "China|Hang|Zhou",
209-
"cidrs": ["10.0.0.0/8", "192.168.0.0/16"]
216+
"cidrs": ["10.0.0.0/8", "192.168.0.0/16"],
217+
"hostnames": []
210218
},
211219
"scheduler_cluster_id": 9,
212220
"seed_peer_cluster_id": 9,
@@ -231,7 +239,8 @@
231239
"scopes": {
232240
"idc": "London",
233241
"location": "London|England",
234-
"cidrs": ["192.168.255.255"]
242+
"cidrs": ["192.168.255.255"],
243+
"hostnames": []
235244
},
236245
"scheduler_cluster_id": 10,
237246
"seed_peer_cluster_id": 10,
@@ -256,7 +265,8 @@
256265
"scopes": {
257266
"idc": "Paris",
258267
"location": "Paris|France",
259-
"cidrs": ["192.168.0.0", "10.0.0.0"]
268+
"cidrs": ["192.168.0.0", "10.0.0.0"],
269+
"hostnames": []
260270
},
261271
"scheduler_cluster_id": 11,
262272
"seed_peer_cluster_id": 11,
@@ -281,7 +291,8 @@
281291
"scopes": {
282292
"idc": "hz|sh",
283293
"location": "China|Hang|Zhou",
284-
"cidrs": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
294+
"cidrs": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
295+
"hostnames": []
285296
},
286297
"scheduler_cluster_id": 12,
287298
"seed_peer_cluster_id": 12,

public/icons/cluster/cidrs.svg

Lines changed: 8 additions & 1 deletion
Loading

public/icons/cluster/hostname.svg

Lines changed: 8 additions & 1 deletion
Loading

0 commit comments

Comments
 (0)