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 flaky tests using custom port mapping when running specs in parallel #6763

Conversation

rm3l
Copy link
Member

@rm3l rm3l commented Apr 21, 2023

What type of PR is this:
/kind bug
/area testing

What does this PR do / why we need it:
Using a global counter currently does not work
because Ginkgo runs parallel specs by isolating them in
completely different processes [1].
This relies on the parallel process index returned by Ginkgo
to get a value that can be used as starting port.

[1] https://onsi.github.io/ginkgo/#mental-model-how-ginkgo-runs-parallel-specs

Which issue(s) this PR fixes:
Fixes #6758

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

ginkgo -v -nodes=3 \
  -focus 'port-forwarding for the component' --label-filter='podman' \
  --output-interceptor-mode=none \
  tests/integration/

Using a global counter currently does not work
because Ginkgo runs parallel specs by isolating them in
completely different processes [1].
This relies on the parallel process index returned by Ginkgo
to get a value that can be used as starting port.
Callers can then safely increment this value if needed in the
specs to get a different custom value.

[1] https://onsi.github.io/ginkgo/#mental-model-how-ginkgo-runs-parallel-specs
@netlify
Copy link

netlify bot commented Apr 21, 2023

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 3a01c9f
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/6446d0df047e5b00086d738e

@openshift-ci openshift-ci bot added kind/bug Categorizes issue or PR as related to a bug. area/testing Issues or PRs related to testing, Quality Assurance or Quality Engineering labels Apr 21, 2023
@openshift-ci openshift-ci bot requested review from anandrkskd and feloy April 21, 2023 10:15
@odo-robot
Copy link

odo-robot bot commented Apr 21, 2023

NoCluster Tests on commit 54cada4 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 21, 2023

OpenShift Unauthenticated Tests on commit 54cada4 finished successfully.
View logs: TXT HTML

@rm3l rm3l changed the title Fix flaky test using custom port mapping when running specs in parallel Fix flaky tests using custom port mapping when running specs in parallel Apr 21, 2023
@odo-robot
Copy link

odo-robot bot commented Apr 21, 2023

Unit Tests on commit 54cada4 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 21, 2023

Validate Tests on commit 54cada4 finished successfully.
View logs: TXT HTML

@rm3l rm3l requested review from valaparthvi and removed request for anandrkskd April 21, 2023 11:13
@odo-robot
Copy link

odo-robot bot commented Apr 21, 2023

Kubernetes Tests on commit 54cada4 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 21, 2023

Windows Tests (OCP) on commit 54cada4 finished with errors.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 21, 2023

OpenShift Tests on commit 54cada4 finished successfully.
View logs: TXT HTML

@feloy feloy closed this Apr 21, 2023
@feloy feloy reopened this Apr 21, 2023
@feloy feloy closed this Apr 24, 2023
@feloy feloy reopened this Apr 24, 2023
@valaparthvi
Copy link
Contributor

OpneShift Failure:

  [odo] I0424 08:21:40.475625    6633 delete.go:94] failed to delete resource "my-k8s-component" (apps.v1.deployments): timeout while waiting for "my-k8s-component" resource to be deleted
  [odo] Failed to delete the "Deployment" resource: my-k8s-component
  [odo]  ✗  Dev mode interrupted by user
  Running oc with args [oc get deployments] and odo env: []
  [oc] NAME               READY   UP-TO-DATE   AVAILABLE   AGE
  [oc] my-k8s-component   0/1     0            0           4m49s
  [FAILED] in [It] - /go/odo_1/tests/integration/cmd_dev_test.go:1967 @ 04/24/23 08:21:40.91
  Deleting project: cmd-dev-test1919kpy
  Running oc with args [oc delete project cmd-dev-test1919kpy --wait=false] and odo env: []
  [oc] project.project.openshift.io "cmd-dev-test1919kpy" deleted
  Setting current dir to: /go/odo_1/tests/integration
  Deleting dir: /tmp/1257254853
  Deleting dir: /tmp/3210332516
  << Timeline

  [FAILED] Expected
      <string>: NAME               READY   UP-TO-DATE   AVAILABLE   AGE
      my-k8s-component   0/1     0            0           4m49s
      
  not to contain substring
      <string>: my-k8s-component
  In [It] at: /go/odo_1/tests/integration/cmd_dev_test.go:1967 @ 04/24/23 08:21:40.91
