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 compiler errors when viewing e2e tests in the IDE's #2130

Merged
merged 1 commit into from
Mar 25, 2022

Conversation

jsturtevant
Copy link
Contributor

What type of PR is this?
/kind cleanup

What this PR does / why we need it:

When viewing the e2e suite in vscode or golang it throughs compilier errors which prevent functionality like goto or find references. This moves the variables from _test to a non test file which allows it to build properly. This also allows for some additional entry points to be created (I've created one for gmsa which makes testing faster).

This also added the 1.17 build tags to the files missing it in this directory.

image

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 25, 2022
@k8s-ci-robot k8s-ci-robot added area/provider/azure Issues or PRs related to azure provider sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 25, 2022
@jsturtevant
Copy link
Contributor Author

I think the pull-cluster-api-provider-azure-apidiff is due to the fact that some of the files didn't have the e2e build flag

test/e2e/aks.go Show resolved Hide resolved
test/e2e/e2e_suite.go Outdated Show resolved Hide resolved
@Jont828
Copy link
Contributor

Jont828 commented Feb 25, 2022

@jsturtevant I'm excited for this to get fixed! Would this fix all the compiler errors in test/e2e/? For example, on my machine, azure_privatecluster.go fails to import "sigs.k8s.io/cluster-api/test/e2e" and I'm wondering if it'll require changes on CAPI too.

@jsturtevant
Copy link
Contributor Author

@jsturtevant I'm excited for this to get fixed! Would this fix all the compiler errors in test/e2e/? For example, on my machine, azure_privatecluster.go fails to import "sigs.k8s.io/cluster-api/test/e2e" and I'm wondering if it'll require changes on CAPI too.

azure_privatecluster gives errors as well for me. On my machine, I no longer have any errors when I use this commit


// validateStableReleaseString validates the string format that declares "get be the latest stable release for this <Major>.<Minor>"
// it should be called wherever we process a stable version string expression like "stable-1.22"
func validateStableReleaseString(stableVersion string) (bool, []string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why does this one need to move and not the other funcs above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it depends if the function is used outside one of the _test.go files. In this case this function is by aks.go:

if isStableVersion, _ := validateStableReleaseString(version); isStableVersion {

because the variable is defined in the _test.go the IDE compilers don't find it.

I do find it interesting that when running go test that the variables defined in a _test.go are found by the standard .go files (which is why this doesn't through error when we run it in out suite. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably move the other functions above for resolving k8s versions to helpers anyways since they could technically be reused by other files, even if we're not using them now, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved

limitations under the License.
*/

package e2e
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if something like "e2e_helpers" or "e2e_utils" would be a more appropriate name for this file

Copy link
Contributor

Choose a reason for hiding this comment

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

I would actually question why we need a new file at all. Between the existing test/e2e/e2e_suite_test.go and test/e2e/helpers.go do we not have the appropriate places for these additions?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh nevermind it's literally the thing that solves the stated problem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could move it to test/e2e/helpers.go I think. the comments

made me think it should be here for the variables but the validateStableReleaseString should probably go to helpers.go. wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just find it confusing because to me e2e_suite.go implies there is a test suite in the file but it's just variables and constants. What about naming it e2e_suite_vars.go or something like that?

Side note, does CAPI have the same issue? I've noticed they also have test suite flags and vars in the main e2e_suite_test.go file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about naming it e2e_suite_vars.go or something like that?

sounds good.

Side note, does CAPI have the same issue? I've noticed they also have test suite flags and vars in the main e2e_suite_test.go file

Just looked. It seems they have a slightly different set up. Where the files that reference variables that these variables always use _test.go and they have another file that live along side it. For example:

https://github.com/kubernetes-sigs/cluster-api/blob/main/test/e2e/cluster_upgrade.go
https://github.com/kubernetes-sigs/cluster-api/blob/main/test/e2e/cluster_upgrade_test.go

@jsturtevant jsturtevant force-pushed the fix-e2e-build-errors branch 2 times, most recently from 9f9c9be to 314c9f2 Compare March 4, 2022 16:53
@jsturtevant jsturtevant force-pushed the fix-e2e-build-errors branch from 314c9f2 to cddeed9 Compare March 23, 2022 18:03
@jsturtevant
Copy link
Contributor Author

/test ls

@k8s-ci-robot
Copy link
Contributor

@jsturtevant: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-azure-build
  • /test pull-cluster-api-provider-azure-e2e
  • /test pull-cluster-api-provider-azure-test
  • /test pull-cluster-api-provider-azure-verify

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-azure-apidiff
  • /test pull-cluster-api-provider-azure-apiversion-upgrade
  • /test pull-cluster-api-provider-azure-capi-e2e
  • /test pull-cluster-api-provider-azure-ci-entrypoint
  • /test pull-cluster-api-provider-azure-conformance
  • /test pull-cluster-api-provider-azure-conformance-with-ci-artifacts
  • /test pull-cluster-api-provider-azure-coverage
  • /test pull-cluster-api-provider-azure-e2e-exp
  • /test pull-cluster-api-provider-azure-e2e-optional
  • /test pull-cluster-api-provider-azure-e2e-workload-upgrade
  • /test pull-cluster-api-provider-azure-upstream-windows-dockershim
  • /test pull-cluster-api-provider-azure-windows-containerd-upstream-with-ci-artifacts
  • /test pull-cluster-api-provider-azure-windows-containerd-upstream-with-ci-artifacts-serial-slow

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-azure-apidiff
  • pull-cluster-api-provider-azure-build
  • pull-cluster-api-provider-azure-ci-entrypoint
  • pull-cluster-api-provider-azure-coverage
  • pull-cluster-api-provider-azure-e2e
  • pull-cluster-api-provider-azure-e2e-exp
  • pull-cluster-api-provider-azure-test
  • pull-cluster-api-provider-azure-verify

In response to this:

/test ls

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.

@jsturtevant
Copy link
Contributor Author

/test pull-cluster-api-provider-azure-conformance-with-ci-artifacts
/test pull-cluster-api-provider-azure-windows-containerd-upstream-with-ci-artifacts
/test pull-cluster-api-provider-azure-conformance

@jsturtevant jsturtevant force-pushed the fix-e2e-build-errors branch from cddeed9 to 4095e5b Compare March 23, 2022 18:34
@jsturtevant
Copy link
Contributor Author

/test pull-cluster-api-provider-azure-conformance-with-ci-artifacts
/test pull-cluster-api-provider-azure-windows-containerd-upstream-with-ci-artifacts
/test pull-cluster-api-provider-azure-conformance

@jsturtevant
Copy link
Contributor Author

/assign @CecileRobertMichon @Jont828

apidiff job failure is due to the fact that some of the files didn't have the e2e build flag

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 24, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 24, 2022
@jsturtevant
Copy link
Contributor Author

/retest

@jsturtevant
Copy link
Contributor Author

I don't believe the time out is due to the pr
/retest

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Mar 25, 2022

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

Test name Commit Details Required Rerun command
pull-cluster-api-provider-azure-apidiff 4095e5b link false /test pull-cluster-api-provider-azure-apidiff

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@k8s-ci-robot k8s-ci-robot merged commit d1c5203 into kubernetes-sigs:main Mar 25, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.3 milestone Mar 25, 2022
@jsturtevant jsturtevant mentioned this pull request May 31, 2022
3 tasks
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. area/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants