Skip to content

Commit

Permalink
Test trusted ipa
Browse files Browse the repository at this point in the history
Signed-off-by: Anuja More <[email protected]>
  • Loading branch information
amore17 committed Aug 29, 2024
1 parent b56d434 commit cb9b696
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .freeipa-pr-ci.yaml
5 changes: 3 additions & 2 deletions doc/designs/prci_checker.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ classes:
- "RunPytest2"
- "RunPytest3"
- "RunWebuiTests"
- "RunADTests"
- "`RunADTests`"
- "RunMultiDomainPytest"

# (Optional) Definition files that should contain the same number of jobs
fixed_n_jobs:
Expand Down Expand Up @@ -182,7 +183,7 @@ $ python3 ipatests/prci_definitions/prci_checker.py -f ipatests/prci_definitions
BEGINNING PRCI JOB DEFINITIONS CHECKS
[File] gating [Jobs] 24
ERROR: In job 'fedora-latest/test_installation_TestInstallMaster':
'class' field should be defined with one of the supported: ['RunPytest', 'RunPytest2', 'RunPytest3', 'RunWebuiTests', 'RunADTests']
'class' field should be defined with one of the supported: ['RunPytest', 'RunPytest2', 'RunPytest3', 'RunWebuiTests', 'RunADTests', 'RunMultiDomainPytest']
CHECKS FINISHED WITH ERRORS
```

Expand Down
1 change: 1 addition & 0 deletions ipatests/prci_definitions/prci_jobs_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ classes:
- "RunPytest3"
- "RunWebuiTests"
- "RunADTests"
- "RunMultiDomainPytest"

# (Optional) Definition files that should contain the same number of jobs
fixed_n_jobs:
Expand Down
11 changes: 8 additions & 3 deletions ipatests/prci_definitions/temp_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ topologies:
name: ad_master_1repl_1client
cpu: 6
memory: 12096
2master_2client: &2master_2client
name: 2master_2client
cpu: 4
memory: 7750

jobs:
fedora-latest/build:
Expand All @@ -69,10 +73,11 @@ jobs:
requires: [fedora-latest/build]
priority: 50
job:
class: RunPytest
class: RunMultiDomainPytest
args:
build_url: '{fedora-latest/build_url}'
test_suite: test_integration/test_REPLACEME.py
test_suite: test_integration/test_trusted_ipa.py
trusted_domain: True
template: *ci-master-latest
timeout: 3600
topology: *master_1repl_1client
topology: *2master_2client
163 changes: 111 additions & 52 deletions ipatests/pytest_ipa/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,45 +386,79 @@ def mh(request, class_integration_logs):
"""
cls = request.cls

domain_description = {
'type': 'IPA',
'hosts': {
'master': 1,
'replica': cls.num_replicas,
'client': cls.num_clients,
},
}
domain_description['hosts'].update(
{role: 1 for role in cls.required_extra_roles})

domain_descriptions = [domain_description]
for _i in range(cls.num_ad_domains):
domain_descriptions.append({
'type': 'AD',
'hosts': {'ad': 1}
})
for _i in range(cls.num_ad_subdomains):
domain_descriptions.append({
'type': 'AD_SUBDOMAIN',
'hosts': {'ad_subdomain': 1}
})
for _i in range(cls.num_ad_treedomains):
domain_descriptions.append({
'type': 'AD_TREEDOMAIN',
'hosts': {'ad_treedomain': 1}
})

mh = make_multihost_fixture(
request,
domain_descriptions,
config_class=Config,
_config=get_global_config(),
)

mh.domain = mh.config.domains[0]
[mh.master] = mh.domain.hosts_by_role('master')
mh.replicas = mh.domain.hosts_by_role('replica')
mh.clients = mh.domain.hosts_by_role('client')
if cls.num_trusted_domains == 1:
mh = make_multihost_fixture(request, descriptions=[
{
'type': 'IPA',
'hosts':
{
'master': 1,
'replica': cls.num_replicas,
'client': cls.num_clients,
}
},
{
'type': 'TRUSTED_IPA',
'hosts':
{
'trusted_master': 1,
'trusted_replica': cls.num_trusted_replicas,
'trusted_client': cls.num_trusted_clients,

},
},
], config_class=Config, _config=get_global_config(),)
else:
domain_description = {
'type': 'IPA',
'hosts': {
'master': 1,
'replica': cls.num_replicas,
'client': cls.num_clients,
},
}
domain_description['hosts'].update(
{role: 1 for role in cls.required_extra_roles})

domain_descriptions = [domain_description]
for _i in range(cls.num_ad_domains):
domain_descriptions.append({
'type': 'AD',
'hosts': {'ad': 1}
})
for _i in range(cls.num_ad_subdomains):
domain_descriptions.append({
'type': 'AD_SUBDOMAIN',
'hosts': {'ad_subdomain': 1}
})
for _i in range(cls.num_ad_treedomains):
domain_descriptions.append({
'type': 'AD_TREEDOMAIN',
'hosts': {'ad_treedomain': 1}
})
mh = make_multihost_fixture(
request,
domain_descriptions,
config_class=Config,
_config=get_global_config(),
)
if cls.num_trusted_domains == 1:
mh.domain1 = mh.config.domains[0]
mh.domain2 = mh.config.domains[1]

[mh.master] = mh.domain1.hosts_by_role('master')
mh.replicas = mh.domain1.hosts_by_role('replica')
mh.clients = mh.domain1.hosts_by_role('client')
[mh.trusted_master] = mh.domain2.hosts_by_role('trusted_master')
mh.trusted_replicas = mh.domain2.hosts_by_role('trusted_replica')
mh.trusted_clients = mh.domain2.hosts_by_role('trusted_client')
else:
mh.domain = mh.config.domains[0]
[mh.master] = mh.domain.hosts_by_role('master')
mh.replicas = mh.domain.hosts_by_role('replica')
mh.clients = mh.domain.hosts_by_role('client')

ad_domains = mh.config.ad_domains
if ad_domains:
mh.ads = []
Expand Down Expand Up @@ -477,11 +511,21 @@ def add_compat_attrs(cls, mh):
This is deprecated in favor of the mh fixture.
To be removed when no more tests using this.
"""
cls.domain = mh.domain
cls.master = mh.master
cls.replicas = mh.replicas
cls.clients = mh.clients
cls.ad_domains = mh.config.ad_domains
if cls.num_trusted_domains == 1:
cls.domain1 = mh.domain1
cls.domain2 = mh.domain2
cls.master = mh.master
cls.replicas = mh.replicas
cls.clients = mh.clients
cls.trusted_master = mh.trusted_master
cls.trusted_replicas = mh.trusted_replicas
cls.trusted_clients = mh.trusted_clients
cls.ad_domains = mh.config.ad_domains
else:
cls.domain = mh.domain
cls.master = mh.master
cls.replicas = mh.replicas
cls.clients = mh.clients
if cls.ad_domains:
cls.ads = mh.ads
cls.ad_subdomains = mh.ad_subdomains
Expand All @@ -494,15 +538,30 @@ def del_compat_attrs(cls):
This is deprecated in favor of the mh fixture.
To be removed when no more tests using this.
"""
del cls.master
del cls.replicas
del cls.clients
del cls.domain
if cls.ad_domains:
del cls.ads
del cls.ad_subdomains
del cls.ad_treedomains
del cls.ad_domains
if cls.num_trusted_domains == 1:
del cls.master
del cls.replicas
del cls.clients
del cls.trusted_master
del cls.trusted_replicas
del cls.trusted_clients
del cls.domain1
del cls.domain2
if cls.ad_domains:
del cls.ads
del cls.ad_subdomains
del cls.ad_treedomains
del cls.ad_domains
else:
del cls.master
del cls.replicas
del cls.clients
del cls.domain
if cls.ad_domains:
del cls.ads
del cls.ad_subdomains
del cls.ad_treedomains
del cls.ad_domains


def skip_if_fips(reason='Not supported in FIPS mode', host='master'):
Expand Down
24 changes: 22 additions & 2 deletions ipatests/pytest_ipa/integration/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_all_hosts(self):
yield host

def get_all_ipa_hosts(self):
for ipa_domain in (d for d in self.domains if d.is_ipa_type):
for ipa_domain in (d for d in self.domains if d.is_ipa_type or d.is_trusted_ipa_type):
for ipa_host in ipa_domain.hosts:
yield ipa_host

Expand Down Expand Up @@ -135,14 +135,18 @@ def __init__(self, config, name, domain_type):
self.name = str(name)
self.hosts = []

assert self.is_ipa_type or self.is_ad_type
assert self.is_ipa_type or self.is_ad_type or self.is_trusted_ipa_type
self.realm = self.name.upper()
self.basedn = DN(*(('dc', p) for p in name.split('.')))

@property
def is_ipa_type(self):
return self.type == 'IPA'

@property
def is_trusted_ipa_type(self):
return self.type == 'TRUSTED_IPA'

@property
def is_ad_type(self):
return self.type == 'AD' or self.type.startswith('AD_')
Expand All @@ -158,6 +162,8 @@ def static_roles(self):
return ('ad_subdomain',)
elif self.type == 'AD_TREEDOMAIN':
return ('ad_treedomain',)
elif self.type == 'TRUSTED_IPA':
return ('trusted_master', 'trusted_replica', 'trusted_client')
else:
raise LookupError(self.type)

Expand All @@ -168,13 +174,19 @@ def get_host_class(self, host_dict):
return Host
elif self.is_ad_type:
return WinHost
elif self.is_trusted_ipa_type:
return Host
else:
raise LookupError(self.type)

@property
def master(self):
return self.host_by_role('master')

@property
def trusted_master(self):
return self.host_by_role('trusted_master')

@property
def masters(self):
return self.hosts_by_role('master')
Expand All @@ -183,10 +195,18 @@ def masters(self):
def replicas(self):
return self.hosts_by_role('replica')

@property
def trusted_replicas(self):
return self.hosts_by_role('trusted_replica')

@property
def clients(self):
return self.hosts_by_role('client')

@property
def trusted_clients(self):
return self.hosts_by_role('trusted_client')

@property
def ads(self):
return self.hosts_by_role('ad')
Expand Down
3 changes: 3 additions & 0 deletions ipatests/test_integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
class IntegrationTest:
num_replicas = 0
num_clients = 0
num_trusted_replicas = 0
num_trusted_clients = 0
num_ad_domains = 0
num_trusted_domains = 0
num_ad_subdomains = 0
num_ad_treedomains = 0
required_extra_roles = []
Expand Down
Loading

0 comments on commit cb9b696

Please sign in to comment.