Improve test stability for #13855 ticket. Close gh-1328.