The following are a list of test cases for declarative diversions
TEST CASE ONE
Aim
Add a diversion using declarative diversions
Process
Install a package 'foo' that contains file /usr/share/foo
Install a package 'bar' that contains file /usr/share/foo and a declarative diversion from /usr/share/foo to /usr/share/bar
Expected Outcome
Packages 'foo' and 'bar' are successfully configured with both /usr/share/foo and /usr/share/bar present in the tree.
TEST CASE TWO
Aim
Remove a declarative diversion
Process
Install a package 'foo' that contains file /usr/share/foo
Install a package 'bar' that contains file /usr/share/foo and a declarative diversion from /usr/share/foo to /usr/share/bar
Upgrade the package 'bar' and remove the declarative diversion from /usr/share/foo to /usr/share/bar <<BR>
Expected Outcome
The declarative diversion is removed resulting in /usr/share/bar becoming /usr/share/foo once again
TEST CASE THREE
Aim
Add a diversion to a none existant file
Process
Install a package 'foo' that doesn't contain the file /usr/share/foo
- Install a package 'bar' that contains file /usr/share/foo and a declarative diversion from /usr/share/foo to /usr/share/bar
Expected Outcome
If package 'foo' installs a file to /usr/share/foo in the future with the declarative diversion still in place it will divert it to /usr/share/bar
TEST CASE FOUR
Aim
Remove a diversion resulting in a file conflict
Process
Install a package 'foo' that contains file /usr/share/foo
Install a package 'bar' that contains file /usr/share/foo and a declarative diversion from /usr/share/foo to /usr/share/bar
- Upgrade the package 'bar' that doesn't contain file /usr/share/foo and remove the declarative diversion from /usr/share/foo to /usr/share/bar
Expected Outcome
An error is returned and unpack is aborted
TEST CASE FIVE
Aim
Remove a package, leaving a diversion in place
Process
Install a package 'foo' that contains file /usr/share/foo
Install a package 'bar' that contains file /usr/share/foo and a declarative diversion from /usr/share/foo to /usr/share/bar
Remove package 'foo'
- Do not remove diversion
Expected Outcome
Diversion atomically removed on cleanup
TEST CASE SIX
Aim
Remove a package, leaving a diversion in place. Install a new version of that package that doesn't ship the diversion
Process
Install a package 'foo' that contains file /usr/share/foo
Install a package 'bar' that contains file /usr/share/foo and a declarative diversion from /usr/share/foo to /usr/share/bar
Remove package 'foo'
- Do not remove diversion
Expected Outcome
Diversion atomically removed on cleanup
