The operatingsystem fact on Fedora begins in a uppercase F
The error being thrown by this on Fedora was being silently ignored added regex for this Also adding adding a unit test for this Adding the effected module to pep8 tests Change-Id: I4e4d72e6de0bce597474434a4e18112f79913718
This commit is contained in:
@@ -14,12 +14,17 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class TestCase(TestCase):
|
||||
def setUp(self):
|
||||
pass
|
||||
# Creating a temp directory that can be used by tests
|
||||
self.tempdir = tempfile.mkdtemp()
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
# remove the temp directory
|
||||
shutil.rmtree(self.tempdir)
|
||||
|
||||
@@ -14,9 +14,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
from test import TestCase
|
||||
|
||||
from packstack.modules.ospluginutils import gethostlist
|
||||
from packstack.modules.ospluginutils import gethostlist, \
|
||||
validate_puppet_logfile, \
|
||||
PackStackError
|
||||
|
||||
|
||||
class OSPluginUtilsTestCase(TestCase):
|
||||
@@ -26,3 +29,19 @@ class OSPluginUtilsTestCase(TestCase):
|
||||
hosts = gethostlist(conf)
|
||||
hosts.sort()
|
||||
self.assertEquals(['1.1.1.1', '2.2.2.2', '3.3.3.3'], hosts)
|
||||
|
||||
def test_validate_puppet_logfile(self):
|
||||
filename = os.path.join(self.tempdir, "puppet.log")
|
||||
fp = open(filename, "w")
|
||||
fp.write("Everything went ok")
|
||||
fp.close()
|
||||
|
||||
validate_puppet_logfile(filename)
|
||||
|
||||
def test_validate_puppet_logfile_error(self):
|
||||
filename = os.path.join(self.tempdir, "puppet.log")
|
||||
fp = open(filename, "w")
|
||||
fp.write("No matching value for selector param 'Fedora' ...")
|
||||
fp.close()
|
||||
|
||||
self.assertRaises(PackStackError, validate_puppet_logfile, filename)
|
||||
|
||||
Reference in New Issue
Block a user