Skip to content

Commit

Permalink
suite: use owner value for user name
Browse files Browse the repository at this point in the history
  • Loading branch information
zmc committed Sep 23, 2024
1 parent 43b8805 commit f8e7b76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion teuthology/suite/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def __init__(self, args):
# We assume timestamp is a datetime.datetime object
self.timestamp = self.args.timestamp or \
datetime.datetime.now().strftime(TIMESTAMP_FMT)
self.user = self.args.user or pwd.getpwuid(os.getuid()).pw_name
if self.args.owner:
self.user = self.args.owner.split("@")[0]
else:
self.user = self.args.user or pwd.getpwuid(os.getuid()).pw_name

self.name = self.make_run_name()

Expand Down
8 changes: 8 additions & 0 deletions teuthology/suite/test/test_run_.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ def test_name_user(self, m_fetch_repos):
name = run.Run(self.args).name
assert name.startswith('USER-')

@patch('teuthology.suite.run.util.fetch_repos')
def test_name_owner(self, m_fetch_repos):
self.args.owner = 'USER'
with patch.object(run.Run, 'create_initial_config',
return_value=run.JobConfig()):
name = run.Run(self.args).name
assert name.startswith('USER-')

@patch('teuthology.suite.run.util.git_branch_exists')
@patch('teuthology.suite.run.util.package_version_for_hash')
@patch('teuthology.suite.run.util.git_ls_remote')
Expand Down

0 comments on commit f8e7b76

Please sign in to comment.