From 668b86cba412aa7f320ecb0d68b254250e051223 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Thu, 31 Dec 2009 23:19:22 -0800 Subject: [PATCH] Fix issue 36. Give each unit test a fresh configuration context - helps tests pass when a config file is passed in, which can mess up the "expected" output, as this is testing loading values into the configuration system. --- src/conf-yaml-loader.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/conf-yaml-loader.c b/src/conf-yaml-loader.c index 89e02b43fc..3eb62d5bd1 100644 --- a/src/conf-yaml-loader.c +++ b/src/conf-yaml-loader.c @@ -302,6 +302,9 @@ rule-files:\n\ default-log-dir: /tmp\n\ "; + ConfCreateContextBackup(); + ConfInit(); + ConfNode *node; ConfYamlLoadString(input, strlen(input)); node = ConfGetNode("rule-files"); @@ -326,6 +329,9 @@ default-log-dir: /tmp\n\ i++; } + ConfDeInit(); + ConfRestoreContextBackup(); + return 1; } @@ -342,6 +348,9 @@ logging:\n\ log-level: info\n\ "; + ConfCreateContextBackup(); + ConfInit(); + ConfYamlLoadString(input, strlen(input)); ConfNode *outputs; @@ -393,6 +402,9 @@ logging:\n\ if (strcmp(output_param->val, "info") != 0) return 0; + ConfDeInit(); + ConfRestoreContextBackup(); + return 1; }