summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-06-27 10:44:02 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-07-25 12:32:34 +0200
commitac70c2cc5cf6434045dcb8c7f54b4b0b59873c47 (patch)
treebd28c5db08faf22d4f447f8e11e1fd3677e8dca3
parentdb8027407a1ef021d23ca0e8b38609a0a1805c08 (diff)
downloadfreeipa-ac70c2cc5cf6434045dcb8c7f54b4b0b59873c47.tar.gz
freeipa-ac70c2cc5cf6434045dcb8c7f54b4b0b59873c47.tar.xz
freeipa-ac70c2cc5cf6434045dcb8c7f54b4b0b59873c47.zip
Add more test tasks
- install_client - connect_replica - disconnect_replica - prepare_host - kinit_admin
-rw-r--r--ipatests/test_integration/base.py7
-rw-r--r--ipatests/test_integration/host.py2
-rw-r--r--ipatests/test_integration/tasks.py50
3 files changed, 42 insertions, 17 deletions
diff --git a/ipatests/test_integration/base.py b/ipatests/test_integration/base.py
index 4e8521dd9..86acbcce1 100644
--- a/ipatests/test_integration/base.py
+++ b/ipatests/test_integration/base.py
@@ -24,7 +24,7 @@ import os
import nose
from ipapython.ipa_log_manager import log_mgr
-from ipatests.test_integration.config import get_global_config, env_to_script
+from ipatests.test_integration.config import get_global_config
from ipatests.test_integration import tasks
from ipatests.order_plugin import ordered
@@ -74,10 +74,7 @@ class IntegrationTest(object):
@classmethod
def prepare_host(cls, host):
cls.log.info('Preparing host %s', host.hostname)
- env_filename = os.path.join(host.config.test_dir, 'env.sh')
- cls.collect_log(host, env_filename)
- host.mkdir_recursive(host.config.test_dir)
- host.put_file_contents(env_filename, env_to_script(host.to_env()))
+ tasks.prepare_host(host)
@classmethod
def install(cls):
diff --git a/ipatests/test_integration/host.py b/ipatests/test_integration/host.py
index 5647e0dc2..e3cc4c924 100644
--- a/ipatests/test_integration/host.py
+++ b/ipatests/test_integration/host.py
@@ -273,8 +273,6 @@ class Host(object):
else:
self.log.critical('No SSH credentials configured')
raise RuntimeError('No SSH credentials configured')
- # Clean up the test directory
- self.run_command(['rm', '-rvf', self.config.test_dir])
return transport
@property
diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 30252e3d8..ebdd0b813 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -25,10 +25,18 @@ import re
from ipapython import ipautil
from ipapython.ipa_log_manager import log_mgr
+from ipatests.test_integration.config import env_to_script
log = log_mgr.get_logger(__name__)
+def prepare_host(host):
+ env_filename = os.path.join(host.config.test_dir, 'env.sh')
+ host.collect_log(env_filename)
+ host.mkdir_recursive(host.config.test_dir)
+ host.put_file_contents(env_filename, env_to_script(host.to_env()))
+
+
def apply_common_fixes(host):
fix_etc_hosts(host)
fix_hostname(host)
@@ -93,6 +101,9 @@ def unapply_fixes(host):
restore_files(host)
restore_hostname(host)
+ # Clean up the test directory
+ host.run_command(['rm', '-rvf', host.config.test_dir])
+
def restore_files(host):
backupname = os.path.join(host.config.test_dir, 'file_backup')
@@ -147,8 +158,7 @@ def install_master(host):
enable_replication_debugging(host)
- host.run_command(['kinit', 'admin'],
- stdin_text=host.config.admin_password)
+ kinit_admin(host)
def install_replica(master, replica, setup_ca=True):
@@ -178,16 +188,36 @@ def install_replica(master, replica, setup_ca=True):
enable_replication_debugging(replica)
- replica.run_command(['kinit', 'admin'],
- stdin_text=replica.config.admin_password)
+ kinit_admin(replica)
+def install_client(master, client):
+ client.collect_log('/var/log/ipaclient-install.log')
-def connect_replica(master, replica=None):
- if replica is None:
- args = [replica.hostname, master.hostname]
- else:
- args = [master.hostname]
- replica.run_command(['ipa-replica-manage', 'connect'] + args)
+ apply_common_fixes(client)
+
+ client.run_command(['ipa-client-install', '-U',
+ '--domain', client.domain.name,
+ '--realm', client.domain.realm,
+ '-p', client.config.admin_name,
+ '-w', client.config.admin_password,
+ '--server', master.hostname])
+
+ kinit_admin(client)
+
+
+def connect_replica(master, replica):
+ kinit_admin(replica)
+ replica.run_command(['ipa-replica-manage', 'connect', master.hostname])
+
+
+def disconnect_replica(master, replica):
+ kinit_admin(replica)
+ replica.run_command(['ipa-replica-manage', 'disconnect', master.hostname])
+
+
+def kinit_admin(host):
+ host.run_command(['kinit', 'admin'],
+ stdin_text=host.config.admin_password)
def uninstall_master(host):