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

azure: validation: machinepool: sort slice before comparing #7407

Merged
merged 1 commit into from Aug 11, 2023

Conversation

r4f4
Copy link
Contributor

@r4f4 r4f4 commented Aug 8, 2023

We cannot rely on any ordering from iterating over a Golang map. If we do, we might fail unit tests because the values we compare with are different:

 --- FAIL: TestValidateMachinePool (0.00s)
    --- FAIL: TestValidateMachinePool/securityType_set_to_ConfidentialVM_but_securityEncryptionType_is_invalid (0.00s)
        machinepool_test.go:610:
            	Error Trace:	/go/src/github.com/openshift/installer/pkg/types/azure/validation/machinepool_test.go:610
            	Error:      	Expect "test-path.defaultMachinePlatform.osDisk.securityProfile.securityEncryptionType: Unsupported value: "invalidSecurityEncryptionType": supported values: "DiskWithVMGuestState", "VMGuestStateOnly"" to match "^test-path.defaultMachinePlatform.osDisk.securityProfile.securityEncryptionType: Unsupported value: "invalidSecurityEncryptionType": supported values: "VMGuestStateOnly", "DiskWithVMGuestState"$"
            	Test:       	TestValidateMachinePool/securityType_set_to_ConfidentialVM_but_securityEncryptionType_is_invalid
FAIL

Using a sorted list resolves the problem.

We cannot rely on any ordering from iterating over a Golang map. If we
do, we might fail unit tests because the values we compare with are
different:
```
 --- FAIL: TestValidateMachinePool (0.00s)
    --- FAIL: TestValidateMachinePool/securityType_set_to_ConfidentialVM_but_securityEncryptionType_is_invalid (0.00s)
        machinepool_test.go:610:
            	Error Trace:	/go/src/github.com/openshift/installer/pkg/types/azure/validation/machinepool_test.go:610
            	Error:      	Expect "test-path.defaultMachinePlatform.osDisk.securityProfile.securityEncryptionType: Unsupported value: "invalidSecurityEncryptionType": supported values: "DiskWithVMGuestState", "VMGuestStateOnly"" to match "^test-path.defaultMachinePlatform.osDisk.securityProfile.securityEncryptionType: Unsupported value: "invalidSecurityEncryptionType": supported values: "VMGuestStateOnly", "DiskWithVMGuestState"$"
            	Test:       	TestValidateMachinePool/securityType_set_to_ConfidentialVM_but_securityEncryptionType_is_invalid
FAIL
```
Using a sorted list resolves the problem.
@jhixson74
Copy link
Member

/test e2e-azure-ovn

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 9, 2023

@r4f4: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-azurestack 5b048b2 link false /test e2e-azurestack
ci/prow/e2e-azure-ovn-shared-vpc 5b048b2 link false /test e2e-azure-ovn-shared-vpc

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@barbacbd barbacbd left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 9, 2023
@rna-afk
Copy link
Contributor

rna-afk commented Aug 10, 2023

/approve

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2023
@jhixson74
Copy link
Member

/lgtm
/approve

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 0be5579 and 2 for PR HEAD 5b048b2 in total

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 10, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhixson74, rna-afk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 69e6e6f and 1 for PR HEAD 5b048b2 in total

@openshift-merge-robot openshift-merge-robot merged commit 16f19ea into openshift:master Aug 11, 2023
21 of 23 checks passed
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 11, 2023

/test remaining-required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants