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

Fetch pods when displaying pods resources in overview pages #7070

Conversation

jeff-phillips-18
Copy link
Member

@jeff-phillips-18 jeff-phillips-18 commented Nov 2, 2020

Fixes
https://issues.redhat.com/browse/ODC-4966 (portions of it)

Description
Update the pod resources section of overview pages to retrieve pods for display rather than depending upon the passed in item's resources to be kept up to date.

Non-functional change

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

/kind cleanup

@openshift-ci-robot openshift-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Nov 2, 2020
@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality component/knative Related to knative-plugin component/kubevirt Related to kubevirt-plugin component/shared Related to console-shared labels Nov 2, 2020
@jeff-phillips-18
Copy link
Member Author

/retest

@jeff-phillips-18
Copy link
Member Author

/retest

Comment on lines 25 to 272
it('should return pods for a given Deployment', () => {
const transformedData = getPodsForDeployments(sampleDeployments.data, MockResources);
expect(transformedData).toHaveLength(3);
});

it('should return pods for a given DeploymentConfig', () => {
const transformedData = getPodsForStatefulSets(sampleDeployments.data, MockResources);
expect(transformedData).toHaveLength(3);
});

it('should return pods for a given DaemonSet', () => {
const transformedData = getPodsForDaemonSets(sampleDaemonSets.data, MockResources);
expect(transformedData).toHaveLength(1);
});

it('should return pods for a given CronJob', () => {
const transformedData = getPodsForCronJobs(sampleCronJobs.data, MockResources);
expect(transformedData).toHaveLength(1);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

For full coverage, can we have a test for each of these functions that test a lack of data (null and/or [])? The condition inside is super simple, it's a 1:1 relationship with the test data, so I think they are okay tests as is, but if we are going with such simple tests, we should cover both paths.

Comment on lines 8 to 21
import {
getPodsForDeploymentConfigs,
getPodsForDeployments,
getPodsForStatefulSets,
getPodsForDaemonSets,
getPodsForCronJobs,
} from '../pod-resource-utils';
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have tests for the exposed methods under each of these... can we get tests for those?

@@ -173,22 +181,122 @@ export const PodsOverview: React.SFC<PodsOverviewProps> = ({
</Alert>
) : null}
{_.isEmpty(filteredPods) ? (
<span className="text-muted">{emptyMessage}</span>
<span className="text-muted">{loaded ? loadError || emptyMessage : <LoadingBox />}</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... looks like if we get a gateway error because the cluster going down, this doesn't really render properly; it's stuck not loaded but with an error. Did we want to check loaded and NOT an error?

React Dev Tools & the Response (Error) Object:
Screen Shot 2020-11-03 at 7 10 27 PM
Screen Shot 2020-11-03 at 7 10 34 PM

@jeff-phillips-18
Copy link
Member Author

@andrewballantyne Added tests and updated to display loadError if there is one.

Copy link
Contributor

@andrewballantyne andrewballantyne 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-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 4, 2020
@andrewballantyne
Copy link
Contributor

/retest

Looks like connection issues

@jeff-phillips-18
Copy link
Member Author

/retest

@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne, christianvogt, jeff-phillips-18

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 4, 2020
@openshift-merge-robot openshift-merge-robot merged commit 4388694 into openshift:master Nov 5, 2020
@spadgett spadgett added this to the v4.7 milestone Nov 5, 2020
@jeff-phillips-18 jeff-phillips-18 deleted the pods-load-pods-overview branch December 2, 2020 13:33
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. component/core Related to console core functionality component/knative Related to knative-plugin component/kubevirt Related to kubevirt-plugin component/shared Related to console-shared kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants