kubevirt / kubevirt-ansible

Set of Ansible roles & playbooks for KubeVirt deployment
Apache License 2.0
91 stars 72 forks source link

Fix curlReq redeclared issue #621

Closed duyanyan closed 5 years ago

duyanyan commented 5 years ago

What this PR does / why we need it: Use anonymous function to fix curlReq redeclared issue

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 # when running all the tests in the repo, separated functions for curlReq will cause below error:

tests/networkpolicy_test.go:103:75: curlReq redeclared in this block previous declaration at tests/network_migration_test.go:152:75

use anonymous function instead

Special notes for your reviewer:

Release note:

none
sHaggYcaT commented 5 years ago

Thank you Yan for quick fix

ffromani commented 5 years ago

not sure I fully understand the context, but the code looks reasonnable

sHaggYcaT commented 5 years ago

not sure I fully understand the context, but the code looks reasonnable

Same for me.

BTW, looks like CI broken. And cause is new. It can't deploy the webUI:

TASK [kubevirt_web_ui : Wait until Web UI is ready: 'v1.4.0-13']

ksimon1 commented 5 years ago

With this change you will have two anonymous almost identical functions. Can you make the function more generic and use it in both cases? e.g.:

func curlReq(vmi *v1.VirtualMachineInstance, command, resp string) {
  ktests.WaitUntilVMIReady(vmi, ktests.LoggedInCirrosExpecter)
  err := ktests.CheckForTextExpecter(vmi, []expect.Batcher{
    &expect.BSnd{S: command},
    &expect.BExp{R: resp},
  }, 60)
  Expect(err).ToNot(HaveOccurred())
}
kubevirt-bot commented 5 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

kubevirt-bot commented 5 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

kubevirt-bot commented 5 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close

kubevirt-bot commented 5 years ago

@kubevirt-bot: Closed this PR.

In response to [this](https://github.com/kubevirt/kubevirt-ansible/pull/621#issuecomment-542659505): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.