The article you referenced specifically states not to cloak for user-agent. So, as long as you're selecting which visitors get which version by something other than user-agent, cloaking isn't happening and you are safe.
The article also states how to make sure the correct version of your pages are indexed - by including canonicals. This will make sure bots don't include both versions of your page or one of the variants that doesn't end up winning.
Final suggestion: look into Google Optimize. It's a free service, and by using Google's own service, you can be even more certain that your testing won't cause issues with rankings or indexing in Google specifically.