------------------------------

  [FAILED] Timed out after 180.000s.
  Expected
      <string>:  âš   Pod is Terminating
       ✗  Finished executing the application (command: devrun) [47s]
       âš   No pod exists
       âš   Pod is Pending
       ✓  Pod is Running
       •  Syncing files into the container  ...
      
 ✓  Syncing files into the container [972ms]
       •  Building your application in container (command: devbuild)  ...
      
 ✓  Building your application in container (command: devbuild) [5s]
       •  Executing the application (command: devrun)  ...
       •  Waiting for the application to be ready  ...
      
 ✓  Waiting for the application to be ready [1s]
       -  Forwarding from 127.0.0.1:31500 -> 3000
      
      
      ↪ Dev mode
       Keyboard Commands:
      [Ctrl+c] - Exit and delete resources from the cluster
           [p] - Manually apply local changes to the application on the cluster
      
  To satisfy at least one of these matchers: [%!s(*matchers.ContainSubstringMatcher=&{Pushing files... []}) %!s(*matchers.ContainSubstringMatcher=&{Updating Component... []})]
  In [BeforeEach] at: /go/odo_1/tests/helper/helper_run.go:70 @ 04/24/23 08:27:00.074

Summarizing 2 Failures:
  [FAIL] odo dev command tests 1. devfile contains composite apply command when odo dev is running [It] should execute the composite apply commands successfully
  /go/odo_1/tests/integration/cmd_dev_test.go:1967
  [FAIL] odo dev command tests port-forwarding for the component when devfile has single endpoint when running odo dev when modifying memoryLimit for container in Devfile [BeforeEach] should react on the Devfile modification (podman=false, manual=true, customPortForwarding=true)
  /go/odo_1/tests/helper/helper_run.go:70

Ran 452 of 824 Specs in 2061.940 seconds
FAIL! -- 450 Passed | 2 Failed | 0 Pending | 372 Skipped

Windows Failure:

  Running oc.exe with args [oc new-project cmd-dev-test2640hhg] and odo env: []
  [oc] Unable to connect to the server: dial tcp 158.177.79.34:31700: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
  [FAILED] in [BeforeEach] - C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_cmd_wrapper.go:101 @ 04/24/23 03:51:22.89
  Deleting project: cmd-dev-test1732lsm
  Running oc.exe with args [oc delete project cmd-dev-test1732lsm --wait=false] and odo env: []
  [oc] Error from server (NotFound): namespaces "cmd-dev-test1732lsm" not found
  [FAILED] in [AfterEach] - C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_cmd_wrapper.go:101 @ 04/24/23 03:51:23.083
  << Timeline

  [FAILED] No future change is possible.  Bailing out early after 21.147s.
  Running oc.exe with args [oc new-project cmd-dev-test2640hhg] and odo env: []
  Expected
      <int>: 1
  to match exit code:
      <int>: 0
  In [BeforeEach] at: C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_cmd_wrapper.go:101 @ 04/24/23 03:51:22.89

  There were additional failures detected.  To view them in detail run ginkgo -vv
-----
  Running oc.exe with args [oc delete project interactive-add-binding-test131tiv --wait=false] and odo env: []
  [oc] Unable to connect to the server: dial tcp 158.177.79.34:31700: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
  [FAILED] in [AfterEach] - C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_cmd_wrapper.go:101 @ 04/24/23 03:37:51.852
  << Timeline

  [FAILED] No future change is possible.  Bailing out early after 21.173s.
  Running oc.exe with args [oc delete project interactive-add-binding-test131tiv --wait=false] and odo env: []
  Expected
      <int>: 1
  to match exit code:
      <int>: 0
  In [AfterEach] at: C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_cmd_wrapper.go:101 @ 04/24/23 03:37:51.852
----
  [FAILED] No future change is possible.  Bailing out early after 21.147s.
  Running oc.exe with args [oc new-project cmd-dev-test2640hhg] and odo env: []
  Expected
      <int>: 1
  to match exit code:
      <int>: 0
  In [BeforeEach] at: C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_cmd_wrapper.go:101 @ 04/24/23 03:51:22.89

+S++++++++++S+SS++S+SS++++++S+++SSS+++++SS+SSS+S+++SS+S+SS++++SS++S+++SSS+SSS+S+++++++++++++++

