cli test failures when ~/.ubuntu-ci does not exist (isolation issue)

Bug #1287686 reported by Vincent Ladeuil
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu CI Engine
Fix Released
Low
Ursula Junque
Ubuntu CI Services
Fix Released
Low
Ursula Junque

Bug Description

While setting my laptop with trunk @ revno 302, I encounter the following failures:

======================================================================
ERROR: test_cli_changes_file_is_something_else (tests.test_cli.MainScriptTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/tests/test_cli.py", line 274, in test_cli_changes_file_is_something_else
    self.cli.main(args, log=logger)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/tests/../ubuntu-ci", line 113, in main
    utils.load_config(DEF_CFG)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/ci_libs/utils.py", line 56, in load_config
    sys.exit(error_msg.format(config_file, "\n ".join(r), sys.argv[0]))
SystemExit: ERROR: Missing YAML config in /home/vila/.ubuntu-ci:
 ci_url
 auth_url
 auth_user
 auth_password
 auth_region
 auth_tenant_name

This can be created by running: ./cli/setup.py auto_config

======================================================================
ERROR: test_cli_changes_file_is_unreleased (tests.test_cli.MainScriptTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/tests/test_cli.py", line 292, in test_cli_changes_file_is_unreleased
    self.cli.main(args, log=logger)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/tests/../ubuntu-ci", line 113, in main
    utils.load_config(DEF_CFG)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/ci_libs/utils.py", line 56, in load_config
    sys.exit(error_msg.format(config_file, "\n ".join(r), sys.argv[0]))
SystemExit: ERROR: Missing YAML config in /home/vila/.ubuntu-ci:
 ci_url
 auth_url
 auth_user
 auth_password
 auth_region
 auth_tenant_name

This can be created by running: ./cli/setup.py auto_config

======================================================================
ERROR: test_cli_dsc_file_in_disguise (tests.test_cli.MainScriptTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/tests/test_cli.py", line 256, in test_cli_dsc_file_in_disguise
    self.cli.main(args, log=logger)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/tests/../ubuntu-ci", line 113, in main
    utils.load_config(DEF_CFG)
  File "/home/vila/ci/ubuntu-ci-services-itself/trunk/cli/ci_libs/utils.py", line 56, in load_config
    sys.exit(error_msg.format(config_file, "\n ".join(r), sys.argv[0]))
SystemExit: ERROR: Missing YAML config in /home/vila/.ubuntu-ci:
 ci_url
 auth_url
 auth_user
 auth_password
 auth_region
 auth_tenant_name

This can be created by running: ./cli/setup.py auto_config

----------------------------------------------------------------------
Ran 48 tests in 0.237s

FAILED (errors=3)

The tests should not rely on the existence (or content) of a file under user control but create one suiting their need.

This an edge case we can fix later.

Tags: airline

Related branches

Revision history for this message
Ursula Junque (ursinha) wrote :

I created a function to actually mock this so tests don't require the ~/.ubuntu-ci file to exist, not sure why these tests aren't using this though. I'll investigate.

Ursula Junque (ursinha)
Changed in ubuntu-ci-services-itself:
status: Confirmed → In Progress
status: In Progress → Fix Committed
Ursula Junque (ursinha)
Changed in ubuntu-ci-services-itself:
status: Fix Committed → In Progress
Ursula Junque (ursinha)
Changed in ubuntu-ci-services-itself:
status: In Progress → Fix Released
Changed in ubuntu-ci-services-itself:
milestone: backlog → phase-0
Ursula Junque (ursinha)
Changed in uci-engine:
assignee: nobody → Ursula Junque (ursinha)
importance: Undecided → Low
milestone: none → phase-0
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.