Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
teodossidossev committed Oct 22, 2024
1 parent 44efa8c commit 60398ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
31 changes: 15 additions & 16 deletions test-cypress/integration/cluster/edit-cluster-nodes-modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ describe('Cluster management', () => {

it('Should be able to add', () => {
const clusterLocations = ['http://pc-desktop:7200', 'http://pc-desktop:7201', 'http://pc-desktop:7202'];
const nodesToAdd = ['pc-desktop:7303'];
const nodesToAdd = ['http://pc-desktop:7203'];
const urisToAdd = ['http://pc-desktop:7203'];
ClusterStubs.stubClusterConfigByList(clusterLocations);
ClusterStubs.stubClusterGroupStatus();
ClusterStubs.stubClusterNodeStatus();
RemoteLocationStubs.stubRemoteLocationFilter();
RemoteLocationStubs.stubRemoteLocationCheckByAddress([{uri: 'pc-desktop:7203', rpc: 'pc-desktop:7303'}]);

// Given I have opened the cluster management page
ClusterPageSteps.visit();
Expand Down Expand Up @@ -73,7 +72,7 @@ describe('Cluster management', () => {

it('Should be able to delete', () => {
const clusterLocations = ['http://pc-desktop:7200', 'http://pc-desktop:7201', 'http://pc-desktop:7202'];
const nodesToDelete = ['pc-desktop:7301'];
const nodesToDelete = ['http://pc-desktop:7201'];
ClusterStubs.stubClusterConfigByList(clusterLocations);
ClusterStubs.stubClusterGroupStatus();
ClusterStubs.stubClusterNodeStatus();
Expand Down Expand Up @@ -206,20 +205,20 @@ describe('Cluster management', () => {


//And when I confirm changes
ClusterStubs.stubAddNodesByList(['pc-desktop:7203']);
ClusterStubs.stubDeleteNodesByList(['pc-desktop:7201', 'pc-desktop:7202']);
ClusterStubs.stubReplaceNodesByList(['pc-desktop:7203'], ['pc-desktop:7201']);
ClusterStubs.stubAddNodesByList(['http://pc-desktop:7203']);
ClusterStubs.stubDeleteNodesByList(['http://pc-desktop:7201', 'http://pc-desktop:7202']);
ClusterStubs.stubReplaceNodesByList(['http://pc-desktop:7203'], ['http://pc-desktop:7201']);
ClusterStubs.stubClusterGroupStatusAfterReplace();

ClusterNodesConfigurationSteps.clickOkButton();
cy.wait('@response-replace-nodes').then((interception) => {
expect(interception.request.body).to.deep.equal({
"addNodes": [
"pc-desktop:7303"
"http://pc-desktop:7203"
],
"removeNodes": [
"pc-desktop:7301",
"pc-desktop:7302"
"http://pc-desktop:7201",
"http://pc-desktop:7202"
]
});
});
Expand Down Expand Up @@ -338,20 +337,20 @@ describe('Cluster management', () => {
ClusterNodesConfigurationSteps.getNodeIndexByEndpoint('http://pc-desktop:7203').should('have.text', '3');

//And when I confirm changes
const nodesToAdd = ['pc-desktop:7233', 'pc-desktop:7203'];
const nodesToRemove = ['pc-desktop:7301', 'pc-desktop:7300'];
const nodesToAdd = ['http://pc-desktop:7233', 'http://pc-desktop:7203'];
const nodesToRemove = ['http://pc-desktop:7201', 'http://pc-desktop:7200'];
ClusterStubs.stubReplaceNodesByList(nodesToAdd, nodesToRemove);
ClusterStubs.stubClusterGroupStatusAfterReplaceAndDelete();
ClusterNodesConfigurationSteps.clickOkButton();
cy.wait('@response-replace-nodes').then((interception) => {
expect(interception.request.body).to.deep.equal({
"addNodes": [
"pc-desktop:7333",
"pc-desktop:7303"
"http://pc-desktop:7233",
"http://pc-desktop:7203"
],
"removeNodes": [
"pc-desktop:7301",
"pc-desktop:7300"
"http://pc-desktop:7201",
"http://pc-desktop:7200"
]
});
});
Expand Down Expand Up @@ -416,7 +415,7 @@ describe('Cluster management', () => {
"messageSizeKB": 64,
"verificationTimeout": 1500,
"transactionLogMaximumSizeGB": 50.0,
"nodes": ['pc-desktop:7300', 'pc-desktop:7303']
"nodes": ['http://pc-desktop:7200', 'http://pc-desktop:7203']
});
});
// And expect success message to be displayed.
Expand Down
8 changes: 4 additions & 4 deletions test-cypress/stubs/cluster/cluster-stubs.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class ClusterStubs extends Stubs {

cy.intercept({
method: 'PATCH',
url: '/rest/cluster/config/node'
url: '/rest/cluster/httpConfig'
}, (req) => {
req.reply({
statusCode: 200,
Expand All @@ -126,7 +126,7 @@ export class ClusterStubs extends Stubs {

cy.intercept({
method: 'PATCH',
url: '/rest/cluster/config/node'
url: '/rest/cluster/httpConfig'
}, (req) => {
req.reply({
statusCode: 200,
Expand All @@ -146,7 +146,7 @@ export class ClusterStubs extends Stubs {

cy.intercept({
method: 'PATCH',
url: '/rest/cluster/config/node'
url: '/rest/cluster/httpConfig'
}, (req) => {
req.reply({
statusCode: 200,
Expand Down Expand Up @@ -183,7 +183,7 @@ export class ClusterStubs extends Stubs {
"nodes": nodes
};

cy.intercept('/rest/cluster/config', {
cy.intercept('/rest/cluster/httpConfig', {
body: clusterConfig,
statusCode: 201
}).as('2-nodes-cluster-created');
Expand Down

0 comments on commit 60398ac

Please sign in to comment.