tests: Extend framework to support master demote to shadow

Change-Id: I9636c04e33104a59a1df7cb0751f3639f2b7afbf