Bug 626452 - Pulp tests should not require root to run
Summary: Pulp tests should not require root to run
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: All
OS: Linux
low
high
Target Milestone: ---
: ---
Assignee: Jason Connor
QA Contact: wes hayutin
URL:
Whiteboard:
Depends On:
Blocks: verified-to-close
TreeView+ depends on / blocked
 
Reported: 2010-08-23 15:24 UTC by Jay Dobies
Modified: 2014-03-31 01:38 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-17 16:52:17 UTC
Embargoed:


Attachments (Terms of Use)

Description Jay Dobies 2010-08-23 15:24:15 UTC
When running tests as non-root, the following sorts of errors occur due to hardcoded paths:

======================================================================
ERROR: test_errata_repo_sync_rhel (test_errata.TestErrata)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jdob/vault/code/pulp/test/unit/test_errata.py", line 369,
in test_errata_repo_sync_rhel
    self.rapi.sync(r['id'])
  File
"/home/jdob/vault/code/pulp/test/unit/../../src/pulp/server/auditing.py", line
186, in _audit
    result = method(*args, **kwargs)
  File
"/home/jdob/vault/code/pulp/test/unit/../../src/pulp/server/api/repo.py", line
569, in sync
    added_packages, added_errataids = repo_sync.sync(repo, repo_source)
  File
"/home/jdob/vault/code/pulp/test/unit/../../src/pulp/server/api/repo_sync.py",
line 57, in sync
    repo_dir = synchronizer.sync(repo, repo_source)
  File
"/home/jdob/vault/code/pulp/test/unit/../../src/pulp/server/api/repo_sync.py",
line 296, in sync
    os.makedirs(repo_dir)
  File "/usr/lib64/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/lib/pulp/test_errata_repo_sync'



======================================================================
ERROR: test_sync (test_api.TestApi)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jdob/vault/code/pulp/test/unit/test_api.py", line 582, in
test_sync
    self.rapi.sync(repo['id'])
  File
"/home/jdob/vault/code/pulp/test/unit/../../src/pulp/server/auditing.py", line
186, in _audit
    result = method(*args, **kwargs)
  File
"/home/jdob/vault/code/pulp/test/unit/../../src/pulp/server/api/repo.py", line
569, in sync
    added_packages, added_errataids = repo_sync.sync(repo, repo_source)
  File
"/home/jdob/vault/code/pulp/test/unit/../../src/pulp/server/api/repo_sync.py",
line 57, in sync
    repo_dir = synchronizer.sync(repo, repo_source)
  File
"/home/jdob/vault/code/pulp/test/unit/../../src/pulp/server/api/repo_sync.py",
line 275, in sync
    yfetch.fetchYumRepo(config.get('paths', 'local_storage'))
  File "/home/jdob/vault/code/grinder/src/grinder/RepoFetch.py", line
199, in fetchYumRepo
    self.yumFetch.getRepoData()
  File "/home/jdob/vault/code/grinder/src/grinder/RepoFetch.py", line
110, in getRepoData
    os.makedirs(local_repo_path)
  File "/usr/lib64/python2.6/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib64/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/lib/pulp/some-id'

Comment 1 Jason Connor 2010-08-23 19:35:13 UTC
The config file was not being loaded on the initial test due to the quirks of python imports
The config file is now properly parsed (and the config object returned) *before* any tests are run
Added a section in the test override file to override the auditing logging as well

Comment 2 Preethi Thomas 2010-10-28 16:30:18 UTC
verified

[preethi@preethi unit]$ python test_consumer_history_api.py 
[preethi@preethi unit]$ python test_repo_sync_schedule.py 
[preethi@preethi unit]$ python test_role_check.py 
[2010-10-28 12:32:58.336341] SYSTEM called UserApi.create on login: test-admin
some_other_method executed
[2010-10-28 12:32:58.575460] SON([(u'_id', u'4b3f9fb0-1903-4d64-9853-0d7975decb2f'), (u'name', None), (u'_ns', u'users'), (u'login', u'test-admin'), (u'password', u'wC9iglAfSHo=,KjUz2ZFCXD9ZIeulZfPa6On7E8FX7EBZ7kg973wycGU='), (u'id', u'4b3f9fb0-1903-4d64-9853-0d7975decb2f')]) called UserApi.clean on 
.Admin certificate with CN [admin:pulpadmin:12345] is signed by a foreign CA
[2010-10-28 12:32:59.486622] None called UserApi.clean on 
.[2010-10-28 12:32:59.502524] SYSTEM called ConsumerApi.create on id: some-id-cert-test, description: desc, key_value_pairs: <type 'dict'> instance
some method executed
Checking ID in cert [some-id-cert-test] against expected ID [test_consumer_cert (__main__.TestRoleCheck)]
Checking ID in cert [some-id-cert-test] against expected ID [some-id-cert-test]
some_other_method3 executed
Checking ID in cert [some-id-cert-test] against expected ID [test_consumer_cert (__main__.TestRoleCheck)]
Checking ID in cert [some-id-cert-test] against expected ID [fake-consumer-uid]
Checking ID in cert [some-id-cert-test] against expected ID [baz]
Consumer with id [non-existing-consumer] does not exist
[2010-10-28 12:32:59.739510] None called UserApi.clean on 
.Consumer certificate with CN [localhost] is signed by a foreign CA
[2010-10-28 12:32:59.767775] SYSTEM called UserApi.clean on 
.[2010-10-28 12:32:59.782396] SYSTEM called UserApi.create on login: test_auth
Password for user [test_auth] was incorrect
User [non existing user] specified in certificate was not found in the system
some_other_method executed
[2010-10-28 12:33:00.019382] SON([(u'_id', u'31eb4667-be43-4ea6-b52e-beabc40eaa3f'), (u'name', None), (u'_ns', u'users'), (u'login', u'test_auth'), (u'password', u'Nvvg7be15kg=,IOZfOq0+2U8ywIWuYodrjZ2hewu1Lt80oeOGaMP4/1c='), (u'id', u'31eb4667-be43-4ea6-b52e-beabc40eaa3f')]) called UserApi.clean on 
.
----------------------------------------------------------------------
Ran 5 tests in 1.700s

OK
[preethi@preethi unit]$ 

[preethi@preethi unit]$ python test_tasks.py 
....................No handlers could be found for logger "pulp.server.tasking.task"
....
----------------------------------------------------------------------
Ran 24 tests in 1.016s

OK

Comment 3 Preethi Thomas 2011-02-17 16:52:17 UTC
Closing with community release 

pulp-0.0.139-1.fc14.noarch


Note You need to log in before you can comment on or make changes to this bug.