tests/logsv/README                                |  12 ++++
 tests/logsv/tet_LogOiOps.c                        |  64 +++++++++++++++++++++++
 tools/cluster_sim_uml/uml/root_template/etc/group |   1 +
 3 files changed, 77 insertions(+), 0 deletions(-)


    3 new TCs have been added to LOG OI test suite:

        - CCB Object Modify, data group. Group does not exist. Not allowed
        - CCB Object Modify, data group. Group exists. OK
        - CCB Object Modify, delete data group. OK

diff --git a/tests/logsv/README b/tests/logsv/README
new file mode 100644
--- /dev/null
+++ b/tests/logsv/README
@@ -0,0 +1,12 @@
+This directory tree contains a unit test suite for LOG service. The goal is
+to test the API extensively. Checking all possible error conditions etc.
+
+From the ticket #1181, 3 new TCs have been added to the test suite:
+- CCB Object Modify, data group. Group does not exist. Not allowed
+- CCB Object Modify, data group. Group exists. OK
+- CCB Object Modify, delete data group. OK
+
+The second TC tries to set the data group to "log-data" group.
+In order to help the TC passed, "log-data" group must be existing and be added
+to supplementary group list of the user as which LOGSV is running.
+Otherwise that TC will be skipped.
diff --git a/tests/logsv/tet_LogOiOps.c b/tests/logsv/tet_LogOiOps.c
--- a/tests/logsv/tet_LogOiOps.c
+++ b/tests/logsv/tet_LogOiOps.c
@@ -24,6 +24,9 @@
 #include <saf_error.h>
 #include "logtest.h"
 
+#define opensaf_user "opensaf"
+#define data_group "log-data"
+
 static SaLogFileCreateAttributesT_2 appStreamLogFileCreateAttributes =
 {
     .logFilePathName = DEFAULT_APP_FILE_PATH_NAME,
@@ -954,6 +957,64 @@ void saLogOi_48(void)
 }
 
 /**
+ * CCB Object Modify, data group. Group does not exist. Not allowed
+ * Result shall be reject
+ */
+void saLogOi_79(void)
+{
+    int rc;
+    char command[256];
+
+    sprintf(command, "immcfg -a logDataGroupname=dummyGroup 
logConfig=1,safApp=safLogService > /dev/null 2>&1");
+    rc = system(command);
+    rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * CCB Object Modify, data group. Group exist. OK
+ * Result shall be OK
+ */
+void saLogOi_80(void)
+{
+    int rc;
+    char command[256];
+#ifndef RUNASROOT
+    /**
+     * OpenSAF is running under opensaf user
+     * Check if log-data is a supplementary group of that user
+     */
+    sprintf(command, "groups %s | grep %s > /dev/null", opensaf_user, 
data_group);
+#else
+    /* OpenSAF is running under root user */
+    sprintf(command, "groups root | grep %s > /dev/null", data_group);
+#endif
+
+    rc = system(command);
+    if (rc != 0) {
+       fprintf(stderr, "Data group %s is currently not a primary group of 
LOGSV. Skip this TC.\n", data_group);
+       rc = 0;
+    } else {
+       sprintf(command, "immcfg -a logDataGroupname=%s 
logConfig=1,safApp=safLogService > /dev/null 2>&1", data_group);
+       rc = system(command);
+    }
+    rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * CCB Object Modify, delete data group. OK
+ * Result shall be OK
+ */
+void saLogOi_81(void)
+{
+    int rc;
+    char command[256];
+
+    sprintf(command, "immcfg -a logDataGroupname= 
logConfig=1,safApp=safLogService > /dev/null 2>&1");
+    rc = system(command);
+    rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
  * CCB Object Modify, logMaxLogrecsize. Not allowed
  * Result, Reject
  */
@@ -1956,6 +2017,9 @@ void saLogOi_115(void)
     test_suite_add(5, "LOG OI tests, Service configuration object");
     test_case_add(5, saLogOi_52, "CCB Object Modify, root directory. Path does 
not exist. Not allowed");
     test_case_add(5, saLogOi_48, "CCB Object Modify, root directory. Path 
exist. OK");
+    test_case_add(5, saLogOi_79, "CCB Object Modify, data group. Group does 
not exist. Not allowed");
+    test_case_add(5, saLogOi_80, "CCB Object Modify, data group. Group exists. 
OK");
+    test_case_add(5, saLogOi_81, "CCB Object Modify, delete data group. OK");
     test_case_add(5, saLogOi_53, "CCB Object Modify, logMaxLogrecsize. Not 
allowed");
     test_case_add(5, saLogOi_54, "CCB Object Modify, logStreamSystemHighLimit 
> logStreamSystemLowLimit. OK");
     test_case_add(5, saLogOi_55, "CCB Object Modify, logStreamSystemHighLimit 
= logStreamSystemLowLimit, != 0. Ok");
diff --git a/tools/cluster_sim_uml/uml/root_template/etc/group 
b/tools/cluster_sim_uml/uml/root_template/etc/group
--- a/tools/cluster_sim_uml/uml/root_template/etc/group
+++ b/tools/cluster_sim_uml/uml/root_template/etc/group
@@ -5,3 +5,4 @@ user2::1002:user2
 user3::1003:user3
 user4::1004:user4
 user5::1005:user5
+log-data::1006:opensaf, root

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to