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
Bug/1828424 #156
Bug/1828424 #156
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see inline comments.
) | ||
|
||
with self.config_change( | ||
self.config_current(application_name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's the use of a new method config_current
@@ -133,6 +133,29 @@ def setUpClass(cls, application_name=None, model_alias=None): | |||
model_name=cls.model_name) | |||
logging.debug('Leader unit is {}'.format(cls.lead_unit)) | |||
|
|||
def config_current(self, application_name=None, keys=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new method here to get the current config from an application. You can supply keys
if you only want certain items from the current config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some really nice, clean, code in this patchset. There's just one minor change to a docstring and it's good to go.
Hi Adam I not sure, but it looks like you've switched all the docstring params/types to |
force of habit. I've been doing I'll fix that up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for doing the changes.
:rtype: Tuple[bool, Dict[str,str]] | ||
""" | ||
ldap_ips = zaza.model.get_app_ips("ldap-server") | ||
self.assertTrue(ldap_ips, "Should be at least one ldap server") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajkavanagh @thedac let's assert if the ldap-server isn't there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of nits. And a need for more discussion.
I did not realize until I got to the end that you were just moving existing code to create the config_current method. I am not sure I love this in its original form, but I concede it exists that way already. I would really like a second opinion on this before landing.
) | ||
states = { | ||
'keystone': { | ||
'workload-status': 'idle', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another method for checking for idleness. workload-state should be active here. This is, however, the default, making the setting of states unecessary.
The best practice is to check the tests.yaml which allows future developers to change expectations:
test_config = lifecycle_utils.get_charm_config(fatal=False)
zaza.model.wait_for_application_states(
states=test_config.get("target_deploy_status", {}))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did this!
# convert the more elaborate config structure from libjuju to key-value | ||
keys = keys or _app_config.keys() | ||
# note that conversion to string for all values is due to | ||
# attempting to set any config with other types lead to Traceback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/lead/leads
Though the whole sentence could be clearer.
Beyond the comment, I am not sold on changing the types. I would be interested to see the traceback when you don't set things to a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i remember rightly, the traceback was trying to cast a go native type into a python type? That may be why str(*) is used here. Ill see if i can reproduce.
Also, I think I remember that passing the config back with model.set_application_config
fussed about the types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah... here's the issue. You can 'get' the current config such that the types are preserved (aka -- not mapped through str) but when you play them back into the model.set_application_config -- it doesn't like anything that isn't str typed.
2020-01-24 12:40:44 [INFO] File "/home/ubuntu/charms/layers/keystone-ldap/build/builds/keystone-ldap/.tox/func-smoke/lib/python3.7/site-packages/zaza/model.py", line 531, in async_set_application_config
2020-01-24 12:40:44 [INFO] .set_config(configuration))
2020-01-24 12:40:44 [INFO] File "/home/ubuntu/charms/layers/keystone-ldap/build/builds/keystone-ldap/.tox/func-smoke/lib/python3.7/site-packages/juju/application.py", line 383, in set_config
2020-01-24 12:40:44 [INFO] return await app_facade.Set(application=self.name, options=config)
2020-01-24 12:40:44 [INFO] File "/home/ubuntu/charms/layers/keystone-ldap/build/builds/keystone-ldap/.tox/func-smoke/lib/python3.7/site-packages/juju/client/facade.py", line 471, in wrapper
2020-01-24 12:40:44 [INFO] reply = await f(*args, **kwargs)
2020-01-24 12:40:44 [INFO] File "/home/ubuntu/charms/layers/keystone-ldap/build/builds/keystone-ldap/.tox/func-smoke/lib/python3.7/site-packages/juju/client/_client8.py", line 1124, in Set
2020-01-24 12:40:44 [INFO] reply = await self.rpc(msg)
2020-01-24 12:40:44 [INFO] File "/home/ubuntu/charms/layers/keystone-ldap/build/builds/keystone-ldap/.tox/func-smoke/lib/python3.7/site-packages/juju/client/facade.py", line 607, in rpc
2020-01-24 12:40:44 [INFO] result = await self.connection.rpc(msg, encoder=TypeEncoder)
2020-01-24 12:40:44 [INFO] File "/home/ubuntu/charms/layers/keystone-ldap/build/builds/keystone-ldap/.tox/func-smoke/lib/python3.7/site-packages/juju/client/connection.py", line 456, in rpc
2020-01-24 12:40:44 [INFO] raise errors.JujuAPIError(result)
2020-01-24 12:40:44 [INFO] juju.errors.JujuAPIError: json: cannot unmarshal bool into Go struct field ApplicationSet.options of type string
…me documentation issues
…g to zaza.model does required all values are strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great.
removing disco_stein as its EOL func-test-pr: openstack-charmers/zaza-openstack-tests#156 Change-Id: Ice0ae709817db2fd9ffcff299ca403b70dd22721 Closes-Bug: #1828424
* Update charm-keystone-ldap from branch 'master' - Migrate keystone-ldap tests to zaza removing disco_stein as its EOL func-test-pr: openstack-charmers/zaza-openstack-tests#156 Change-Id: Ice0ae709817db2fd9ffcff299ca403b70dd22721 Closes-Bug: #1828424
Port keystone-ldap basic tests to zaza