'Check update volume stats.'

@mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSNFSDriver._ensure_shares_mounted')
def test_update_volume_stats(self, mock_ensure):

    mock_ensure.return_value = True
    fake_avail = (80 * units.Gi)
    fake_size = (2 * fake_avail)
    fake_used = (10 * units.Gi)
    with mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSNFSDriver._get_capacity_info', return_value=(fake_avail, fake_size, fake_used)):
        stats = self.driver.get_volume_stats()
        self.assertEqual('GPFSNFS', stats['volume_backend_name'])
        self.assertEqual('file', stats['storage_protocol'])
        stats = self.driver.get_volume_stats(True)
        self.assertEqual('GPFSNFS', stats['volume_backend_name'])
        self.assertEqual('file', stats['storage_protocol'])
