Merge "Fix race condition in DiscreteRegistry test set up." into sc-dev