From: Russell Bryant <rbryant(a)redhat.com>
I set up a new VM for development with the hostname of "matahari-dev"
and it was failing. This patch expands upon the regex in the unit test
to make it match more valid hostnames.
Signed-off-by: Russell Bryant <rbryant(a)redhat.com>
---
src/tests/mh_api_host.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/tests/mh_api_host.h b/src/tests/mh_api_host.h
index 4786255..00287ca 100644
--- a/src/tests/mh_api_host.h
+++ b/src/tests/mh_api_host.h
@@ -57,8 +57,9 @@ class MhApiHostSuite : public CxxTest::TestSuite
{
infomsg << "Verify " << mh_host_get_hostname() <<
" format";
TS_TRACE(infomsg.str());
- TS_ASSERT((mh_test_is_match("^([0-9a-zA-Z]+([\\.]|$)){1,3}$",
- mh_host_get_hostname())) >= 0);
+ /*
http://stackoverflow.com/questions/1418423/the-hostname-regex */
+
TS_ASSERT((mh_test_is_match("^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|\\b-){0,61}[0-9A-Za-z])?(?:\\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|\\b-){0,61}[0-9A-Za-z])?)*\\.?$",
+ mh_host_get_hostname())) >= 0);
infomsg.str("");
}
--
1.7.6