The canonical
node is mandatory for hosts
entries with the Hosts.lns
lens, so you need:
set /files/etc/hosts/01/ipaddr 127.0.2.1
set /files/etc/hosts/01/canonical localhost2
set /files/etc/hosts/01/alias[1] testy
set /files/etc/hosts/01/alias[2] test
save
Note that this change is not idempotent, it will create a new entry at every run.