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

Fix apiserver_id 'get' method#184

Merged
k8s-ci-robot merged 1 commit into
kubernetes-client:masterfrom
fooka03:bugfix/179
Feb 21, 2020
Merged

Fix apiserver_id 'get' method#184
k8s-ci-robot merged 1 commit into
kubernetes-client:masterfrom
fooka03:bugfix/179

Conversation

@fooka03

@fooka03 fooka03 commented Feb 21, 2020

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

fooka03 commented Feb 21, 2020

Copy link
Copy Markdown
Contributor Author

/assign @yliaog

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

def test_azure_with_bad_apiserver(self):

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Details 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