Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

Fix apiserver_id 'get' method #184

Merged
merged 1 commit into from
Feb 21, 2020

Conversation

fooka03
Copy link
Contributor

@fooka03 fooka03 commented Feb 21, 2020

Fixes #179

Not sure how I missed this in testing locally but ConfigNode definitely does not have a .get method. This change instead relies on getitem and it throwing a ConfigException to fall back to the default value.

This commit also prunes some excess tests that are already covered by other cases.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 21, 2020
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 21, 2020
@codecov-io
Copy link

Codecov Report

Merging #184 into master will decrease coverage by 0.29%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #184     +/-   ##
=========================================
- Coverage   92.46%   92.17%   -0.3%     
=========================================
  Files          13       13             
  Lines        1474     1470      -4     
=========================================
- Hits         1363     1355      -8     
- Misses        111      115      +4
Impacted Files Coverage Δ
config/kube_config_test.py 95.49% <ø> (-0.08%) ⬇️
config/kube_config.py 83.48% <0%> (-0.78%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a25f49e...faf2e0c. Read the comment docs.

@fooka03
Copy link
Contributor Author

fooka03 commented Feb 21, 2020

/assign @yliaog

provider = loader._user['auth-provider']
self.assertTrue(loader._azure_is_expired(provider))

def test_azure_with_bad_apiserver(self):
Copy link
Member

Choose a reason for hiding this comment

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

The code fix looks good to me. Could you point out which other test cases cover these pruned cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These two tests are calling the same function as test_azure_with_expired_num with the same arguments. The apiserver values here aren't actually used in _azure_is_expired and _refresh_azure_token is not currently covered by tests (which is why this slipped through in the first place, and the test coverage didn't really change)
https://github.com/kubernetes-client/python-base/pull/184/files#diff-3123bf09ac4950ea8bf8de46fb38eb83L1132

@roycaihw
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 21, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fooka03, roycaihw

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 21, 2020
@k8s-ci-robot k8s-ci-robot merged commit d30f1e6 into kubernetes-client:master Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError: 'ConfigNode' object has no attribute 'get'
5 participants