Signed-off-by: Valerij Maljulin vmaljuli@redhat.com
DO NOT MERGE YET!
Can you add a test with this scenario: you have 2 rules in a policy in the global conf: PassingTestCaseRule and RemoteRule. You can create a result that would make the PassingTestCaseRule pass. Then you can mock the failure (NoSourceException) and check if the "PassingTestCaseRule" was processed (satisfied) or ignored.
This test would check if the behaviour is the expected one.
No need to log the stacktrace, the error message would be enough.
rebased onto 7ec80e3abb7089592a3a7096403819c961c88456
Comments were addressed
Can you rather mock just the koji data? (I.e. mock xmlrpc.client.ServerProxy.getBuild().)
xmlrpc.client.ServerProxy.getBuild()
rebased onto ab5ce3c020e5da4b71622492984c4eb208e3882d
@lholecek Done
I think you can do just koji_server_instance.getBuild.return_value = {'source': None} for clarity.
koji_server_instance.getBuild.return_value = {'source': None}
+1
rebased onto 30b5e9781081c4919e105600b1791d81546dbab4
Can you continue the test with the creation of a result and then check if the decision is satisfied? This would happen only when "two_rules" is True.
PS. note that this behaviour is not strictly related to the "on-demand" feature, but applies to all cases where the RemoteRule is applicable. So it's easier you can test it also with the "normal" behaviour.
rebased onto 1ece51263c58939f89eccef87865f79694f3cc30
You can avoid of using "nsvc" here, you can use always "nvr" and avoid declaring "nsvc" above. And then in: decision = policy.check('fedora-29', nsvc, results) You would use "nvr" too and instead of "fedora-29" you can use "fedora-30".
I'm actually surprised that it succeeds.. It's a bit strange because you don't have a policy for fedora-29...
rebased onto ed6998a9825b6125aa9251627f2f1c2022773b5f
Thank you for applying the changes! It looks good. +1
Pull-Request has been merged by vmaljulin
Signed-off-by: Valerij Maljulin vmaljuli@redhat.com