I like the idea of expanding test coverage. However, this unit test
will always fail if someone doesn't have puppet installed, which
shouldn't be required just to do matahari builds.
The only thing I can think to do in the short term is to make this test
only run if the build system determines that puppet is installed.
Otherwise, I'd rather it just not go in.
Longer term, I think this sort of test is a bit too large to be a unit
test, and should be covered in a suite of functional tests that aren't
run automatically when building Matahari. This falls under the test
infrastructure design task that is currently on my todo list.
--
Russell Bryant
On 08/30/2011 03:50 PM, Adam Stokes wrote:
- Force the override of existing key's to make
sure we are performing our tests as if from
scratch
Signed-off-by: Adam Stokes<astokes(a)fedoraproject.org>
---
src/tests/mh_api_sysconfig.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/tests/mh_api_sysconfig.h b/src/tests/mh_api_sysconfig.h
index 73c1d76..11711cc 100644
--- a/src/tests/mh_api_sysconfig.h
+++ b/src/tests/mh_api_sysconfig.h
@@ -26,14 +26,16 @@ class MhApiSysconfigSuite : public CxxTest::TestSuite
void testIsConfigured(void)
{
const char *uri = "http://matahariproject.org/atom.xml"; // Test if
download succeeds
- const char flags = 0;
+ const char flags = MH_SYSCONFIG_FLAG_FORCE;
const char key[] = "org.matahariproject.test.unittest"; //
Unimportant key defined
+ const char run_string[] = "file { \"/etc/sudoers\":\n owner
=> root, group => root, mode => 440\n}";
mh_sysconfig_keys_dir_set("/tmp/");
TS_ASSERT((mh_sysconfig_set_configured(key, "OK")) == TRUE);
TS_ASSERT((mh_sysconfig_is_configured(key)) != NULL);
TS_ASSERT((mh_sysconfig_run_uri(uri, flags, "puppet", key)) != -1);
+ TS_ASSERT((mh_sysconfig_run_string(run_string, flags, "puppet", key))
!= -1);
}
};