github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/cypress/integration/clusterOverview/nodesStatusChange.spec.ts (about)

     1  // Copyright 2020 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  import { TIME_UNTIL_NODE_DEAD } from "../../support/constants";
    12  
    13  describe("Nodes status change", () => {
    14    beforeEach(() => {
    15      cy.teardown();
    16      cy.startCluster();
    17      cy.visit("#/overview/list");
    18    });
    19  
    20    describe("from Live to Decommissioned", () => {
    21      it("changes to Decommissioned status", () => {
    22        const nodeIdToDecommission = 2;
    23        cy
    24          .log("Validate all 4 nodes are Live")
    25          .get(
    26            ".nodes-overview__live-nodes-table tbody tr td span span:contains(Live)",
    27            {logMessage: "Node List table > rows with Live status"},
    28          )
    29          .should("have.length", 4);
    30  
    31        cy
    32          .log("Cluster summary section displays 4 live nodes")
    33          .get(
    34            ".node-liveness.cluster-summary__metric.live-nodes",
    35            {logMessage: "Cluster Summary > get Live Nodes value"},
    36          )
    37          .should("contain", 4);
    38  
    39        cy.decommissionNode(nodeIdToDecommission);
    40        cy.stopNode(nodeIdToDecommission);
    41  
    42        cy
    43          .log("Validate that only 3 live nodes remain")
    44          .get(
    45            ".nodes-overview__live-nodes-table tbody tr td span span:contains(Live)",
    46            { logMessage: "Node List table > rows with Live status" },
    47          )
    48          .should("have.length", 3);
    49  
    50        cy
    51          .log("...and 1 node is Decommissioning table")
    52          .get(
    53            ".nodes-overview__live-nodes-table",
    54            {logMessage: "Node List table > rows with Decommissioning status"},
    55          )
    56          .find("tbody tr:contains(Decommissioning)")
    57          .should("have.length", 1);
    58  
    59        cy
    60          .log("...and Cluster summary shows that 1 node is suspected")
    61          .get(
    62            ".node-liveness.cluster-summary__metric.suspect-nodes",
    63            {logMessage: "Cluster Summary > get Suspected Nodes value"},
    64          )
    65          .should("contain", 1);
    66  
    67        cy.wait(TIME_UNTIL_NODE_DEAD);
    68  
    69        cy
    70          .log("Validate that Decommissioned node table exists and contains one record")
    71          .get(
    72            ".nodes-overview__decommissioned-nodes-table",
    73            { logMessage: "Decommissioned Nodes table exists" },
    74          )
    75          .should("exist")
    76          .contains("tbody tr .status-column.status-column--color-decommissioned > span", "Decommissioned")
    77          .should("exist");
    78      });
    79    });
    80  });