Fix deprecation warnings on libserialize tests

Fixes #20278