Remove get_ram_size_in_mb, get_number_of_vcpus, etc
get_ram_size_in_mb() is never used since the commit
Ia34d7c75ad05f7658d1abb7bebeb1bbd271fd089 when adding this method
at first time.
get_number_of_vcpus() is used in test_verify_created_server_vcpus
only in whole OpenStack projects. And the method just calls exec_command()
with a simple command. It is not necessary to define it as common method.
get_hostname() is used only in test_host_name_is_same_as_server_name
only in whole OpenStack projects. And the method just calls exec_command()
with a simple command. It is not necessary to define it as common method.
Before defining remote_client as stable interface, this patch removes the
methods for the cleanup.
NOTE: This removal affects to Tempest only without
any other projects.
Change-Id: I638055d728d7406cd5ad64ee13701ef826287dd0
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index fd5e50e..38dbb50 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -122,7 +122,8 @@
self.validation_resources['keypair']['private_key'],
server=self.server,
servers_client=self.client)
- self.assertEqual(flavor['vcpus'], linux_client.get_number_of_vcpus())
+ output = linux_client.exec_command('grep -c ^processor /proc/cpuinfo')
+ self.assertEqual(flavor['vcpus'], int(output))
@decorators.idempotent_id('ac1ad47f-984b-4441-9274-c9079b7a0666')
@testtools.skipUnless(CONF.validation.run_validation,
@@ -136,7 +137,7 @@
self.validation_resources['keypair']['private_key'],
server=self.server,
servers_client=self.client)
- hostname = linux_client.get_hostname()
+ hostname = linux_client.exec_command("hostname").rstrip()
msg = ('Failed while verifying servername equals hostname. Expected '
'hostname "%s" but got "%s".' % (self.name, hostname))
self.assertEqual(self.name.lower(), hostname, msg)
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 1487c1d..9bb2fce 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -99,20 +99,6 @@
"""
self.ssh_client.test_connection_auth()
- def get_hostname(self):
- # Get host name using command "hostname"
- actual_hostname = self.exec_command("hostname").rstrip()
- return actual_hostname
-
- def get_ram_size_in_mb(self):
- output = self.exec_command('free -m | grep Mem')
- if output:
- return output.split()[1]
-
- def get_number_of_vcpus(self):
- output = self.exec_command('grep -c ^processor /proc/cpuinfo')
- return int(output)
-
def get_disks(self):
# Select root disk devices as shown by lsblk
command = 'lsblk -lb --nodeps'
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 5be6229..1c5e89f 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -67,16 +67,6 @@
self.ssh_mock = self.useFixture(mockpatch.PatchObject(self.conn,
'ssh_client'))
- def test_get_hostname(self):
- self.ssh_mock.mock.exec_command.return_value = 'fake_hostname'
- self.assertEqual(self.conn.get_hostname(), 'fake_hostname')
-
- def test_get_ram_size(self):
- free_output = "Mem: 48294 45738 2555 0" \
- "402 40346"
- self.ssh_mock.mock.exec_command.return_value = free_output
- self.assertEqual(self.conn.get_ram_size_in_mb(), '48294')
-
def test_write_to_console_regular_str(self):
self.conn.write_to_console('test')
self._assert_exec_called_with(
@@ -102,11 +92,6 @@
cmd = "set -eu -o pipefail; PATH=$PATH:/sbin; " + cmd
self.ssh_mock.mock.exec_command.assert_called_with(cmd)
- def test_get_number_of_vcpus(self):
- self.ssh_mock.mock.exec_command.return_value = '16'
- self.assertEqual(self.conn.get_number_of_vcpus(), 16)
- self._assert_exec_called_with('grep -c ^processor /proc/cpuinfo')
-
def test_get_disks(self):
output_lsblk = """\
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT