congress/congress/tests/datalog
Eric Kao 9f52ebbf68 Pad positional args up to required number
Pad positional args in rules up to number required by schema.

The eliminate_column_references methods are slightly extended
to also pad positional arguments even when no column refs
are present.

The change makes it so that adding new data columns (to the right
of existing ones)  in datasource drivers do not break existing
policy rules.

For example,
nova:flavors(x) is automatically expanded to something like
nova:flavors(x, _x1, _x2, _x3), just like if the input was
nova:flavors(id=x). The behavior is consistent with that of
optional parameters Python and C++.

We discussed on IRC how to keep backward compatibility with existing
policy rules when we add new information to data source drivers.

There was some agreement that versioning the schema was the most
complete solution, as it allows for the removal of tables/columns as
well as additions.

But even with the adoption explicit versioning, the allowance for too
few positional arguments is still a great convenience for deployers
because it makes the adding of data columns a backward compatible
version change rather than a backward incompatible version change.
That is, the deployer can take advantage of the new data columns in
new policy, without having to rewrite all the existing policy.

Related-Bug: 1674537

Change-Id: Iac817f0a5c6dbb8c94804097d84f9541e1f22b1e
2017-04-12 15:13:19 -07:00
..
__init__.py Rename 'congress/policy' directory to 'congress/datalog' 2015-02-26 18:31:13 -08:00
test_builtin.py Use more specific asserts in tests 2017-02-28 03:14:25 +00:00
test_compiler.py Pad positional args up to required number 2017-04-12 15:13:19 -07:00
test_factset.py Use more specific asserts in tests 2017-02-28 03:14:25 +00:00
test_materialized.py Use assertIn(A, B) instead of assertTrue(A in B ) 2016-09-02 18:03:02 +08:00
test_nonrecur.py Use python3 print, division, import 2016-01-20 15:31:02 -08:00
test_ordered_set.py Trivial: Replace 'assertTrue(a not in b)' with 'assertNotIn(a, b)' 2016-09-26 12:36:04 +07:00
test_ruleset.py Use more specific asserts in tests 2017-02-28 03:14:25 +00:00
test_unify.py Use more specific asserts in tests 2017-02-28 03:14:25 +00:00
test_utility.py TrivialFix: Remove logging import unused 2016-08-26 10:48:47 +07:00