Summarizing 3 Failures:
  [FAIL] odo add binding interactive command tests [AfterEach] when the component is bootstrapped should successfully add binding to the devfile ("lowercase" as naming strategy)
  C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_cmd_wrapper.go:101
  [FAIL] odo dev command tests [BeforeEach] when running odo dev with alternative commands - with metadata.name when running odo dev with a run command should execute the custom non-default run command successfully
  C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_cmd_wrapper.go:101
  [FAIL] odo add binding command tests [BeforeEach] when the component is bootstrapped when no bindable instance is present on the cluster should fail to add binding with no bindable instance found error message
  C:/Users/Administrator.ANSIBLE-TEST-VS/3768/tests/helper/helper_generic.go:58

@valaparthvi valaparthvi reopened this Apr 24, 2023
tests/integration/cmd_dev_test.go Outdated Show resolved Hide resolved
tests/integration/cmd_dev_debug_test.go Outdated Show resolved Hide resolved
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 24, 2023
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 24, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@valaparthvi
Copy link
Contributor

/override windows-integration-test/Windows-test

+ [FAILED] [73.488 seconds]
odo generic When deleting two project one after the other [It] should be able to delete sequentially

+ [FAILED] [91.113 seconds]
odo describe/list binding command tests when creating a component with a spec binding and envvars (service in namespace "binding-vup") when Starting a Pg service [BeforeEach] when running dev session should describe the binding
  [BeforeEach] C:/Users/Administrator.ANSIBLE-TEST-VS/3790/tests/integration/cmd_describe_list_binding_test.go:652
  [It] C:/Users/Administrator.ANSIBLE-TEST-VS/3790/tests/integration/cmd_describe_list_binding_test.go:701


+ [FAILED] [558.467 seconds]
odo describe/list binding command tests when creating a component with a spec binding (service in namespace "") when Starting a Pg service when running dev session [BeforeEach] when changing the current namespace should list the binding with --namespace flag
  [BeforeEach] C:/Users/Administrator.ANSIBLE-TEST-VS/3790/tests/integration/cmd_describe_list_binding_test.go:690

+ [FAILED] [270.983 seconds]
odo dev interactive command tests when a component is bootstrapped [It] should sync files when p is pressed
C:/Users/Administrator.ANSIBLE-TEST-VS/3790/tests/integration/interactive_dev_test.go:206

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 25, 2023
@openshift-ci
Copy link

openshift-ci bot commented Apr 25, 2023

@valaparthvi: Overrode contexts on behalf of valaparthvi: windows-integration-test/Windows-test

In response to this:

/override windows-integration-test/Windows-test

+ [FAILED] [73.488 seconds]
odo generic When deleting two project one after the other [It] should be able to delete sequentially

+ [FAILED] [91.113 seconds]
odo describe/list binding command tests when creating a component with a spec binding and envvars (service in namespace "binding-vup") when Starting a Pg service [BeforeEach] when running dev session should describe the binding
 [BeforeEach] C:/Users/Administrator.ANSIBLE-TEST-VS/3790/tests/integration/cmd_describe_list_binding_test.go:652
 [It] C:/Users/Administrator.ANSIBLE-TEST-VS/3790/tests/integration/cmd_describe_list_binding_test.go:701


+ [FAILED] [558.467 seconds]
odo describe/list binding command tests when creating a component with a spec binding (service in namespace "") when Starting a Pg service when running dev session [BeforeEach] when changing the current namespace should list the binding with --namespace flag
 [BeforeEach] C:/Users/Administrator.ANSIBLE-TEST-VS/3790/tests/integration/cmd_describe_list_binding_test.go:690

+ [FAILED] [270.983 seconds]
odo dev interactive command tests when a component is bootstrapped [It] should sync files when p is pressed
C:/Users/Administrator.ANSIBLE-TEST-VS/3790/tests/integration/interactive_dev_test.go:206

/lgtm

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.

@openshift-ci openshift-ci bot merged commit 6aacbe2 into redhat-developer:main Apr 25, 2023
@rm3l rm3l deleted the 6758-flaky-test-port-forwarding-for-the-component-possible-custom-port-collision-when-running-tests-in-parallel branch April 25, 2023 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Issues or PRs related to testing, Quality Assurance or Quality Engineering kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky test: port-forwarding for the component: Possible custom port collision when running tests in parallel
3 participants