Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix VM related test cases #1319

Merged
merged 3 commits into from
Jun 19, 2024
Merged

Fix VM related test cases #1319

merged 3 commits into from
Jun 19, 2024

Conversation

torchiaf
Copy link
Contributor

@torchiaf torchiaf commented Jun 11, 2024

Related issue #1196

The VM tests are failing because the node harvester-node-0 has a test-custom-name customName in Harvester configuration; This breaks the cypress tests in matching the correct UI elements.

image

  • I've updated the tests to support host's customName.
  • I added the customName in host config. This will require to update the config in Jenkins pipelines:
    • host should be always an array
    • if customName is empty, the name will be used during the tests
  "host": [
    {
      "name": "",
      "customName": "",
      "disks": [
        {
          "name": "",
          "devPath": ""
        }
      ],
      "witnessNode": false
    }
  ],

@torchiaf torchiaf requested a review from a110605 June 11, 2024 15:05
@torchiaf torchiaf force-pushed the cypress-1196 branch 3 times, most recently from 9cb354d to 6655f11 Compare June 12, 2024 14:12
@torchiaf torchiaf requested review from lanfon72 and TachunLin June 12, 2024 14:14
@torchiaf torchiaf force-pushed the cypress-1196 branch 2 times, most recently from a76f30e to 6e47deb Compare June 12, 2024 14:34
@torchiaf torchiaf marked this pull request as ready for review June 12, 2024 14:38
@@ -46,3 +46,15 @@ export function base64DecodeToBuffer(string: string) {
export function base64Decode(string: string) {
return !string ? string : base64DecodeToBuffer(string.replace(/[-_]/g, char => char === '-' ? '+' : '/')).toString();
}

export const nodes = {
filterWitnessNode: (hosts: {name: string, witnessNode: boolean}[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filterWitnessNode() and witnessNode config feild are not used in the code.
Are they prepare for future test cases use?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I would keep this code for future test cases.


const hostNames: string[] = hostList.map((node: Node) => node.customName || node.name);

const maintenanceNodeName = hostNames[0]
Copy link
Contributor

@a110605 a110605 Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even host is prefilled with a item in cypress.env.json.
How about add an early return error message if hostList is empty or undefined ?
Same in node-scheduling.spec.ts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I just added a hosts util to do that.

@torchiaf torchiaf requested a review from a110605 June 13, 2024 13:30
@torchiaf torchiaf force-pushed the cypress-1196 branch 2 times, most recently from c360ad4 to 512c1bd Compare June 14, 2024 08:51
Copy link
Contributor

@a110605 a110605 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code change LTGM.
Could you verify test cases pass on jenkins pipeline env again before merge PR?

@TachunLin
Copy link
Contributor

Tested on the main Jenkins for this test changes along with the harvester-baremetal-ansible pull request

According to the latest test result on the staging Jenkins of:

image

It will encounter the Cannot read properties of undefined (reading split) failure, just as what we encounter last week.

Checked the package.json, the adm-zip version seems not changed, it looks like it should be rebase to sync with the latest main.
https://github.com/torchiaf/harvester-tests/blob/cypress-1196/cypress/package.json

@torchiaf
Copy link
Contributor Author

Thanks @TachunLin . Yes, this needs a rebase.

torchiaf added 3 commits June 17, 2024 12:37
…use host.customName to check Volumes VMs; lint fix

Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
@torchiaf
Copy link
Contributor Author

I just rebased the PR with upstream main branch. The Cannot read properties of undefined (reading split) error should be fixed now.

@TachunLin
Copy link
Contributor

Thanks for the rebase with main.

  • Tested again on the staging Jenkins with a Full cypress test.
    http://172.19.98.192:8080/job/harvester-cypress-test/10/console

  • The Cannot read properties of undefined (reading split) have been diminished

  • Check the test report, we can find the "Stop VM Negative" and "VM scheduling on Sepecific node" both failed.
    image

  • It looks like the test script still trying to locate the harvester-node-0 node in these scenarios
    image

  • Check the online Harvester environment, the node name have been changed to test-custom-name which cause the failure
    image

In order to test this pull request fix, I added the following content to the harvester-baremetal-ansible repo.

@torchiaf ,
Could you help to check whether my changes to the harvester-baremetal-anisble Jenkins config can meet the requirement and correct. Or if I miss out anything. Thank you.

@torchiaf
Copy link
Contributor Author

torchiaf commented Jun 18, 2024

@TachunLin In this scenario, the result of ansible/roles/cypress_tests/templates/cypress.env.json.j2 template, should be:

"customName": "test-custom-name",

  "host": [
    {
      "name": "harvester-node-0",
      "customName": "test-custom-name",
      "disks": [
        {
          "name": "/dev/vda",
          "devPath": "/dev/vda"
        }
      ],
      "witnessNode": false
    },
    ...
  ],

I would change the template in something like this, or declare a variable for the host-0 -> custom name and use it wherever needed:

  "host": [
  {% for node_index in range(3) %}
    {
      "name": "harvester-node-{{ node_index }}",
      "customName": "{% if node_index == 0 %}test-custom-name{% else %}{% endif %}",
      "disks": [
        {
          "name": "/dev/vda",
          "devPath": "/dev/vda"
        }
      ],
      "witnessNode": false
    }{% if not loop.last %},{% endif %}
  {% endfor %}
  ],

@TachunLin
Copy link
Contributor

Thanks @torchiaf for your suggestion, I updated the harvester-baremetal-ansible commit pull request.
https://github.com/harvester/harvester-baremetal-ansible/pull/58

And trigger a new full cypress test on the staging Jenkins
http://172.19.98.192:8080/job/harvester-cypress-test/11/console

On the cypress test report:
https://minio.provo.rancherlabs.com:31524/cypress-test-report/cypress/results/20240618-100419-6226eb6/index.html

We can find the Stop VM Negative and VM scheduling on Specific node cases are both SUCCESS
image

Copy link
Contributor

@TachunLin TachunLin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Tested can PASS the Stop VM Negative and VM scheduling on Specific node on the stating Jenkins full cypress test.
https://minio.provo.rancherlabs.com:31524/cypress-test-report/cypress/results/20240618-100419-6226eb6/index.html

Thanks for fixing the issues.

@TachunLin TachunLin merged commit ceb811e into harvester:main Jun 19, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants