agent: deduplicated testAgent by making it a convenience function to testAgentWithConfig.