Coverage for tests/test_condorConfig.py: 21%

78 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-05-01 16:26 -0700

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 os.path 

23import unittest 

24 

25import lsst.utils.tests 

26from lsst.ctrl.execute.condorConfig import CondorConfig 

27 

28 

29def setup_module(module): 

30 lsst.utils.tests.init() 

31 

32 

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

34 def setUp(self): 

35 self.config = CondorConfig() 

36 

37 def test1(self): 

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

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

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

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

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

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

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

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

46 

47 def test2(self): 

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

49 self.config.load(path) 

50 

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

52 self.assertEqual( 

53 self.config.platform.localScratch, "./tests/condor_scratch_condor" 

54 ) 

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

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

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

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

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

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

61 

62 def test3(self): 

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

64 self.config.load(path) 

65 

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

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

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

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

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

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

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

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

74 

75 def test4(self): 

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

77 self.config.load(path) 

78 

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

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

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

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

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

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

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

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

87 

88 def test5(self): 

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

90 self.config.load(path) 

91 

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

93 self.assertEqual( 

94 self.config.platform.localScratch, "./tests/condor_scratch_slurm" 

95 ) 

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

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

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

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

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

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

102 

103 def test6(self): 

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

105 self.config.load(path) 

106 

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

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

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

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

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

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

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

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

115 

116 

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

118 pass 

119 

120 

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

122 lsst.utils.tests.init() 

123 unittest.main()