#1787 raise error when config search paths is empty
Merged 2 years ago by tkopecek. Opened 2 years ago by julian8628.
julian8628/koji issue/1786  into  master

file modified
+3 -2
@@ -1776,8 +1776,9 @@ 

                      result[name] = value

  

      # Check if the specified profile had a config specified

-     if config.sections() and not got_conf:

-         raise ConfigurationError("no configuration for profile name: %s" % profile_name)

+     if not got_conf:

+         raise ConfigurationError("no configuration for profile name: %s"

+                                  % profile_name)

  

      # special handling for cert defaults

      cert_defaults = {

@@ -3,8 +3,8 @@ 

  import sys

  import threading

  import traceback

+ import mock

  from six.moves import range

- import six

  

  try:

      import unittest2 as unittest
@@ -17,7 +17,7 @@ 

          """ Test that profiles thread safe"""

          # see: https://pagure.io/koji/issue/58 and https://pagure.io/pungi/issue/253

          # loop a few times to increase chances of hitting race conditions

-         for i in range(20):

+         for i in range(256):

              errors = {}

              threads = [threading.Thread(target=stress, args=(errors, _)) for _ in range(100)]

              for t in threads:
@@ -34,7 +34,8 @@ 

  def stress(errors, n):

      errors[n] = "Failed to start"

      try:

-         koji.get_profile_module('koji')

+         config = mock.Mock(topdir='topdir')

+         koji.get_profile_module('koji', config=config)

      except Exception:

          # if we don't catch this, nose seems to ignore the test

          errors[n] = ''.join(traceback.format_exception(*sys.exc_info()))

also fix unittest: test_profiles

notes: since the test won't read config files anymore, lift the loop number from 20 -> 256 to increase the probability of hitting the multithread issue

fixes: #1786

Is this two separate changes?

I don't think so. The test fails with this change

What I mean is that there is no explanation in the commit log about why we bump from 20 to 256 here.

rebased onto 0fd8e8beb431e29dbbbb8a1865ff564edc74965a

2 years ago

rebased onto 74065fa

2 years ago

Metadata Update from @julian8628:
- Pull-request tagged with: testing-ready

2 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

2 years ago

Commit 8f0efe8 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago