[otrs-cvs] UnitTest/bin UnitTestAutoSetup.pl,1.259,1.260

"CVS commits notifications of OTRS.org" <[email protected]> Thu, 4 Apr 2013 09:27:37 +0000
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/UnitTest/bin
In directory lancelot:/tmp/cvs-serv28609/bin

Modified Files:
	UnitTestAutoSetup.pl 
Log Message:
Run unit tests as non-root.

Author: mb

Index: UnitTestAutoSetup.pl
===================================================================
RCS file: /home/cvs/UnitTest/bin/UnitTestAutoSetup.pl,v
retrieving revision 1.259
retrieving revision 1.260
diff -2 -u -d -r1.259 -r1.260
--- UnitTestAutoSetup.pl	3 Apr 2013 15:30:15 -0000	1.259
+++ UnitTestAutoSetup.pl	4 Apr 2013 09:27:32 -0000	1.260
@@ -729,4 +729,9 @@
 }
 
+# system preparation
+# create unit test user
+my $UnitTestUser = 'otrs';
+system "useradd $UnitTestUser -d /opt/otrs -c 'Unit Test User' -g $Enviroment{apache}->{Group}";
+
 # check lock file
 if ( -e '/tmp/UnitTestAutoSetup.lock' ) {
@@ -1354,11 +1359,11 @@
         # setup config
         print STDOUT "NOTICE: config setup\n";
-        system( $Scenario->{RebuildConfig} )           && next SCENARIO;
-        system( $Scenario->{CheckSum} . ' -a create' ) && next SCENARIO;
-        system( $Scenario->{CheckDB} )                 && next SCENARIO;
+        system("su - $UnitTestUser -c '$Scenario->{RebuildConfig}'")      && next SCENARIO;
+        system("su - $UnitTestUser -c '$Scenario->{CheckSum} -a create'") && next SCENARIO;
+        system("su - $UnitTestUser -c '$Scenario->{CheckDB}'")            && next SCENARIO;
 
         # set file permissions
         system(
-            "/opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=$Enviroment{apache}->{User} --web-user=$Enviroment{apache}->{User} --otrs-group=$Enviroment{apache}->{Group} --web-group=$Enviroment{apache}->{Group} /opt/otrs"
+            "/opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=$UnitTestUser --web-user=$Enviroment{apache}->{User} --otrs-group=$Enviroment{apache}->{Group} --web-group=$Enviroment{apache}->{Group} /opt/otrs"
         );
 
@@ -1413,5 +1418,5 @@
             # build package manager command
             my $Command
-                = "$Scenario->{PackageManager} -a $Action -p '$Package->{URL}'";
+                = "su - $UnitTestUser -c '$Scenario->{PackageManager} -a $Action -p $Package->{URL}'";
 
             # enable force mode
@@ -1444,5 +1449,5 @@
 
                 system(
-                    "$Scenario->{UnitTest} -n '$PackageTestsString' -p '$Scenario->{Name}'"
+                    "su - $UnitTestUser -c \"$Scenario->{UnitTest} -n '$PackageTestsString' -p '$Scenario->{Name}'\""
                     )
                     && next SCENARIO;
@@ -1452,5 +1457,5 @@
             else {
                 system(
-                    "$Scenario->{UnitTest} -p '$Scenario->{Name}'"
+                    "su - $UnitTestUser -c \"$Scenario->{UnitTest} -p '$Scenario->{Name}'\""
                 ) && next SCENARIO;
             }
@@ -1463,5 +1468,5 @@
                 print STDOUT "NOTICE: uninstall $Package->{URL}\n";
                 system(
-                    "$Scenario->{PackageManager} -a uninstall -p '$Package->{URL}'"
+                    "su - $UnitTestUser -c \"$Scenario->{PackageManager} -a uninstall -p '$Package->{URL}'\""
                 );
             }
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log