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

Attempt to fix remoteload_test flakes and add better errors #4778

Closed
wants to merge 6 commits into from

Conversation

mightyguava
Copy link
Contributor

@mightyguava mightyguava commented Aug 29, 2022

Another step in #4640.

This PR attempts to address the flakes, but also adds better error messaging to debug the flakes if they aren't addressed.

Behavior Change
It adds better error messaging when remote loading fails. Instead of the previous error:

accumulating resources: accumulation err='accumulating resources from '[email protected]:kubernetes-sigs/kustomiz//examples/multibases/dev': evalsymlink failure on '/private/var/folders/9k/72l1zfg94fl9p5c3jdrv0p_40000gn/T/kustomize-868128946/[email protected]:kubernetes-sigs/kustomiz/examples/multibases/dev' : lstat /private/var/folders/9k/72l1zfg94fl9p5c3jdrv0p_40000gn/T/kustomize-868128946/[email protected]:kubernetes-sigs: no such file or directory': git cmd = '/opt/homebrew/bin/git fetch --depth=1 origin HEAD': exit status 128

it will now show the output of the git command that failed as well, something like the below.

accumulating resources: accumulating remote resource: [email protected]:kubernetes-sigs/kustomiz//examples/multibases/dev?submodules=0: git cmd = '/opt/homebrew/bin/git fetch --depth=1 [email protected]:kubernetes-sigs/kustomiz.git HEAD' failed:
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
: exit status 128

Test changes
271f393 changed all assert uses with require to prevent panics. It also had the effect of short-circuiting table tests on error. The first failing test will skip all other tests. I changed some require back to assert so that they do not panic on error and allow all tests to run.

All tests that load from remotes now either have ref=v1.0.6 or submodules=0, both of which will prevent submodules from being fetched. My suspicion is that this will not completely fix the flakes, but it should make them significantly less frequent. A few repeated CI runs will confirm.

Results

I ran the test suite 100 times locally using the following command. They all passed, so I think the tests are no longer flaky.

for i in {1..100}; do echo "run $i"; go test ./api/krusty -run 'TestRemote*' -count 1; done

CI Results

As can be seen from this build, tests are still flaky. Interestingly though, multiple tests failed on OS X but didn't fail on Linux. I think we don't want to disable these tests on the Mac build... so back to the drawing board.

@k8s-ci-robot
Copy link
Contributor

@mightyguava: This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 29, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @mightyguava. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 29, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mightyguava
Once this PR has been reviewed and has the lgtm label, please assign knverey for approval by writing /assign @knverey in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 29, 2022
ref := "HEAD"
if repoSpec.Ref != "" {
ref = repoSpec.Ref
}
if err = r.run("fetch", "--depth=1", "origin", ref); err != nil {
if err = r.run("fetch", "--depth=1", repoSpec.CloneSpec(), ref); err != nil {
Copy link
Contributor Author

@mightyguava mightyguava Aug 29, 2022

Choose a reason for hiding this comment

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

Per git fetch docs,

The "remote" repository that is the source of a fetch or pull operation. This parameter can be either a URL (see the section [GIT URLS](https://git-scm.com/docs/git-fetch#URLS) below) or the name of a remote (see the section [REMOTES](https://git-scm.com/docs/git-fetch#REMOTES) below).

As long as kustomize doesn't try to use origin elsewhere in this cloned repo, and I don't believe it does, this change won't cause issues.

@natasha41575
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 29, 2022
t.SkipNow()
}
configureGitSSHCommand(t)
testRemoteResource(req, test)
testRemoteResource(t, test)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you so much for fixing the sub-test fails parent test bug! I don't think this caused the flakes, but can we change test to savedTest here? This was also a bug I introduced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see. These tests don't run in parallel so it makes no difference. I removed the assignment to savedTest in c6520a1

@mightyguava
Copy link
Contributor Author

Closing in favor of #4783

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

4 participants