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

Validate that zowe.config.json file matches schema #192

Merged
merged 37 commits into from
Sep 27, 2023

Conversation

aadityasinha-dotcom
Copy link
Contributor

@aadityasinha-dotcom aadityasinha-dotcom commented Jun 26, 2023

What It Does
Resolves #74

How to Test

Review Checklist
I certify that I have:

Additional Comments

@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Files Coverage Δ
tests/unit/test_zowe_core.py 99.44% <100.00%> (+0.09%) ⬆️
src/core/zowe/core_for_zowe_sdk/config_file.py 88.19% <95.23%> (+0.36%) ⬆️
.../core/zowe/core_for_zowe_sdk/credential_manager.py 92.30% <85.71%> (ø)
src/core/zowe/core_for_zowe_sdk/profile_manager.py 83.08% <76.92%> (-0.79%) ⬇️
src/core/zowe/core_for_zowe_sdk/validators.py 85.71% <83.33%> (-14.29%) ⬇️

📢 Thoughts on this report? Let us know!.

@aadityasinha-dotcom
Copy link
Contributor Author

aadityasinha-dotcom commented Jun 26, 2023

@t1m0thyj @zFernand0 I have created the PR this is currently incomplete. Need some reviews on it, and how we will handle/find the errors while doing validation 😊

Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
@aadityasinha-dotcom aadityasinha-dotcom marked this pull request as ready for review June 27, 2023 16:18
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
@aadityasinha-dotcom
Copy link
Contributor Author

@t1m0thyj made some changes, please review it ☺️

src/core/zowe/core_for_zowe_sdk/profile_manager.py Outdated Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/validators.py Outdated Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/validators.py Outdated Show resolved Hide resolved
Signed-off-by: aadityasinha-dotcom <[email protected]>
…ethod will be called automatically

Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
Signed-off-by: aadityasinha-dotcom <[email protected]>
props: dict = prof_manager.load(profile_name="zosmf", validate_schema=True)

@patch("keyring.get_password", side_effect=keyring_get_password)
def test_profile_loading_with_invalid_schema_internet_URI(self, get_pass_func):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added test for SchemaError with InternetURI

tests/unit/test_zowe_core.py Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/config_file.py Outdated Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/config_file.py Outdated Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/config_file.py Outdated Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/profile_manager.py Outdated Show resolved Hide resolved
Copy link
Member

@t1m0thyj t1m0thyj 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 addressing earlier comments, validating schema works for me now with a global team config file in home dir 👍

Left a few comments on config_file.py. Once those are addressed I'll approve since coverage looks good as well 🙂

src/core/zowe/core_for_zowe_sdk/config_file.py Outdated Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/config_file.py Outdated Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/config_file.py Outdated Show resolved Hide resolved
tests/unit/test_zowe_core.py Show resolved Hide resolved
Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

changes LGTM!
left a few comments, not a huge deal though 😋

still going through the tests to see what's happening 😋

src/core/zowe/core_for_zowe_sdk/validators.py Show resolved Hide resolved
src/core/zowe/core_for_zowe_sdk/config_file.py Outdated Show resolved Hide resolved
@aadityasinha-dotcom
Copy link
Contributor Author

aadityasinha-dotcom commented Sep 7, 2023

changes LGTM! left a few comments, not a huge deal though 😋

still going through the tests to see what's happening 😋

I tested this locally, it was working fine though 🤔

Signed-off-by: aadityasinha-dotcom <[email protected]>
@t1m0thyj
Copy link
Member

t1m0thyj commented Sep 25, 2023

changes LGTM! left a few comments, not a huge deal though 😋
still going through the tests to see what's happening 😋

I tested this locally, it was working fine though 🤔

@aadityasinha-dotcom For the validate_schema PR, do you have any of the following files either in your project directory or in ~/.zowe?

  • zowe.config.json
  • zowe.config.user.json
  • zowe.schema.json

If you have any of those files present locally, can you try deleting them or moving them out of the way so that tests are running in a clean environment without config?

Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

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

LGTM! 😋

@t1m0thyj t1m0thyj merged commit 18c9385 into zowe:main Sep 27, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core] Validate that zowe.config.json file matches schema
3 participants