Plugins download & install fine, wordpress update fails

To update wordpress define following constant in your wp-config.php file

define('FS_METHOD', 'direct');
define( 'FS_CHMOD_DIR', 0777 );
define( 'FS_CHMOD_FILE', 0777 );
define('FTP_BASE', '/var/www/test/');//project directory
define('FTP_CONTENT_DIR', '/var/www/test/wp-content/'); //define wp-content directory path
define('FTP_PLUGIN_DIR ', '/var/www/test/wp-content/plugins/'); //define plugins directory path
define( 'WP_AUTO_UPDATE_CORE', true );
//define ftp details
define('FTP_USER', 'test');
define('FTP_PASS', 'test@123');
define('FTP_HOST', 'ftp.test.com');

Hope this will help you to sort out your problem.