Skip to content

Commit

Permalink
backend: add test-case for CoprDir's BuildJob.chroot_dir
Browse files Browse the repository at this point in the history
Relates: #3527
  • Loading branch information
praiskup committed Jan 6, 2025
1 parent ee2d176 commit fbe8a68
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/tests/test_background_worker_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,3 +884,10 @@ def test_task_url(f_build_rpm_case):
worker.job = _get_rpm_job_object(worker.opts)
assert worker.job.task_url == \
"http://copr-fe/backend/get-build-task/848963-fedora-30-x86_64"

def test_buildjob_chroot_dir(f_build_rpm_case):
config = f_build_rpm_case
worker = config.bw
job_dict = copy.deepcopy(testlib.VALID_SUBPROJECT_PRM_JOB)
job = BuildJob(job_dict, worker.opts)
assert job.chroot_dir.endswith("copr-pull-requests:pr:3568/fedora-40-x86_64")
44 changes: 44 additions & 0 deletions backend/tests/testlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,50 @@ def minimal_be_config(where, overrides=None):
}


VALID_SUBPROJECT_PRM_JOB = {
'allow_user_ssh': False,
'appstream': False,
'background': True,
'build_id': 8466805,
'buildroot_pkgs': [],
'chroot': 'fedora-40-x86_64',
'enable_net': False,
'fedora_review': False,
'git_hash': 'e66537b2058cba5eb4f034aa3b7486bb7dd41c46',
'git_repo': 'https://copr-dist-git.fedorainfracloud.org/git'
'/@copr/copr-pull-requests:pr:3568/copr-frontend',
'isolation': 'default',
'memory_reqs': 2048,
'package_name': 'copr-frontend',
'package_version': '2.1-1.git.57.186407c',
'project_dirname': 'copr-pull-requests:pr:3568',
'project_name': 'copr-pull-requests',
'project_owner': '@copr',
'repo_priority': None,
'repos': [{'baseurl': 'https://download.copr.fedorainfracloud.org/results/'
'@copr/copr-pull-requests/fedora-40-x86_64/',
'id': 'copr_base',
'name': 'Copr repository',
'priority': None},
{'baseurl': 'https://download.copr.fedorainfracloud.org'
'/results/@copr/copr-dev/fedora-40-x86_64/',
'id': 'copr_copr_copr_dev',
'name': 'Additional repo copr_copr_copr_dev'}],
'sandbox': '@copr/copr-pull-requests--ddf1880c-45a5-4627-a025-43ae696008f2',
'source_json': {},
'source_type': None,
'ssh_public_keys': None,
'storage': None,
'submitter': None,
'tags': [],
'task_id': '8466805-fedora-40-x86_64',
'timeout': 18000,
'uses_devel_repo': False,
'with_opts': [],
'without_opts': [],
}


VALID_SRPM_JOB = {
"build_id": 855954,
"chroot": None,
Expand Down

0 comments on commit fbe8a68

Please sign in to comment.