(#22992) Correct wrong exit code when testing state.yaml

Additionally removes an old typo
Merge branch 'samyboy-master'

* samyboy-master:
  (#22992) Correct wrong exit code when testing state.yaml

Closes GH-2014