diff --git a/test/testsuite/castortests/resources/castor/tags.py b/test/testsuite/castortests/resources/castor/tags.py index 72edf67ad0af853edac604980c2be8a69e6cb9b0..cb26138a16ae80c75dd79f89258bcf7f22f9e538 100644 --- a/test/testsuite/castortests/resources/castor/tags.py +++ b/test/testsuite/castortests/resources/castor/tags.py @@ -25,7 +25,6 @@ def _setFileClass(self, path, fileclass): assert len(output) == 0, \ 'Failed to set FileClass ' + fileclass + \ ' on directory ' + path + os.linesep + "Error :" + os.linesep + output - return path Setup._setFileClass = _setFileClass def _addACLforUnprivUser(self, path): @@ -41,14 +40,14 @@ def _addACLforUnprivUser(self, path): assert len(output) == 0, \ 'Failed to set ACLs for user ' + self.options.get('Tags', 'unprivUid') + \ ' on working directory ' + path + os.linesep + "Error :" + os.linesep + output - return path Setup._addACLforUnprivUser = _addACLforUnprivUser def _configuredPath(self, test, fileclass): # create the directory and configure it - path = self._createDir(self.getTag(test, '_testSessionPath') + os.sep + test) - path = self._setFileClass(path, fileclass) - path = self._addACLforUnprivUser(path) + path, created = self._createDir(self.getTag(test, '_testSessionPath') + os.sep + test) + if created: + self._setFileClass(path, fileclass) + self._addACLforUnprivUser(path) return path Setup._configuredPath = _configuredPath diff --git a/test/testsuite/castortests/resources/ns/tags.py b/test/testsuite/castortests/resources/ns/tags.py index d54d978dbb69e1198a17bacb700261d8ec0a243b..3970d4b5a908901daeca4d91b8a89428d717423a 100644 --- a/test/testsuite/castortests/resources/ns/tags.py +++ b/test/testsuite/castortests/resources/ns/tags.py @@ -24,17 +24,20 @@ def _createDir(self, path): # create the path in the namespace output = Popen('nsmkdir ' + path) # check it went fine - assert len(output) == 0 or output.find('File exists'), \ + assert len(output) == 0 or output.find('File exists') >= 0, \ 'Failed to create working directory ' + path + os.linesep + "Error :" + os.linesep + output # return the created dir - return path + if output.find('File exists') >= 0: + return (path, False) + else: + return (path, True) Setup._createDir = _createDir def _testSessionPath(self): # get the test path testpath = self.options.get('Generic','CastorTestDir') # create a unique directory - return self._createDir(testpath + os.sep + self.getTag(None, 'sessionuuid')) + return self._createDir(testpath + os.sep + self.getTag(None, 'sessionuuid'))[0] Setup.getTag__testSessionPath = _testSessionPath def nsDir(self): @@ -42,7 +45,7 @@ def nsDir(self): Setup.getTag_nsDir = nsDir def nsFile(self, nb=0): - return (lambda test : self._createDir(self.getTag(test, 'nsDir')) + \ + return (lambda test : self._createDir(self.getTag(test, 'nsDir'))[0] + \ os.sep + test + str(nb)) Setup.getTag_nsFile = nsFile