Fix metadata_server_port to return proper port

Also make it more testable by allowing an optional path to be passed in
Add tests for cfn_helper.metadata_server_port