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 potential port conflict issue with the API server tests by using a random server port if --random-ports is set #6995

Conversation

rm3l
Copy link
Member

@rm3l rm3l commented Jul 21, 2023

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

What does this PR do / why we need it:
This lets the OS assign a random ephemeral port to the API Server if --random-ports is specified when running odo dev or odo api-server.
This should hopefully fix the potential port conflict flaky issue we are seeing, especially on Windows.

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

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

rm3l added 2 commits July 21, 2023 08:17
…ified when running `odo dev` or `odo api-server`

This should hopefully fix the potential port conflict flaky
issue we are seeing, especially on Windows.
This applies to:
- `odo dev --random-ports --api-server --api-server-port=<port>`
- `odo api-server --random-ports --port=<port>`
@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. area/testing Issues or PRs related to testing, Quality Assurance or Quality Engineering labels Jul 21, 2023
@netlify
Copy link

netlify bot commented Jul 21, 2023

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 3ee965f
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/64ba2485eab165000894062b

@openshift-ci
Copy link

openshift-ci bot commented Jul 21, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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

@odo-robot
Copy link

odo-robot bot commented Jul 21, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jul 21, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jul 21, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jul 21, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jul 21, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jul 21, 2023

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

@odo-robot
Copy link

odo-robot bot commented Jul 21, 2023

Windows Tests (OCP) on commit finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jul 21, 2023

Kubernetes Docs Tests on commit fadd130 finished with errors.
View logs: TXT HTML

@rm3l rm3l changed the title [WIP] Fix potential port conflict issue with API server tests by using a random server port if --random-ports is set Fix potential port conflict issue with API server tests by using a random server port if --random-ports is set Jul 21, 2023
@rm3l rm3l requested a review from feloy July 21, 2023 07:19
@rm3l rm3l marked this pull request as ready for review July 21, 2023 07:19
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Jul 21, 2023
@openshift-ci openshift-ci bot requested a review from valaparthvi July 21, 2023 07:20
@rm3l rm3l removed the request for review from valaparthvi July 21, 2023 07:20
@rm3l rm3l added the kind/bug Categorizes issue or PR as related to a bug. label Jul 21, 2023
Copy link
Contributor

@feloy feloy left a comment

Choose a reason for hiding this comment

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

Thanks for this fix

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jul 21, 2023
@rm3l
Copy link
Member Author

rm3l commented Jul 21, 2023

...
  [odo]  ✗  watch command was unable to push component: fail starting the port forwarding: pod not found for the selector: component=my-go-app
...

  [FAILED] session exited, but substring not found
  Expected
      <string>:   __
       /  \__     Developing using the "my-go-app" Devfile
       \__/  \    Namespace: doc-user-guides-quickstart-test113drc
       /  \__/    odo version: v3.12.0
       \__/
      
      ↪ Running on the cluster in Dev mode
       •  Waiting for Kubernetes resources  ...
       âš   Pod is Pending
       ✓  Pod is Running
       •  Syncing files into the container  ...
      
 ✓  Syncing files into the container [369ms]
       •  Building your application in container (command: build)  ...
      
 ✓  Building your application in container (command: build) [1s]
       •  Executing the application (command: run)  ...
       •  Waiting for the application to be ready  ...
      
 ✓  Waiting for the application to be ready [1s]
      Cleaning resources, please wait
      
  to contain substring
      <string>: [Ctrl+c] - Exit
  In [It] at: /go/odo_1/tests/helper/helper_run.go:50 @ 07/21/23 06:57:56.983
------------------------------
Spawning '/go/bin/odo init' from /tmp/3618963471
•Spawning '/go/bin/odo init' from /tmp/2657118125
••Spawning '/go/bin/odo init' from /tmp/1398836430
•

Summarizing 1 Failure:
  [FAIL] User guides: Quickstart test Go quickstart guide [It] should test the complete go quickstart output in order
  /go/odo_1/tests/helper/helper_run.go:50

Ran 5 of 5 Specs in 218.906 seconds
FAIL! -- 4 Passed | 1 Failed | 0 Pending | 0 Skipped
--- FAIL: TestUserGuidesDocAutomation (218.93s)
FAIL

Not sure why the pod was not found when trying to start port forwarding. Overriding, but let's keep an eye on this to see if it happens again on some other PRs.

/override Kubernetes-Integration-Tests/Kubernetes-Docs-Integration-Tests

@openshift-ci
Copy link

openshift-ci bot commented Jul 21, 2023

@rm3l: Overrode contexts on behalf of rm3l: Kubernetes-Integration-Tests/Kubernetes-Docs-Integration-Tests

In response to this:

...
 [odo]  ✗  watch command was unable to push component: fail starting the port forwarding: pod not found for the selector: component=my-go-app
...

 [FAILED] session exited, but substring not found
 Expected
     <string>:   __
      /  \__     Developing using the "my-go-app" Devfile
      \__/  \    Namespace: doc-user-guides-quickstart-test113drc
      /  \__/    odo version: v3.12.0
      \__/
     
     ↪ Running on the cluster in Dev mode
      •  Waiting for Kubernetes resources  ...
      âš   Pod is Pending
      ✓  Pod is Running
      •  Syncing files into the container  ...
     
✓  Syncing files into the container [369ms]
      •  Building your application in container (command: build)  ...
     
✓  Building your application in container (command: build) [1s]
      •  Executing the application (command: run)  ...
      •  Waiting for the application to be ready  ...
     
✓  Waiting for the application to be ready [1s]
     Cleaning resources, please wait
     
 to contain substring
     <string>: [Ctrl+c] - Exit
 In [It] at: /go/odo_1/tests/helper/helper_run.go:50 @ 07/21/23 06:57:56.983
------------------------------
Spawning '/go/bin/odo init' from /tmp/3618963471
•Spawning '/go/bin/odo init' from /tmp/2657118125
••Spawning '/go/bin/odo init' from /tmp/1398836430
•

Summarizing 1 Failure:
 [FAIL] User guides: Quickstart test Go quickstart guide [It] should test the complete go quickstart output in order
 /go/odo_1/tests/helper/helper_run.go:50

Ran 5 of 5 Specs in 218.906 seconds
FAIL! -- 4 Passed | 1 Failed | 0 Pending | 0 Skipped
--- FAIL: TestUserGuidesDocAutomation (218.93s)
FAIL

Not sure why the pod was not found when trying to start port forwarding. Overriding, but let's keep an eye on this to see if it happens again on some other PRs.

/override Kubernetes-Integration-Tests/Kubernetes-Docs-Integration-Tests

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.

@rm3l rm3l changed the title Fix potential port conflict issue with API server tests by using a random server port if --random-ports is set Fix potential port conflict issue with the API server tests by using a random server port if --random-ports is set Jul 21, 2023
@openshift-merge-robot openshift-merge-robot merged commit a4ee0e4 into redhat-developer:main Jul 21, 2023
@rm3l rm3l deleted the 6939-ports-conflict-when-running-api-server-tests-on-windows branch July 21, 2023 07:57
@rm3l rm3l mentioned this pull request Jul 21, 2023
3 tasks
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.

Ports conflict when running api server tests on Windows
3 participants