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

Do not display "Waiting for component to start" twice #4919

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Jul 16, 2021

What type of PR is this?

/kind bug

What does this PR do / why we need it:

WaitAndGetPodWithEvents now waits for an event with a Phase different from the expected one before to start the Spinner. This way, the spinner is only displayed when the pod is not in the expected phase.

Which issue(s) this PR fixes:

Fixes #4362

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

  • Update changelog

  • I have read the test guidelines

How to test changes / Special notes to the reviewer:

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 16, 2021
@@ -56,6 +57,22 @@ func (a *Adapter) getPod(refresh bool) (*corev1.Pod, error) {
if refresh || a.pod == nil {
podSelector := fmt.Sprintf("component=%s", a.ComponentName)

// First check if the pod is already in desired state
c := a.Client.GetKubeClient()
podList, err := c.KubeClient.CoreV1().Pods(c.Namespace).List(context.TODO(), metav1.ListOptions{
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can avoid listing the pods and use the condition appsv1.DeploymentAvailable in the WaitAndGetPodWithEvents function to start and stop the spinner

Copy link
Contributor Author

@feloy feloy Jul 16, 2021

Choose a reason for hiding this comment

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

In fact, I cannot see any use case where this function getPod is really waiting for the pod to be started. @mik-dass do you have any example when this function is waiting?
The only function I can see waiting is WaitForDeploymentRollout

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 changed to start the spinner only when a phase different from the expected one is received

@feloy feloy force-pushed the bugfix-4362/waiting-component-start branch from 7ab7f3c to b131232 Compare July 16, 2021 15:18
@feloy feloy force-pushed the bugfix-4362/waiting-component-start branch from b131232 to a4b06f4 Compare July 16, 2021 15:21
@sonarcloud
Copy link

sonarcloud bot commented Jul 19, 2021

Kudos, SonarCloud 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

@feloy
Copy link
Contributor Author

feloy commented Jul 19, 2021

/retest

defer spinner.End(false)
var spinner *log.Status
defer func() {
if spinner != nil {
Copy link
Member

Choose a reason for hiding this comment

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

In what situation will this check be not satisfied? We're doing var spinner *log.Status right above this so, I'm confused as to when spinner will be nil and this check would be not satisfied.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In var spinner *log.Status, spinner is a non initialized pointer, so getting its zero value, nil.
The pointer gets affected a value only when receiving a phase different from the expected one.

@kadel
Copy link
Member

kadel commented Jul 22, 2021

/approve

@openshift-ci
Copy link

openshift-ci bot commented Jul 22, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kadel

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Jul 22, 2021
Copy link
Contributor

@mik-dass mik-dass left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jul 22, 2021
@openshift-merge-robot openshift-merge-robot merged commit 21f6faa into redhat-developer:main Jul 22, 2021
anandrkskd pushed a commit to anandrkskd/odo that referenced this pull request Jul 27, 2021
…er#4919)

* Do not display "Waiting for component to start" twice

* Changelog
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. Required by Prow. 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.

"Waiting for component to start" gets printed multiple times
5 participants