From 1293976b1be3a279b97be47efff552ab33aa920d Mon Sep 17 00:00:00 2001 From: Vedant Date: Wed, 17 Aug 2022 09:25:32 +0530 Subject: [PATCH 1/2] Added changes for fixes Signed-off-by: Vedant --- .github/workflows/litmusctl-test-pipeline.yml | 59 +++++++++++++++-- .github/workflows/nightly-portal-pipeline.yml | 42 +++--------- .github/workflows/portal-pipeline.yml | 40 +++--------- .../Dashboard/createDashboard.spec.js | 2 +- .../Data_Source/addDataSource.spec.js | 0 .../Create_Workflow/customWorkflow.spec.js | 40 +++--------- .../preDefinedWorkflow.spec.js | 21 +----- .../Create_Workflow/recurringWorkflow.spec.js | 15 ++--- .../Create_Workflow/template.spec.js | 25 +++----- .../Create_Workflow/uploadWorkflow.spec.js | 22 ++----- .../Create_Workflow/workflowCRUDOps.spec.js | 18 ++---- .../Parallel_Tests/MyHub/crudMyHub.spec.js | 4 +- .../Workflow_Stats/workflowStats.spec.js | 5 -- Cypress/cypress/integration/smoke/smoke.js | 4 +- .../cypress/pages/workflow/workflowCustom.js | 27 ++------ .../pages/workflow/workflowGraphStats.js | 2 +- .../pages/workflow/workflowOperations.js | 4 +- .../pages/workflow/workflowPredefined.js | 13 +--- .../pages/workflow/workflowValidation.js | 11 +--- litmus/install-portal.sh | 2 + litmus/litmusctl_tests.sh | 64 +++++++++++++++++-- litmus/uninstall-portal.sh | 2 +- litmus/utils.sh | 5 +- 23 files changed, 193 insertions(+), 234 deletions(-) rename Cypress/cypress/{integration/Parallel_Tests => deprecated}/Dashboard/createDashboard.spec.js (98%) rename Cypress/cypress/{integration/Parallel_Tests => deprecated}/Data_Source/addDataSource.spec.js (100%) diff --git a/.github/workflows/litmusctl-test-pipeline.yml b/.github/workflows/litmusctl-test-pipeline.yml index c081b8f84..4cd358582 100644 --- a/.github/workflows/litmusctl-test-pipeline.yml +++ b/.github/workflows/litmusctl-test-pipeline.yml @@ -19,7 +19,8 @@ jobs: strategy: fail-fast: false matrix: - AcessType: [NodePort, Ingress, LoadBalancer] + # Cannot connect external chaos-delegate in namespaced scope mode. + AccessType: [Ingress, LoadBalancer] steps: - uses: actions/checkout@v2 @@ -44,9 +45,10 @@ jobs: ./litmus/install-portal.sh env: PORTAL_VERSION: ${{ env.TAG }} - ACCESS_TYPE: ${{ matrix.AcessType }} - NAMESPACE: ${{ env.CS_MODE_NAMESPACE }} + ACCESS_TYPE: ${{ matrix.AccessType }} + NAMESPACE: ${{ env.NS_MODE_NAMESPACE }} INSTALLATION_MODE: "NS-MODE" + DEPLOY_SELF_AGENT: "false" - name: Installing LitmusCTL on Agent Cluster run: | @@ -118,12 +120,34 @@ jobs: ACCESS_URL: ${{ env.URL }} PROJECT_NAME: "admin's project" + - name: Running Litmusctl CLI tests (litmusctl create project) + run: | + chmod 755 ./litmus/litmusctl_tests.sh + ./litmus/litmusctl_tests.sh test_create_project + env: + AGENT_NAMESPACE: "agent-4" + INSTALLATION_MODE: "NS-MODE" + ACCESS_URL: ${{ env.URL }} + AGENT_NAME: "agent-4" + PROJECT_NAME: "admin's project" + + - name: Running Litmusctl CLI tests (litmusctl disconnect chaos-delegate) + run: | + chmod 755 ./litmus/litmusctl_tests.sh + ./litmus/litmusctl_tests.sh test_create_project + env: + AGENT_NAMESPACE: "agent-5" + INSTALLATION_MODE: "NS-MODE" + ACCESS_URL: ${{ env.URL }} + AGENT_NAME: "agent-5" + PROJECT_NAME: "admin's project" + Cluster-Scope-Mode: runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: - AcessType: [NodePort, Ingress, LoadBalancer] + AccessType: [NodePort, Ingress, LoadBalancer] steps: - uses: actions/checkout@v2 @@ -142,15 +166,16 @@ jobs: kubectl get nodes kubectl get pods -n kube-system - - name: Deploying Litmus-Portal using **k8s-manifest** + - name: Deploying Litmus-Portal using k8s-manifest run: | chmod 755 ./litmus/install-portal.sh ./litmus/install-portal.sh env: PORTAL_VERSION: ${{ env.TAG }} - ACCESS_TYPE: ${{ matrix.AcessType }} + ACCESS_TYPE: ${{ matrix.AccessType }} NAMESPACE: ${{ env.CS_MODE_NAMESPACE }} INSTALLATION_MODE: "CS-MODE" + DEPLOY_SELF_AGENT: "false" - name: Installing LitmusCTL on Agent Cluster run: | @@ -220,4 +245,26 @@ jobs: env: INSTALLATION_MODE: "CS-MODE" ACCESS_URL: ${{ env.URL }} + PROJECT_NAME: "admin's project" + + - name: Running Litmusctl CLI tests (litmusctl create project) + run: | + chmod 755 ./litmus/litmusctl_tests.sh + ./litmus/litmusctl_tests.sh test_create_project + env: + AGENT_NAMESPACE: "agent-4" + INSTALLATION_MODE: "CS-MODE" + ACCESS_URL: ${{ env.URL }} + AGENT_NAME: "agent-4" + PROJECT_NAME: "admin's project" + + - name: Running Litmusctl CLI tests (litmusctl disconnect chaos-delegate) + run: | + chmod 755 ./litmus/litmusctl_tests.sh + ./litmus/litmusctl_tests.sh test_create_project + env: + AGENT_NAMESPACE: "agent-5" + INSTALLATION_MODE: "CS-MODE" + ACCESS_URL: ${{ env.URL }} + AGENT_NAME: "agent-5" PROJECT_NAME: "admin's project" \ No newline at end of file diff --git a/.github/workflows/nightly-portal-pipeline.yml b/.github/workflows/nightly-portal-pipeline.yml index 03c298dce..abe36ca02 100644 --- a/.github/workflows/nightly-portal-pipeline.yml +++ b/.github/workflows/nightly-portal-pipeline.yml @@ -23,6 +23,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 14 + - uses: AbsaOSS/k3d-action@v2 name: Create 1st Cluster with: @@ -48,21 +52,6 @@ jobs: NAMESPACE: ${{ env.CS_MODE_NAMESPACE }} INSTALLATION_MODE: "CS-MODE" - - name: Deploying Prometheus as a DataSource - run: | - mkdir monitoring && cd monitoring - git clone https://github.com/litmuschaos/litmus.git && cd litmus/monitoring - kubectl create ns monitoring - kubectl -n monitoring apply -f utils/prometheus/prometheus-scrape-configuration/ - kubectl -n monitoring apply -f utils/metrics-exporters/node-exporter/ - kubectl -n monitoring apply -f utils/metrics-exporters/kube-state-metrics/ - source ../../../litmus/utils.sh - wait_for_pods monitoring 720 - wait_for_loadbalancer prometheus-k8s monitoring - loadBalancerIP=$(kubectl get services prometheus-k8s -n monitoring -o jsonpath="{.status.loadBalancer.ingress[0].ip}") - DATA_SOURCE="http://$loadBalancerIP:9090" - echo "DATA_SOURCE_URL=$DATA_SOURCE" >> $GITHUB_ENV - # Fetching Access Point & Token for accessing kube api server - run: | kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}' @@ -114,7 +103,6 @@ jobs: CYPRESS_AGENT_NAMESPACE: ${{ env.CS_MODE_NAMESPACE}} CYPRESS_AGENT: "Self-Agent" CYPRESS_TARGET_APP_NS: "default" - CYPRESS_DATA_SOURCE_URL: ${{ env.DATA_SOURCE_URL }} # TODO: Additional Tests will be added from here @@ -142,6 +130,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 14 + - uses: AbsaOSS/k3d-action@v2 name: Create 1st Cluster with: @@ -167,21 +159,6 @@ jobs: NAMESPACE: ${{ env.NS_MODE_NAMESPACE }} INSTALLATION_MODE: "NS-MODE" - - name: Deploying Prometheus as a DataSource - run: | - mkdir monitoring && cd monitoring - git clone https://github.com/litmuschaos/litmus.git && cd litmus/monitoring - kubectl create ns monitoring - kubectl -n monitoring apply -f utils/prometheus/prometheus-scrape-configuration/ - kubectl -n monitoring apply -f utils/metrics-exporters/node-exporter/ - kubectl -n monitoring apply -f utils/metrics-exporters/kube-state-metrics/ - source ../../../litmus/utils.sh - wait_for_pods monitoring 720 - wait_for_loadbalancer prometheus-k8s monitoring - loadBalancerIP=$(kubectl get services prometheus-k8s -n monitoring -o jsonpath="{.status.loadBalancer.ingress[0].ip}") - DATA_SOURCE="http://$loadBalancerIP:9090" - echo "DATA_SOURCE_URL=$DATA_SOURCE" >> $GITHUB_ENV - # Fetching Access Point & Token for accessing kube api server - run: | kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}' @@ -190,7 +167,7 @@ jobs: KUBE_API_TOKEN=$(kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='default')].data.token}"|base64 --decode) echo "KUBE_API_SERVER=$KUBE_API_SERVER" >> $GITHUB_ENV echo "KUBE_API_TOKEN=$KUBE_API_TOKEN" >> $GITHUB_ENV - + # RBAC for allowing Cypress Runner to access Cluster resources - run: | kubectl apply -f Cypress/cypress-rbac.yml @@ -233,7 +210,6 @@ jobs: CYPRESS_AGENT_NAMESPACE: ${{ env.NS_MODE_NAMESPACE}} CYPRESS_AGENT: "Self-Agent" CYPRESS_TARGET_APP_NS: ${{ env.NS_MODE_NAMESPACE}} - CYPRESS_DATA_SOURCE_URL: ${{ env.DATA_SOURCE_URL }} # TODO: Additional Tests will be added from here diff --git a/.github/workflows/portal-pipeline.yml b/.github/workflows/portal-pipeline.yml index c579bec12..9cea9cbe1 100644 --- a/.github/workflows/portal-pipeline.yml +++ b/.github/workflows/portal-pipeline.yml @@ -28,6 +28,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 14 + - uses: AbsaOSS/k3d-action@v2 name: Create 1st Cluster with: @@ -53,21 +57,6 @@ jobs: NAMESPACE: ${{ env.CS_MODE_NAMESPACE }} INSTALLATION_MODE: "CS-MODE" - - name: Deploying Prometheus as a DataSource - run: | - mkdir monitoring && cd monitoring - git clone https://github.com/litmuschaos/litmus.git && cd litmus/monitoring - kubectl create ns monitoring - kubectl -n monitoring apply -f utils/prometheus/prometheus-scrape-configuration/ - kubectl -n monitoring apply -f utils/metrics-exporters/node-exporter/ - kubectl -n monitoring apply -f utils/metrics-exporters/kube-state-metrics/ - source ../../../litmus/utils.sh - wait_for_pods monitoring 720 - wait_for_loadbalancer prometheus-k8s monitoring - loadBalancerIP=$(kubectl get services prometheus-k8s -n monitoring -o jsonpath="{.status.loadBalancer.ingress[0].ip}") - DATA_SOURCE="http://$loadBalancerIP:9090" - echo "DATA_SOURCE_URL=$DATA_SOURCE" >> $GITHUB_ENV - # Fetching Access Point & Token for accessing kube api server - run: | kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}' @@ -119,7 +108,6 @@ jobs: CYPRESS_AGENT_NAMESPACE: ${{ env.CS_MODE_NAMESPACE}} CYPRESS_AGENT: "Self-Agent" CYPRESS_TARGET_APP_NS: "default" - CYPRESS_DATA_SOURCE_URL: ${{ env.DATA_SOURCE_URL }} # TODO: Additional Tests will be added from here @@ -147,6 +135,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 14 + - uses: AbsaOSS/k3d-action@v2 name: Create 1st Cluster with: @@ -172,21 +164,6 @@ jobs: NAMESPACE: ${{ env.NS_MODE_NAMESPACE }} INSTALLATION_MODE: "NS-MODE" - - name: Deploying Prometheus as a DataSource - run: | - mkdir monitoring && cd monitoring - git clone https://github.com/litmuschaos/litmus.git && cd litmus/monitoring - kubectl create ns monitoring - kubectl -n monitoring apply -f utils/prometheus/prometheus-scrape-configuration/ - kubectl -n monitoring apply -f utils/metrics-exporters/node-exporter/ - kubectl -n monitoring apply -f utils/metrics-exporters/kube-state-metrics/ - source ../../../litmus/utils.sh - wait_for_pods monitoring 720 - wait_for_loadbalancer prometheus-k8s monitoring - loadBalancerIP=$(kubectl get services prometheus-k8s -n monitoring -o jsonpath="{.status.loadBalancer.ingress[0].ip}") - DATA_SOURCE="http://$loadBalancerIP:9090" - echo "DATA_SOURCE_URL=$DATA_SOURCE" >> $GITHUB_ENV - # Fetching Access Point & Token for accessing kube api server - run: | kubectl config view -o jsonpath='{"Cluster name\tServer\n"}{range .clusters[*]}{.name}{"\t"}{.cluster.server}{"\n"}{end}' @@ -238,7 +215,6 @@ jobs: CYPRESS_AGENT_NAMESPACE: ${{ env.NS_MODE_NAMESPACE}} CYPRESS_AGENT: "Self-Agent" CYPRESS_TARGET_APP_NS: ${{ env.NS_MODE_NAMESPACE}} - CYPRESS_DATA_SOURCE_URL: ${{ env.DATA_SOURCE_URL }} # TODO: Additional Tests will be added from here diff --git a/Cypress/cypress/integration/Parallel_Tests/Dashboard/createDashboard.spec.js b/Cypress/cypress/deprecated/Dashboard/createDashboard.spec.js similarity index 98% rename from Cypress/cypress/integration/Parallel_Tests/Dashboard/createDashboard.spec.js rename to Cypress/cypress/deprecated/Dashboard/createDashboard.spec.js index d547a2999..1af176f80 100644 --- a/Cypress/cypress/integration/Parallel_Tests/Dashboard/createDashboard.spec.js +++ b/Cypress/cypress/deprecated/Dashboard/createDashboard.spec.js @@ -1,5 +1,5 @@ /// -import * as user from "../../../fixtures/Users.json"; +import * as user from "../../fixtures/Users.json"; export const agent = Cypress.env("AGENT"); export const dataSourceUrl = Cypress.env("DATA_SOURCE_URL"); diff --git a/Cypress/cypress/integration/Parallel_Tests/Data_Source/addDataSource.spec.js b/Cypress/cypress/deprecated/Data_Source/addDataSource.spec.js similarity index 100% rename from Cypress/cypress/integration/Parallel_Tests/Data_Source/addDataSource.spec.js rename to Cypress/cypress/deprecated/Data_Source/addDataSource.spec.js diff --git a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/customWorkflow.spec.js b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/customWorkflow.spec.js index 93a036709..424676e56 100644 --- a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/customWorkflow.spec.js +++ b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/customWorkflow.spec.js @@ -10,11 +10,10 @@ describe("Testing the validation of the final verdict with an existing target ap before("Loggin in and checking if agent exists", () => { cy.requestLogin(user.AdminName, user.AdminPassword); cy.waitForCluster(agent); - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); }); let workflowName = ""; - let workflowSubject = ""; it("Creating a target application", () => { cy.createTargetApplication(targetAppNamespace, "target-app-1", "nginx"); @@ -84,11 +83,6 @@ describe("Testing the validation of the final verdict with an existing target ap // cy.validateExperiment(experimentArray); cy.get("table").find("tr").eq(1).find("td").eq(0).click(); const tunningParameters = { - general: { - hubName: "Litmus ChaosHub", - experimentName: "pod-delete", - context: `pod-delete_${workflowNamespace}`, - }, targetApp: { annotationCheckToggle: false, appns: "default", @@ -118,24 +112,12 @@ describe("Testing the validation of the final verdict with an existing target ap workflows.customWorkflowDescription, 0 ); - cy.get("[data-cy=WorkflowSubject]").should( - "have.text", - `${workflows.customWorkflow}_${workflowNamespace}` - ); - cy.get("[data-cy=WorkflowSubject] textarea") - .eq(0) - .clear() - .type("custom-workflow-subject"); cy.get("[data-cy=ControlButtons] Button").eq(0).click(); // Clicking on finish Button cy.get("[data-cy=FinishModal]").should("be.visible"); cy.get("[data-cy=WorkflowName]").then(($name) => { workflowName = $name.text(); return; }); - cy.get("[data-cy=WorkflowSubject]").then(($subject) => { - workflowSubject = $subject.text(); - return; - }); cy.get("[data-cy=GoToWorkflowButton]").click(); }); @@ -147,7 +129,7 @@ describe("Testing the validation of the final verdict with an existing target ap it("Checking Schedules Table for scheduled Workflow", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=browseSchedule]").click(); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=workflowSchedulesTable] input") @@ -184,7 +166,7 @@ describe("Testing the validation of the final verdict with an existing target ap it("Validating graph nodes", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.validateWorkflowStatus(workflowName, workflowNamespace, [ "Running", @@ -219,16 +201,14 @@ describe("Testing the validation of the final verdict with an existing target ap it("Testing the workflow statistics", () => { cy.GraphqlWait("listWorkflows", "recentRuns"); cy.visit("/analytics"); - cy.get("[data-cy=litmusDashboard]").click(); cy.wait("@recentRuns").its("response.statusCode").should("eq", 200); cy.get(`[data-cy=${workflowName}]`).find("[data-cy=statsButton]").click(); cy.validateWorkflowInfo( workflowName, workflowNamespace, - workflowSubject, agent, - "Non cron workflow", - "Non cron workflow" + "Non Cron Chaos Scenario", + "Non Cron Chaos Scenario" ); cy.validateWorkflowStatsGraph(1, 0, 100, 100, 0); const experimentArray = [ @@ -244,14 +224,14 @@ describe("Testing the validation of the final verdict with an existing target ap // This will runs the above workflow without target application it("Rerun a non-recurring workflow", () => { - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=browseSchedule]").click(); cy.wait(2000); cy.get("table") .find("tr") .eq(1) .then(($div) => { - cy.wrap($div).find("td").eq(5).should("have.text", "Non cron workflow"); + cy.wrap($div).find("td").eq(5).should("have.text", "Non Cron Chaos Scenario"); }); cy.rerunWorkflow(); }); @@ -269,16 +249,14 @@ describe("Testing the validation of the final verdict with an existing target ap it("Testing the workflow statistics", () => { cy.GraphqlWait("listWorkflows", "recentRuns"); cy.visit("/analytics"); - cy.get("[data-cy=litmusDashboard]").click(); cy.wait("@recentRuns").its("response.statusCode").should("eq", 200); cy.get(`[data-cy=${workflowName}]`).find("[data-cy=statsButton]").click(); cy.validateWorkflowInfo( workflowName, workflowNamespace, - workflowSubject, agent, - "Non cron workflow", - "Non cron workflow" + "Non Cron Chaos Scenario", + "Non Cron Chaos Scenario" ); cy.validateWorkflowStatsGraph(1, 1, 50, 50, 50); cy.validateRecurringStatsWithLessResiliency(); diff --git a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/preDefinedWorkflow.spec.js b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/preDefinedWorkflow.spec.js index 3d5546b9d..303c1590e 100644 --- a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/preDefinedWorkflow.spec.js +++ b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/preDefinedWorkflow.spec.js @@ -10,7 +10,7 @@ describe("Testing the workflow creation wizard using PreDefined Experiments", () before("Clearing the Cookies and deleting the Cookies", () => { cy.requestLogin(user.AdminName, user.AdminPassword); cy.waitForCluster(agent); - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); }); let workflowName = ""; @@ -27,18 +27,6 @@ describe("Testing the workflow creation wizard using PreDefined Experiments", () "have.value", workflowNamespace ); - // Providing a name of 55 characters which should fail - // Maximum allowed length is 54 characters - cy.configureWorkflowSettings( - workflows.extraLargeName, - workflows.nonRecurringworkflowDescription, - 0 - ); - - cy.get("[data-cy=ControlButtons] Button").eq(1).click(); - - // Check if Alert exists - cy.get("[role=alert]").should("be.visible"); // Provide the correct details cy.configureWorkflowSettings( @@ -60,9 +48,6 @@ describe("Testing the workflow creation wizard using PreDefined Experiments", () // cy.validateExperiment(experimentArray); cy.get("table").find("tr").eq(1).find("td").eq(0).click(); const workflowParameters = { - general: { - context: `podtato-main-pod-delete-chaos_${workflowNamespace}`, - }, targetApp: { annotationCheckToggle: false, appns: targetAppNamespace, @@ -114,7 +99,7 @@ describe("Testing the workflow creation wizard using PreDefined Experiments", () it("Checking Schedules Table for scheduled Workflow", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=browseSchedule]").click(); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=workflowSchedulesTable] input") @@ -151,7 +136,7 @@ describe("Testing the workflow creation wizard using PreDefined Experiments", () it("Validating graph nodes", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.validateWorkflowStatus(workflowName, workflowNamespace, [ "Running", diff --git a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/recurringWorkflow.spec.js b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/recurringWorkflow.spec.js index 018a575be..524e68c88 100644 --- a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/recurringWorkflow.spec.js +++ b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/recurringWorkflow.spec.js @@ -10,11 +10,10 @@ describe("Testing the workflow schedule on a recurring basis with a target appli before("Loggin in and checking if agent exists", () => { cy.requestLogin(user.AdminName, user.AdminPassword); cy.waitForCluster(agent); - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); }); let workflowName = ""; - let workflowSubject = ""; let scheduleDate = ""; let scheduleTime = ""; @@ -54,16 +53,12 @@ describe("Testing the workflow schedule on a recurring basis with a target appli workflowName = $name.text(); return; }); - cy.get("[data-cy=WorkflowSubject]").then(($subject) => { - workflowSubject = $subject.text(); - return; - }); cy.get("[data-cy=GoToWorkflowButton]").click(); }); it("Checking Schedules Table for scheduled Workflow", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=browseSchedule]").click(); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.wait(1000); @@ -137,7 +132,7 @@ describe("Testing the workflow schedule on a recurring basis with a target appli it("Validating graph nodes", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=WorkflowRunsTable] input") .eq(0) @@ -168,13 +163,11 @@ describe("Testing the workflow schedule on a recurring basis with a target appli it("Testing the workflow statistics", () => { cy.GraphqlWait("listWorkflows", "recentRuns"); cy.visit("/analytics"); - cy.get("[data-cy=litmusDashboard]").click(); cy.wait("@recentRuns").its("response.statusCode").should("eq", 200); cy.get(`[data-cy=${workflowName}]`).find("[data-cy=statsButton]").click(); cy.validateWorkflowInfo( workflowName, workflowNamespace, - workflowSubject, agent, "Cron workflow", "Cron workflow" @@ -193,7 +186,7 @@ describe("Testing the workflow schedule on a recurring basis with a target appli }); it("Disable schedule", () => { - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.GraphqlWait("listWorkflows", "listSchedules"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=browseSchedule]").click(); diff --git a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/template.spec.js b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/template.spec.js index dda5a4494..0aadc645e 100644 --- a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/template.spec.js +++ b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/template.spec.js @@ -10,11 +10,10 @@ describe("Testing the workflow creation wizard using Templates", () => { before("Clearing the Cookies and deleting the Cookies", () => { cy.requestLogin(user.AdminName, user.AdminPassword); cy.waitForCluster(agent); - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); }); let workflowName = ""; - let workflowSubject = ""; it("Running uploaded Workflow", () => { cy.chooseAgent(agent); @@ -37,7 +36,7 @@ describe("Testing the workflow creation wizard using Templates", () => { }); it("Download schedule manifest", () => { - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.GraphqlWait("listWorkflows", "listSchedules"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=browseSchedule]").click(); @@ -46,7 +45,7 @@ describe("Testing the workflow creation wizard using Templates", () => { it("Checking Workflow Browsing Table for scheduled workflow", () => { cy.GraphqlWait("listWorkflowRuns", "listWorkflows"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=runs]").click(); cy.wait("@listWorkflows").its("response.statusCode").should("eq", 200); cy.get("[data-cy=WorkflowRunsTable] input") @@ -99,7 +98,7 @@ describe("Testing the workflow creation wizard using Templates", () => { it("Terminating the workflow", () => { cy.validateWorkflowStatus(workflowName, workflowNamespace, ["Running"]); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=runs]").click(); cy.GraphqlWait("listWorkflows", "listSchedules"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); @@ -114,7 +113,7 @@ describe("Testing the workflow creation wizard using Templates", () => { }); it("Scheduling a new workflow from the saved template", () => { - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); cy.chooseAgent(agent); cy.get("[data-cy=ControlButtons] Button").eq(0).click(); cy.chooseWorkflow(1, 0); @@ -145,10 +144,6 @@ describe("Testing the workflow creation wizard using Templates", () => { workflowName = $name.text(); return; }); - cy.get("[data-cy=WorkflowSubject]").then(($subject) => { - workflowSubject = $subject.text(); - return; - }); cy.get("[data-cy=GoToWorkflowButton]").click(); }); @@ -160,7 +155,7 @@ describe("Testing the workflow creation wizard using Templates", () => { it("Checking Schedules Table for scheduled Workflow", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=browseSchedule]").click(); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=workflowSchedulesTable] input") @@ -197,7 +192,7 @@ describe("Testing the workflow creation wizard using Templates", () => { it("Validating graph nodes", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.validateWorkflowStatus(workflowName, workflowNamespace, [ "Running", @@ -233,16 +228,14 @@ describe("Testing the workflow creation wizard using Templates", () => { it("Testing the workflow statistics", () => { cy.GraphqlWait("listWorkflows", "recentRuns"); cy.visit("/analytics"); - cy.get("[data-cy=litmusDashboard]").click(); cy.wait("@recentRuns").its("response.statusCode").should("eq", 200); cy.get(`[data-cy=${workflowName}]`).find("[data-cy=statsButton]").click(); cy.validateWorkflowInfo( workflowName, workflowNamespace, - workflowSubject, agent, - "Non cron workflow", - "Non cron workflow" + "Non Cron Chaos Scenario", + "Non Cron Chaos Scenario" ); cy.validateWorkflowStatsGraph(1, 0, 100, 100, 0); const experimentArray = [ diff --git a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/uploadWorkflow.spec.js b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/uploadWorkflow.spec.js index a9d65104e..b0b87dce7 100644 --- a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/uploadWorkflow.spec.js +++ b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/uploadWorkflow.spec.js @@ -1,5 +1,4 @@ /// -import * as workflows from "../../../fixtures/Workflows.json"; import * as user from "../../../fixtures/Users.json"; export const workflowNamespace = Cypress.env("AGENT_NAMESPACE"); @@ -10,11 +9,10 @@ describe("Testing the upload Workflow with correct workflow manifest and target before("Clearing the Cookies and deleting the Cookies", () => { cy.requestLogin(user.AdminName, user.AdminPassword); cy.waitForCluster(agent); - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); }); let workflowName = ""; - let workflowSubject = ""; it("Creating a target application", () => { cy.createTargetApplication(targetAppNamespace, "target-app-1", "nginx"); @@ -41,10 +39,6 @@ describe("Testing the upload Workflow with correct workflow manifest and target workflowName = $name.text(); return; }); - cy.get("[data-cy=WorkflowSubject]").then(($subject) => { - workflowSubject = $subject.text(); - return; - }); cy.get("[data-cy=GoToWorkflowButton]").click(); }); @@ -56,7 +50,7 @@ describe("Testing the upload Workflow with correct workflow manifest and target it("Checking Schedules Table for scheduled Workflow", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=browseSchedule]").click(); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=workflowSchedulesTable] input") @@ -93,7 +87,7 @@ describe("Testing the upload Workflow with correct workflow manifest and target it("Validating graph nodes", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.validateWorkflowStatus(workflowName, workflowNamespace, [ "Running", @@ -129,16 +123,14 @@ describe("Testing the upload Workflow with correct workflow manifest and target it("Testing the workflow statistics", () => { cy.GraphqlWait("listWorkflows", "recentRuns"); cy.visit("/analytics"); - cy.get("[data-cy=litmusDashboard]").click(); cy.wait("@recentRuns").its("response.statusCode").should("eq", 200); cy.get(`[data-cy=${workflowName}]`).find("[data-cy=statsButton]").click(); cy.validateWorkflowInfo( workflowName, workflowNamespace, - workflowSubject, agent, - "Non cron workflow", - "Non cron workflow" + "Non Cron Chaos Scenario", + "Non Cron Chaos Scenario" ); cy.validateWorkflowStatsGraph(1, 0, 100, 100, 0); const experimentArray = [ @@ -157,7 +149,7 @@ describe("Testing the upload Workflow with incorrect workflow manifest", () => { before("Clearing the Cookies and deleting the Cookies", () => { cy.requestLogin(user.AdminName, user.AdminPassword); cy.waitForCluster(agent); - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); }); it("Running Workflows by uploading it", () => { @@ -168,7 +160,7 @@ describe("Testing the upload Workflow with incorrect workflow manifest", () => { cy.get("[data-cy=ControlButtons] Button").eq(1).click(); cy.get("[data-cy=AlertBox]").should( "have.text", - "Please select a workflow type" + "Please select a Chaos Scenario type" ); }); }); diff --git a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/workflowCRUDOps.spec.js b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/workflowCRUDOps.spec.js index fa3c9a9b5..9aad844c9 100644 --- a/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/workflowCRUDOps.spec.js +++ b/Cypress/cypress/integration/Parallel_Tests/Create_Workflow/workflowCRUDOps.spec.js @@ -9,11 +9,10 @@ describe("Testing the workflow schedule on a recurring basis with a target appli before("Loggin in and checking if agent exists", () => { cy.requestLogin(user.AdminName, user.AdminPassword); cy.waitForCluster(agent); - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); }); let workflowName = ""; - let workflowSubject = ""; let scheduleDate = ""; let scheduleTime = ""; @@ -53,15 +52,12 @@ describe("Testing the workflow schedule on a recurring basis with a target appli workflowName = $name.text(); return; }); - cy.get("[data-cy=WorkflowSubject]").then(($subject) => { - workflowSubject = $subject.text(); - return; - }); cy.get("[data-cy=GoToWorkflowButton]").click(); }); it("Disable schedule and validate if it's running or not", () => { - cy.visit("/workflows"); + indexedDB.deleteDatabase("localforage"); + cy.visit("/scenarios"); cy.GraphqlWait("listWorkflows", "listSchedules"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=browseSchedule]").click(); @@ -99,7 +95,7 @@ describe("Testing the workflow schedule on a recurring basis with a target appli it("Checking Schedules Table for scheduled Workflow", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[data-cy=browseSchedule]").click(); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.wait(1000); @@ -173,7 +169,7 @@ describe("Testing the workflow schedule on a recurring basis with a target appli it("Validating graph nodes", () => { cy.GraphqlWait("listWorkflows", "listSchedules"); - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=WorkflowRunsTable] input") .eq(0) @@ -204,13 +200,11 @@ describe("Testing the workflow schedule on a recurring basis with a target appli it("Testing the workflow statistics", () => { cy.GraphqlWait("listWorkflows", "recentRuns"); cy.visit("/analytics"); - cy.get("[data-cy=litmusDashboard]").click(); cy.wait("@recentRuns").its("response.statusCode").should("eq", 200); cy.get(`[data-cy=${workflowName}]`).find("[data-cy=statsButton]").click(); cy.validateWorkflowInfo( workflowName, workflowNamespace, - "", agent, "Cron workflow", "Cron workflow" @@ -229,7 +223,7 @@ describe("Testing the workflow schedule on a recurring basis with a target appli }); it("Delete scheduled workflow", () => { - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.GraphqlWait("listWorkflows", "listSchedules"); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); cy.get("[data-cy=browseSchedule]").click(); diff --git a/Cypress/cypress/integration/Parallel_Tests/MyHub/crudMyHub.spec.js b/Cypress/cypress/integration/Parallel_Tests/MyHub/crudMyHub.spec.js index 8f936af1d..381b9dad1 100644 --- a/Cypress/cypress/integration/Parallel_Tests/MyHub/crudMyHub.spec.js +++ b/Cypress/cypress/integration/Parallel_Tests/MyHub/crudMyHub.spec.js @@ -16,6 +16,7 @@ describe("Testing CRUD operation with MyHub", () => { it("Adding a new MyHub with incorrect details", () => { cy.get("[data-cy=myHubConnectButton]").click(); cy.wait(1000); + cy.get("[data-cy=connectFromGithubButton]").click(); cy.get("[data-cy=hubName] input").clear().type("my-test-hub"); cy.get("[data-cy=githubURLInput]") .find("input") @@ -35,6 +36,7 @@ describe("Testing CRUD operation with MyHub", () => { cy.GraphqlWait("addChaosHub", "addNewMyHub"); cy.get("[data-cy=myHubConnectButton]").click(); cy.wait(1000); + cy.get("[data-cy=connectFromGithubButton]").click(); cy.get("[data-cy=hubName] input").clear().type("my-test-hub"); cy.get("[data-cy=githubURLInput]") .find("input") @@ -92,7 +94,7 @@ describe("Testing CRUD operation with MyHub", () => { cy.get("[data-cy=myHubCardOption]").eq(1).click(); cy.get("[data-cy=myHubOptions]").should("be.visible"); cy.get("[data-cy=myHubDelete]") - .contains("p", "Disconnect Hub") + .contains("p", "Disconnect ChaosHub") .then(($div) => { cy.wrap($div).click({ force: true }); }); diff --git a/Cypress/cypress/integration/Parallel_Tests/Workflow_Stats/workflowStats.spec.js b/Cypress/cypress/integration/Parallel_Tests/Workflow_Stats/workflowStats.spec.js index 2ea9713f9..cc4fad648 100644 --- a/Cypress/cypress/integration/Parallel_Tests/Workflow_Stats/workflowStats.spec.js +++ b/Cypress/cypress/integration/Parallel_Tests/Workflow_Stats/workflowStats.spec.js @@ -9,9 +9,4 @@ describe("Testing the accessibility of workflow statistics Tab.", () => { cy.waitForCluster(agent); cy.visit("/analytics"); }); - - it("Testing workflow stats tab", () => { - cy.get("[data-cy=litmusDashboard]").should("be.visible"); - cy.get("[data-cy=litmusDashboard]").click(); - }); }); diff --git a/Cypress/cypress/integration/smoke/smoke.js b/Cypress/cypress/integration/smoke/smoke.js index 60f95be49..913863d3a 100644 --- a/Cypress/cypress/integration/smoke/smoke.js +++ b/Cypress/cypress/integration/smoke/smoke.js @@ -15,7 +15,7 @@ export const setup = (doWaitForCluster) => { }; const visitChooseWorkflowPage = () => { - cy.visit("/create-workflow"); + cy.visit("/create-scenario"); cy.chooseAgent(0); cy.get("[data-cy=ControlButtons] Button").click(); }; @@ -137,7 +137,7 @@ export const customWorkflowSmokeTest = () => { }; export const templateWorkflowSmokeTest = () => { - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.get("[role=tab]").eq(1).click(); cy.get("[data-cy=browseScheduleOptions]").click(); cy.get("[data-cy=saveTemplate]").click(); diff --git a/Cypress/cypress/pages/workflow/workflowCustom.js b/Cypress/cypress/pages/workflow/workflowCustom.js index 2d384bd9c..8581c245b 100644 --- a/Cypress/cypress/pages/workflow/workflowCustom.js +++ b/Cypress/cypress/pages/workflow/workflowCustom.js @@ -2,11 +2,6 @@ Cypress.Commands.add("tuneCustomWorkflow", (tunningParameters) => { // tunningParameters = { - // general : { - // hubName : "Litmus ChaosHub", - // experimentName : "pod-delete", - // context : "pod-delete_litmus" - // }, // targetApp : { // annotationCheckToggle : false, // appns : "default", @@ -22,19 +17,7 @@ Cypress.Commands.add("tuneCustomWorkflow", (tunningParameters) => { // } // } - // General - cy.get("[data-cy=ExperimentName] input") - .clear() - .type(tunningParameters.general.experimentName); - cy.get("[data-cy=Context] input") - .clear() - .type(tunningParameters.general.context); - cy.get("[data-cy=GeneralNext]").click(); - // Target Application - cy.get("[data-cy=AnnotationCheckToggle] button") - .eq(tunningParameters.targetApp.annotationCheckToggle ? 0 : 1) - .click(); cy.get("[data-cy=Appns] input") .clear() .type(tunningParameters.targetApp.appns) @@ -45,7 +28,7 @@ Cypress.Commands.add("tuneCustomWorkflow", (tunningParameters) => { .clear() .type(tunningParameters.targetApp.appLabel) .type("{esc}"); - cy.get("[data-cy=TargetControlButtons] button").eq(1).click(); + cy.get("[data-cy=TargetControlButtons] button").eq(0).click(); // Steady State cy.get("[data-cy=SteadyStateControlButtons] button").eq(1).click(); @@ -61,6 +44,7 @@ Cypress.Commands.add("tuneCustomWorkflow", (tunningParameters) => { .clear() .type(tunningParameters.tuneExperiment.force); cy.get("[data-cy=TuneExperimentControlButtons] button").eq(1).click(); + cy.get("[data-cy=TuneExperimentControlButtons] button").eq(3).click(); }); Cypress.Commands.add("validateRecurringStatsWithLessResiliency", () => { @@ -72,7 +56,7 @@ Cypress.Commands.add("validateRecurringStatsWithLessResiliency", () => { cy.get("[data-cy=statsBarGraph]").scrollIntoView(); cy.get("[data-cy=statsBarGraph]").should("be.visible"); cy.get("[data-cy=statsBarGraph]").within((el) => { - cy.wrap(el).find("g").find("rect").eq(4).click(); + cy.wrap(el).get('g[class$="visx-group"]').last().find("rect").click({ position: "left" ,force: true}); }); let experimentArray = [ { @@ -83,8 +67,9 @@ Cypress.Commands.add("validateRecurringStatsWithLessResiliency", () => { }, ]; cy.validateExperimentsTable(experimentArray); - cy.get("[data-cy=statsBarGraph]").click(650, 250); - cy.get("[data-cy=statsBarGraph]").click(650, 250); + cy.get("[data-cy=statsBarGraph]").within((el) => { + cy.wrap(el).get('g[class$="visx-group"]').last().find("rect").click({ position: "right" ,force: true}); + }); experimentArray = [ { experimentName: "pod-delete", diff --git a/Cypress/cypress/pages/workflow/workflowGraphStats.js b/Cypress/cypress/pages/workflow/workflowGraphStats.js index 541d507c4..c3d9a8642 100644 --- a/Cypress/cypress/pages/workflow/workflowGraphStats.js +++ b/Cypress/cypress/pages/workflow/workflowGraphStats.js @@ -8,7 +8,7 @@ Cypress.Commands.add( RScorePercent, PassedPercent, FailedPercent, - workflowType = "Non cron workflow" + workflowType = "Non Cron Chaos Scenario" ) => { cy.get("[data-cy=showStatsButton]").click(); cy.wait(1000); diff --git a/Cypress/cypress/pages/workflow/workflowOperations.js b/Cypress/cypress/pages/workflow/workflowOperations.js index 5afdae216..d300b8910 100644 --- a/Cypress/cypress/pages/workflow/workflowOperations.js +++ b/Cypress/cypress/pages/workflow/workflowOperations.js @@ -186,7 +186,7 @@ Cypress.Commands.add("deleteSchedule", () => { cy.get("[data-cy=deleteScheduleButtons] button").eq(1).click(); }); -/// ************************** Terminate workflow *********** +/// ************************** Terminate Chaos Scenario *********** Cypress.Commands.add("terminateWorkflow", () => { cy.get("[data-cy=browseWorkflowOptions]") @@ -194,7 +194,7 @@ Cypress.Commands.add("terminateWorkflow", () => { .click({ scrollBehavior: false }); cy.get("[data-cy=terminateWorkflow]") .eq(0) - .should("have.text", "Terminate Workflow") + .should("have.text", "Terminate Chaos Scenario") .click({ force: true }); }); diff --git a/Cypress/cypress/pages/workflow/workflowPredefined.js b/Cypress/cypress/pages/workflow/workflowPredefined.js index a67ea92d8..7ba776ab6 100644 --- a/Cypress/cypress/pages/workflow/workflowPredefined.js +++ b/Cypress/cypress/pages/workflow/workflowPredefined.js @@ -2,9 +2,6 @@ Cypress.Commands.add( "validatePredefinedWorkflowParameters", (workflowParameters) => { // const workflowParameters = { - // general : { - // context : "podtato-main-pod-delete-chaos_litmus" - // }, // targetApp : { // annotationCheckToggle : false, // appns : "litmus", @@ -19,13 +16,6 @@ Cypress.Commands.add( // } // }; - // General - cy.get("[data-cy=Context] input").should( - "have.value", - workflowParameters.general.context - ); - cy.get("[data-cy=GeneralNext]").click(); - // Target Application // cy.get("[data-cy=Appns] input").should("have.value", workflowParameters.targetApp.appns); cy.get("[data-cy=AppKind] input").should( @@ -36,7 +26,7 @@ Cypress.Commands.add( "have.value", workflowParameters.targetApp.appLabel ); - cy.get("[data-cy=TargetControlButtons] button").eq(1).click(); + cy.get("[data-cy=TargetControlButtons] button").eq(0).click(); // Steady State cy.get("[data-cy=SteadyStateControlButtons] button").eq(1).click(); @@ -55,5 +45,6 @@ Cypress.Commands.add( workflowParameters.tuneExperiment.force ); cy.get("[data-cy=TuneExperimentControlButtons] button").eq(1).click(); + cy.get("[data-cy=TuneExperimentControlButtons] button").eq(3).click(); } ); diff --git a/Cypress/cypress/pages/workflow/workflowValidation.js b/Cypress/cypress/pages/workflow/workflowValidation.js index fd0c8b5f6..06bc7f438 100644 --- a/Cypress/cypress/pages/workflow/workflowValidation.js +++ b/Cypress/cypress/pages/workflow/workflowValidation.js @@ -30,7 +30,7 @@ Cypress.Commands.add( TotalExperiments, Experiments ) => { - cy.visit("/workflows"); + cy.visit("/scenarios"); cy.GraphqlWait("listWorkflows", "listSchedules"); cy.get("[data-cy=runs]").click(); cy.wait("@listSchedules").its("response.statusCode").should("eq", 200); @@ -92,7 +92,7 @@ Cypress.Commands.add( .click({ scrollBehavior: false }); }); Experiments.map((experiment) => { - cy.get("[data-cy=expName]").should("have.text", experiment.name); + cy.get("[data-cy=expName]").should("include.text", experiment.name); cy.get("[data-cy=expWeight]").should( "have.text", experiment.weight === 1 || 0 @@ -136,7 +136,6 @@ Cypress.Commands.add( ( workflowName, workflowNamespace, - workflowSubject, agentName, regularity, nextRun @@ -145,17 +144,13 @@ Cypress.Commands.add( cy.wait("@recentRuns").its("response.statusCode").should("eq", 200); cy.get("[data-cy=statsWorkflowName]").should("have.text", workflowName); cy.get("[data-cy=infoWorkflowName]").should("have.text", workflowName); - cy.get("[data-cy=infoWorkflowSubject]").should( - "have.text", - workflowSubject - ); cy.get("[data-cy=infoWorkflowNamespace]").should( "have.text", workflowNamespace ); cy.get("[data-cy=infoAgentName]").should("have.text", agentName); - if (regularity === "Non cron workflow") { + if (regularity === "Non Cron Chaos Scenario") { cy.get("[data-cy=infoWorkflowRegularity]").should( "have.text", `Regularity :${regularity}` diff --git a/litmus/install-portal.sh b/litmus/install-portal.sh index 7d7ac5581..50ebfa659 100644 --- a/litmus/install-portal.sh +++ b/litmus/install-portal.sh @@ -17,6 +17,7 @@ function install_portal_cs_mode() { # manifest_image_update $version litmus/cluster-k8s-manifest.yml kubectl apply -f litmus-portal-setup.yml + # kubectl apply -f litmus/cluster-k8s-manifest.yml } function install_portal_ns_mode(){ @@ -27,6 +28,7 @@ function install_portal_ns_mode(){ kubectl apply -f https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/manifests/litmus-portal-crds.yml kubectl apply -f https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/manifests/namespace-k8s-manifest.yml -n ${namespace} + # kubectl apply -f litmus/namespaced-k8s-template.yml -n ${namespace} } diff --git a/litmus/litmusctl_tests.sh b/litmus/litmusctl_tests.sh index 2825f79c0..568b171d9 100644 --- a/litmus/litmusctl_tests.sh +++ b/litmus/litmusctl_tests.sh @@ -40,17 +40,24 @@ function configure_agent(){ # Installing CRD's, required for namespaced mode kubectl apply -f https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/manifests/litmus-portal-crds.yml - litmusctl connect agent --agent-name=${agentName} --project-id=${projectID} --installation-mode=namespace --namespace=${namespace} --node-selector=${nodeSelectors} --tolerations=${tolerations} --non-interactive + litmusctl connect chaos-delegate --name=${agentName} --project-id=${projectID} --installation-mode=namespace --namespace=${namespace} --node-selector=${nodeSelectors} --tolerations=${tolerations} --non-interactive else - litmusctl connect agent --agent-name=${agentName} --project-id=${projectID} --installation-mode=cluster --namespace=${namespace} --node-selector=${nodeSelectors} --tolerations=${tolerations} --non-interactive + litmusctl connect chaos-delegate --name=${agentName} --project-id=${projectID} --installation-mode=cluster --namespace=${namespace} --node-selector=${nodeSelectors} --tolerations=${tolerations} --non-interactive fi wait_for_agent_to_be_ready } +function disconnect_agent(){ + chaos_delegate_id=$1 + project_id=$2 + + litmusctl disconnect chaos-delegate ${chaos-delegate-id} --project-id=${project_id} +} + function wait_for_agent_to_be_ready(){ echo -e "\n---------------Pods running in ${namespace} Namespace---------------\n" @@ -122,17 +129,56 @@ function test_get_agents(){ projectID=$(litmusctl get projects | grep "${projectName}" | awk '{print $1}') - noOfProjects=$(litmusctl get agents --project-id=$projectID | wc -l) + noOfAgents=$(litmusctl get chaos-delegates --project-id=$projectID | wc -l) + + if [[ ${noOfAgents} -gt 1 ]];then + echo -e "\n[Info]: litmusctl get chaos-delegates working fine ✓\n" + else + echo -e "\n[Error]: litmusctl get chaos-delegates not working as expected\n" + exit 1 + fi + +} + +function test_create_project(){ + configure_account + + litmusctl create project --name="my new project" - if [[ ${noOfProjects} -gt 1 ]];then - echo -e "\n[Info]: litmusctl get agents working fine ✓\n" + noOfProjects=$(litmusctl get projects | wc -l) + + if [[ ${noOfProjects} -gt 2 ]];then + echo -e "\n[Info]: litmusctl create project working fine ✓\n" else - echo -e "\n[Error]: litmusctl get agents not working as expected\n" + echo -e "\n[Error]: litmusctl create project not working as expected\n" exit 1 fi } +function test_disconnect_agent() { + configure_account + + configure_agent "" "" + + projectID=$(litmusctl get projects | grep "${projectName}" | awk '{print $1}') + + chaos_delegate_id=$(litmusctl get chaos-delegates --project-id=$projectID | grep "${agentName}" | awk '{print $1}') + + disconnect_agent chaos_delegate_id projectID + + chaos_delegate_id=$(litmusctl get chaos-delegates --project-id=$projectID | grep "${agentName}" | awk '{print $1}') + + if [[ ${chaos_delegate_id} == "" ]];then + echo -e "\n[Info]: litmusctl disconnect chaos-delegate working fine ✓\n" + else + echo -e "\n[Error]: litmusctl disconnect chaos-delegate not working as expected\n" + exit 1 + fi + + agent_cleanup +} + case ${1} in test_with_nodeSelectors) test_install_with_nodeSelectors @@ -149,6 +195,12 @@ case ${1} in test_get_agents) test_get_agents ;; + test_create_project) + test_create_project + ;; + test_disconnect_agent) + test_disconnect_agent + ;; *) echo "Invalid Arguments" exit 1 diff --git a/litmus/uninstall-portal.sh b/litmus/uninstall-portal.sh index 570129b13..06049b58c 100644 --- a/litmus/uninstall-portal.sh +++ b/litmus/uninstall-portal.sh @@ -14,6 +14,6 @@ kubectl delete chaosresult --all -A # Shutting down the Litmus-Portal Setup curl https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/manifests/cluster-k8s-manifest.yml --output litmus-portal-cleanup.yml -manifest_image_update $version litmus-portal-cleanup.yml +# manifest_image_update $version litmus-portal-cleanup.yml kubectl delete -f litmus-portal-cleanup.yml diff --git a/litmus/utils.sh b/litmus/utils.sh index 5e5018d8e..8dad998a5 100644 --- a/litmus/utils.sh +++ b/litmus/utils.sh @@ -209,6 +209,8 @@ function setup_ingress(){ # Enabling Ingress in Portal kubectl set env deployment/litmusportal-server -n ${namespace} --containers="graphql-server" INGRESS="true" + kubectl set env deployment/litmusportal-server -n ${namespace} --containers="graphql-server" INGRESS_NAME="litmus-ingress" + # Installing ingress-nginx helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx helm repo update @@ -243,6 +245,7 @@ function get_access_point(){ if [[ "$accessType" == "LoadBalancer" ]];then kubectl patch svc litmusportal-frontend-service -p '{"spec": {"type": "LoadBalancer"}}' -n ${namespace} + kubectl patch svc litmusportal-server-service -p '{"spec": {"type": "LoadBalancer"}}' -n ${namespace} export loadBalancer=$(kubectl get services litmusportal-frontend-service -n ${namespace} -o jsonpath="{.status.loadBalancer.ingress[0].ip}") wait_for_pods ${namespace} 360 wait_for_loadbalancer litmusportal-frontend-service ${namespace} @@ -251,7 +254,7 @@ function get_access_point(){ wait_for_url $AccessURL echo "URL=$AccessURL" >> $GITHUB_ENV - elif [[ "$acessType" == "Ingress" ]];then + elif [[ "$accessType" == "Ingress" ]];then setup_ingress ${namespace} # Ingress IP for accessing Portal From f5a89a491220ec0934eae321edb8b722619bc503 Mon Sep 17 00:00:00 2001 From: Vedant Date: Wed, 17 Aug 2022 09:30:02 +0530 Subject: [PATCH 2/2] Added Fixes for API tests Signed-off-by: Vedant --- .github/workflows/portal-api-pipeline.yml | 15 +++++-------- .../fixtures/graphql/mutations/chaosHub.js | 9 +------- .../fixtures/graphql/queries/workflows.js | 6 +++++- .../Api_Tests/graphql/myhub.spec.js | 2 +- .../Api_Tests/graphql/workflow.spec.js | 21 +++++++++++-------- Cypress/cypress/support/commands.js | 13 ++++-------- litmus/utils.sh | 6 +++--- 7 files changed, 31 insertions(+), 41 deletions(-) diff --git a/.github/workflows/portal-api-pipeline.yml b/.github/workflows/portal-api-pipeline.yml index 52e8c3aa9..34dd556cc 100644 --- a/.github/workflows/portal-api-pipeline.yml +++ b/.github/workflows/portal-api-pipeline.yml @@ -24,6 +24,10 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 14 + - uses: AbsaOSS/k3d-action@v2 name: Create 1st Cluster with: @@ -44,19 +48,10 @@ jobs: ./litmus/install-portal.sh env: PORTAL_VERSION: ${{ env.TAG }} - ACCESS_TYPE: "Ingress" + ACCESS_TYPE: "LoadBalancer" NAMESPACE: ${{ env.CS_MODE_NAMESPACE }} INSTALLATION_MODE: "CS-MODE" DEPLOY_SELF_AGENT: "false" - - - name: Installing LitmusCTL on Agent Cluster - run: | - curl -O https://litmusctl-production-bucket.s3.amazonaws.com/litmusctl-linux-amd64-master.tar.gz - tar -zxvf litmusctl-linux-amd64-master.tar.gz - chmod +x litmusctl - sudo mv litmusctl /usr/local/bin/litmusctl - litmusctl version - - name: Running API Tests uses: cypress-io/github-action@v2 if: always() diff --git a/Cypress/cypress/fixtures/graphql/mutations/chaosHub.js b/Cypress/cypress/fixtures/graphql/mutations/chaosHub.js index 54e6c3085..20ce8e931 100644 --- a/Cypress/cypress/fixtures/graphql/mutations/chaosHub.js +++ b/Cypress/cypress/fixtures/graphql/mutations/chaosHub.js @@ -32,14 +32,7 @@ export const UPDATE_MY_HUB = ` export const SYNC_REPO = ` mutation syncChaosHub($id: ID!, $projectID: String!) { - syncChaosHub(id: $id, projectID: $projectID) { - id - repoURL - repoBranch - isAvailable - totalExp - hubName - } + syncChaosHub(id: $id, projectID: $projectID) } `; diff --git a/Cypress/cypress/fixtures/graphql/queries/workflows.js b/Cypress/cypress/fixtures/graphql/queries/workflows.js index 6083814d4..cde4a45e1 100644 --- a/Cypress/cypress/fixtures/graphql/queries/workflows.js +++ b/Cypress/cypress/fixtures/graphql/queries/workflows.js @@ -146,6 +146,10 @@ export const GET_WORKFLOW_RUNS_STATS = ` // getPredefinedWorkflowList export const GET_PREDEFINED_WORKFLOW_LIST = ` query listPredefinedWorkflows($hubName: String!, $projectID: String!) { - listPredefinedWorkflows(hubName: $hubName, projectID: $projectID) + listPredefinedWorkflows(hubName: $hubName, projectID: $projectID){ + workflowName + workflowCSV + workflowManifest + } } `; diff --git a/Cypress/cypress/integration/Api_Tests/graphql/myhub.spec.js b/Cypress/cypress/integration/Api_Tests/graphql/myhub.spec.js index 4bdcbf6c1..b71efab0b 100644 --- a/Cypress/cypress/integration/Api_Tests/graphql/myhub.spec.js +++ b/Cypress/cypress/integration/Api_Tests/graphql/myhub.spec.js @@ -340,7 +340,7 @@ describe("Testing myHub api", () => { }, }).then((res) => { expect(res.status).to.eq(200); - expect(res.body).to.have.nested.property("data.syncChaosHub[0].id"); + expect(res.body.data.syncChaosHub).to.eq("Successfully synced ChaosHub"); }); }); diff --git a/Cypress/cypress/integration/Api_Tests/graphql/workflow.spec.js b/Cypress/cypress/integration/Api_Tests/graphql/workflow.spec.js index 960383609..a910f5ab8 100644 --- a/Cypress/cypress/integration/Api_Tests/graphql/workflow.spec.js +++ b/Cypress/cypress/integration/Api_Tests/graphql/workflow.spec.js @@ -15,17 +15,18 @@ import { } from "../../../fixtures/graphql/queries"; import endpoints from "../../../fixtures/endpoints"; -let adminProjectId, adminAccessToken, cluster1Id, workflow1Id, template1Id; +let adminProjectId, adminAccessToken, cluster1Id, workflow1Id, template1Id, project1Id; -before("Clear database", () => { - cy.initialRBACSetup(true).then((data) => { - adminProjectId = data.adminProjectId; - adminAccessToken = data.adminAccessToken; - cluster1Id = data.cluster1Id; +describe("Testing chaos workflow api", () => { + before("Clear database", () => { + cy.initialRBACSetup(true).then((data) => { + adminProjectId = data.adminProjectId; + adminAccessToken = data.adminAccessToken; + cluster1Id = data.cluster1Id; + project1Id = data.project1Id; + }); }); -}); -describe("Testing chaos workflow api", () => { it("Creating chaos workflow with different workflow_name in manifest [ Should not be possible ]", () => { cy.request({ method: "POST", @@ -81,7 +82,7 @@ describe("Testing chaos workflow api", () => { weightage: 10, }, ], - projectID: adminProjectId, + projectID: project1Id, clusterID: cluster1Id, }, }, @@ -318,6 +319,7 @@ describe("Testing chaos workflow api", () => { }); }); + // workflowRunID should be removed from here, since this is an optional field. it("Deleting chaos workflow", () => { cy.request({ method: "POST", @@ -327,6 +329,7 @@ describe("Testing chaos workflow api", () => { variables: { projectID: adminProjectId, workflowID: workflow1Id, + workflowRunID: "" }, query: DELETE_WORKFLOW, }, diff --git a/Cypress/cypress/support/commands.js b/Cypress/cypress/support/commands.js index cceb3e7be..60e50562c 100644 --- a/Cypress/cypress/support/commands.js +++ b/Cypress/cypress/support/commands.js @@ -490,7 +490,7 @@ Cypress.Commands.add("initialRBACSetup", (createAgent) => { body: { operationName: "listClusters", variables: { - projectID: project1Id, + projectID: adminProjectId, }, query: GET_CLUSTER, }, @@ -500,14 +500,9 @@ Cypress.Commands.add("initialRBACSetup", (createAgent) => { }); }) .then((res) => { - cluster1Id = getNested( - res, - "body", - "data", - "listClusters", - "at(0)", - "clusterID" - ); + if (createAgent){ + cluster1Id = res.body.data.listClusters[0].clusterID + } return { adminProjectId, project1Id, diff --git a/litmus/utils.sh b/litmus/utils.sh index 8dad998a5..5eb893eb6 100644 --- a/litmus/utils.sh +++ b/litmus/utils.sh @@ -250,7 +250,7 @@ function get_access_point(){ wait_for_pods ${namespace} 360 wait_for_loadbalancer litmusportal-frontend-service ${namespace} export loadBalancerIP=$(kubectl get services litmusportal-frontend-service -n ${namespace} -o jsonpath="{.status.loadBalancer.ingress[0].ip}") - export AccessURL="http://$loadBalancerIP:9091" + export AccessURL="http://$loadBalancerIP:9091/" wait_for_url $AccessURL echo "URL=$AccessURL" >> $GITHUB_ENV @@ -259,14 +259,14 @@ function get_access_point(){ setup_ingress ${namespace} # Ingress IP for accessing Portal export AccessURL=$(kubectl get ing litmus-ingress -n ${namespace} -o=jsonpath='{.status.loadBalancer.ingress[0].ip}' | awk '{print $1}') - echo "URL=http://$AccessURL" >> $GITHUB_ENV + echo "URL=http://$AccessURL/" >> $GITHUB_ENV else # By default NodePort will be used. export NODE_NAME=$(kubectl -n ${namespace} get pod -l "component=litmusportal-frontend" -o=jsonpath='{.items[*].spec.nodeName}') export NODE_IP=$(kubectl -n ${namespace} get nodes $NODE_NAME -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}') export NODE_PORT=$(kubectl -n ${namespace} get -o jsonpath="{.spec.ports[0].nodePort}" services litmusportal-frontend-service) - export AccessURL="http://$NODE_IP:$NODE_PORT" + export AccessURL="http://$NODE_IP:$NODE_PORT/" echo "URL=$AccessURL" >> $GITHUB_ENV fi