Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# 

2# LSST Data Management System 

3# Copyright 2008-2012 LSST Corporation. 

4# 

5# This product includes software developed by the 

6# LSST Project (http://www.lsst.org/). 

7# 

8# This program is free software: you can redistribute it and/or modify 

9# it under the terms of the GNU General Public License as published by 

10# the Free Software Foundation, either version 3 of the License, or 

11# (at your option) any later version. 

12# 

13# This program is distributed in the hope that it will be useful, 

14# but WITHOUT ANY WARRANTY; without even the implied warranty of 

15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

16# GNU General Public License for more details. 

17# 

18# You should have received a copy of the LSST License Statement and 

19# the GNU General Public License along with this program. If not, 

20# see <http://www.lsstcorp.org/LegalNotices/>. 

21# 

22import unittest 

23import os.path 

24from lsst.ctrl.execute.condorConfig import CondorConfig 

25import lsst.utils.tests 

26 

27 

28def setup_module(module): 

29 lsst.utils.tests.init() 

30 

31 

32class TestCondorConfig(lsst.utils.tests.TestCase): 

33 def setUp(self): 

34 self.config = CondorConfig() 

35 

36 def test1(self): 

37 self.assertIsNone(self.config.platform.defaultRoot) 

38 self.assertIsNone(self.config.platform.localScratch) 

39 self.assertIsNone(self.config.platform.dataDirectory) 

40 self.assertIsNone(self.config.platform.fileSystemDomain) 

41 self.assertIsNone(self.config.platform.eupsPath) 

42 self.assertIsNone(self.config.platform.defaultRoot) 

43 self.assertIsNone(self.config.platform.setup_using) 

44 self.assertIsNone(self.config.platform.scheduler) 

45 

46 def test2(self): 

47 path = os.path.join("tests", "testfiles", "config_condor.py") 

48 self.config.load(path) 

49 

50 self.assertEqual(self.config.platform.defaultRoot, "/usr") 

51 self.assertEqual(self.config.platform.localScratch, "./tests/condor_scratch_condor") 

52 self.assertEqual(self.config.platform.dataDirectory, "/tmp/data_condor") 

53 self.assertEqual(self.config.platform.fileSystemDomain, "lsstcorp.org") 

54 self.assertEqual(self.config.platform.eupsPath, "/var/tmp") 

55 self.assertEqual(self.config.platform.scheduler, "pbs") 

56 self.assertEqual(self.config.platform.manager, "dagman") 

57 self.assertIsNone(self.config.platform.setup_using) 

58 

59 def test3(self): 

60 path = os.path.join("tests", "testfiles", "config_condor_getenv.py") 

61 self.config.load(path) 

62 

63 self.assertEqual(self.config.platform.defaultRoot, "/usr") 

64 self.assertEqual(self.config.platform.localScratch, "./tests/condor_scratch") 

65 self.assertEqual(self.config.platform.dataDirectory, "/tmp/data") 

66 self.assertEqual(self.config.platform.fileSystemDomain, "lsstcorp.org") 

67 self.assertEqual(self.config.platform.eupsPath, "/var/tmp") 

68 self.assertEqual(self.config.platform.scheduler, "pbs") 

69 self.assertEqual(self.config.platform.setup_using, "getenv") 

70 self.assertEqual(self.config.platform.manager, "dagman") 

71 

72 def test4(self): 

73 path = os.path.join("tests", "testfiles", "config_condor_setups.py") 

74 self.config.load(path) 

75 

76 self.assertEqual(self.config.platform.defaultRoot, "/usr") 

77 self.assertEqual(self.config.platform.localScratch, "./tests/condor_scratch") 

78 self.assertEqual(self.config.platform.dataDirectory, "/tmp/data") 

79 self.assertEqual(self.config.platform.fileSystemDomain, "lsstcorp.org") 

80 self.assertEqual(self.config.platform.eupsPath, "/var/tmp") 

81 self.assertEqual(self.config.platform.scheduler, "pbs") 

82 self.assertEqual(self.config.platform.setup_using, "setups") 

83 self.assertEqual(self.config.platform.manager, "dagman") 

84 

85 def test5(self): 

86 path = os.path.join("tests", "testfiles", "config_condor_slurm.py") 

87 self.config.load(path) 

88 

89 self.assertEqual(self.config.platform.defaultRoot, "/usr") 

90 self.assertEqual(self.config.platform.localScratch, "./tests/condor_scratch_slurm") 

91 self.assertEqual(self.config.platform.dataDirectory, "/tmp/data_slurm") 

92 self.assertEqual(self.config.platform.fileSystemDomain, "lsstcorp.org") 

93 self.assertEqual(self.config.platform.eupsPath, "/var/tmp") 

94 self.assertEqual(self.config.platform.scheduler, "slurm") 

95 self.assertEqual(self.config.platform.setup_using, "getenv") 

96 self.assertEqual(self.config.platform.manager, "dagman") 

97 

98 def test6(self): 

99 path = os.path.join("tests", "testfiles", "config_pegasus.py") 

100 self.config.load(path) 

101 

102 self.assertEqual(self.config.platform.defaultRoot, "/mount2/condor_work") 

103 self.assertEqual(self.config.platform.localScratch, "/mount1/scratch") 

104 self.assertEqual(self.config.platform.dataDirectory, "/datasets") 

105 self.assertEqual(self.config.platform.fileSystemDomain, "lsstcorp.org") 

106 self.assertEqual(self.config.platform.eupsPath, "/var/tmp") 

107 self.assertEqual(self.config.platform.scheduler, "slurm") 

108 self.assertEqual(self.config.platform.setup_using, "getenv") 

109 self.assertEqual(self.config.platform.manager, "pegasus") 

110 

111 

112class CondorConfigMemoryTest(lsst.utils.tests.MemoryTestCase): 

113 pass 

114 

115 

116if __name__ == "__main__": 116 ↛ 117line 116 didn't jump to line 117, because the condition on line 116 was never true

117 lsst.utils.tests.init() 

118 unittest.main()