Skip to content

Conversation

@lucab
Copy link
Contributor

@lucab lucab commented Jun 28, 2019

This adds logic and basic tests to source policy plugins settings
from TOML configuration file.

Ref: https://jira.coreos.com/browse/CIN-3

@lucab lucab requested a review from steveej June 28, 2019 15:15
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 28, 2019
Copy link
Contributor

@steveej steveej left a comment

Choose a reason for hiding this comment

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

Preliminary review pass with a few high-level comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is pretty ugly. Do you see any chance we don't need this?
Why do we need this trait for BoxedPlugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used (so far exactly once) in tests: https://github.com/openshift/cincinnati/pull/129/files#diff-abed32e590a01cf6f55fd42829e13404R159.

This is indeed pretty ugly. However trait object safety rules disallow any use of generics (which PartialEq has), so we can't just require/use the implementation from underlying real type. Similar consideration for Serialize. Instead, Debug contains no generics, so it works here.

The only improvement I can think of here is to make this #[cfg(test)], as I think we are not going to use it outside of tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

The only improvement I can think of here is to make this #[cfg(test)], as I think we are not going to use it outside of tests.

That seems like a reasonable workaround. You could even pull the impl into the tests module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bad news: the consumer of this is in a separate crate, so neither of the two approaches above work (as the cfg(test) affects the top-level crate, not the dependencies).

Copy link
Contributor

Choose a reason for hiding this comment

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

That's unfortunate. So we can only place a sentence in the docstring that it's only used for testing but we can't statically enforce that right now.

@lucab lucab force-pushed the ups/pe-plugins branch from d5f938d to 853203d Compare July 9, 2019 08:10
@lucab
Copy link
Contributor Author

lucab commented Jul 9, 2019

Amended, PTAL.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mind explaining why you would like to have a separate trait for this? It would also work to have a blanket implementation of try_merge in the MergeOptions<T> trait with just Ok(self.merge(T)).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed out of band: let's unify and just keep a single trait (the fallible one).

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2019
lucab added 2 commits July 24, 2019 15:23
This adds an addition type alias to help consumers which
need to store/handle/compare policy plugins.
This tweaks the `MergeOptions` in order to support fallible operations,
for merging configuration snippets that require further processing.
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2019
This adds logic and basic tests to source policy plugins settings
from TOML configuration file.
@lucab
Copy link
Contributor Author

lucab commented Jul 24, 2019

@steveej rebased to latest master and addressed all comments, PTAL.

Copy link
Contributor

@steveej steveej left a comment

Choose a reason for hiding this comment

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

This
/lgtm
But putting it on
/hold
to give you another opportunity to dig for a solution to the PartiqlEq workaround. Feel free to cancel the hold on your own accord.

@openshift-ci-robot openshift-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Aug 16, 2019
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lucab, steveeJ

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

@lucab
Copy link
Contributor Author

lucab commented Aug 16, 2019

I looked a bit more into cargo test environment variables but didn't find anything I can directly use for conditional behavior. I'm merging as is.

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 16, 2019
@openshift-merge-robot openshift-merge-robot merged commit 356893a into openshift:master Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants