-
Notifications
You must be signed in to change notification settings - Fork 100
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
fix: make client_facades reflect facades in generated client code #1150
fix: make client_facades reflect facades in generated client code #1150
Conversation
c6960c7
to
303c162
Compare
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.
Nice!
I think now that we know how to extract and compare, the test can be greatly simplified.
Thanks for the review, @dimaqq. The integration test failures aren't the usual ones -- a lot of
self.deploy_types = {
Schema.LOCAL: LocalDeployType(),
Schema.CHARM_HUB: CharmhubDeployType(self._resolve_charm),
} We're at least breaking with charmhub charms, given this: # in juju.bundle
def is_local_charm(charm_url: str):
return charm_url.startswith('.') or charm_url.startswith('local:') or os.path.isabs(charm_url) And given these example failing lines in tests: # test_action
app = await model.deploy('juju-qa-test')
# test_get_set_config
app = await model.deploy(
'ubuntu',
application_name='ubuntu',
series='jammy',
channel='stable',
config={
'hostname': 'myubuntu',
},
constraints={
'arch': 'amd64',
'mem': 256 * MB,
},
)
# test_deploy_charmhub_charm
app = await model.deploy('ubuntu')
# test_upgrade_local_charm
app = await model.deploy('ubuntu', series='focal', revision=15, channel='latest/stable') So let's assume we mostly just want to investigate That method breaks on supported_series = result.get(
'supported_series',
result.unknown_fields['supported-series'] # KeyError!
) So Summary for the below: we use the There aren't any errors along the way, but the This result comes from Here it seems we end up in What version though? We get the target version from Now we're getting somewhere! Changing
So we do get the Well, The only difference in their implementation is the contents of the dictionary they use as the argument to
Heading to |
303c162
to
edd07c4
Compare
It seems that "supported-series" field was removed after Juju 3.2.3 |
Ahh I see your latest commit, it makes sense that "bases" replaced "series". See: |
Yeah I didn't think it would work, but figured it was worth seeing what would happen. Thanks for finding that documentation. |
How about this: special-case that one specific facade, so that the rest of the PR can be refactored, rebased on top of #1155 and merged. open an issue to resolve series vs bases. I think a short discussion with someone from Juju is on order, depending on e.g. what range of Juju versions the library should support. |
7c02f90
to
d64d786
Compare
I believe integration tests are passing now, they're just rerunning from the latest minor push. Please take a look, @dimaqq. I think I need to document |
f123d8e
to
c4e1a58
Compare
3348f76
to
351ec13
Compare
It checks that juju/client/connection.py's client_facades matches the facade versions across the generated code (juju/client/_client*.py)
I guess it will break selected_series = utils.series_selector(...
modify tox.ini to run pytest in validate environment with -vv so that the nested dictionary comparison is actually shown
These are facades that python-libjuju does not yet support. They should not be included in client_facades. Update validate test to reflect this.
Explicitly test assumptions about facade name and version numbering, and then build the required data structure more directly in a single pass + sorting.
This reverts commit 7f0f6ca. Integration tests fail on the last commit (7f0f6...) -- consistently, threee times. They passed on the previous commit. What's going on?
This reverts commit 3b00014.
351ec13
to
d911ef4
Compare
/merge |
Description
client_facades
injuju/client/connection.py
is manually updated. It doesn't reflect the actual facade code present, which was recently generated from the current 3.1.X and 3.3.0 schemas currently checked in. Nor did it reflect the state of the generated code with the previous set of schemas (same + 3.2.X schemas), nor the state of the actually checked in code before the last regeneration of the code (which contained some orphan facades not present in the schemas).This PR updates
client_schemas
and adds a test to ensure that its facade versions always match the schemas present in the generated client code. The test can be run withtox -e validate
, and is run in a separate github job as it didn't seem to fit in well as either a unit or integration test. In future we could add more tests to this group to validate other aspects of the codebase related to the code generation.QA Steps
All non-quarantined tests should continue to work.
Should pass currently.
Notes & Discussion
Does the current state of client_facades make sense? One thing that stood out to me was the addition of
Admin
. I'm wondering if any non-client facades are being added here, since facade code is generated from the full schemas still. If that's the case, then this should be deferred till after we switch to client-only schemas.