Coverage for lbCVMFSTools/TaskHandlers/NightliesInstallTask/tests/TestCVMFSConf.py : 84%

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
############################################################################### # (c) Copyright 2016 CERN # # # # This software is distributed under the terms of the GNU General Public # # Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # # # # In applying this licence, CERN does not waive the privileges and immunities # # granted to it by virtue of its status as an Intergovernmental Organization # # or submit itself to any jurisdiction. # ############################################################################### Test of the version path manager functionality in the model classes.
@author: Stefan-Gabriel CHITIC '''
import NightliesInstallTask SlotsManager, PathManager, InstalledManager
shutil.rmtree("/tmp/toto") shutil.rmtree("/tmp/foo/")
"/tmp/toto/cvmfstest.cern.ch/nightlies/slot1/1235/.installed", 'w') as f: installArea="/tmp/toto/cvmfstest.cern.ch/nightlies", workspace="/tmp/foo/") 'afs': [], 'cvmfs': [ {'slot': 'slot1', 'build_id': 1235, 'platform': 'centos7_x64_opt', 'completed': True}, {'slot': 'slot2', 'build_id': 1243, 'platform': 'centos7_x64_opt', 'completed': False}, {'slot': 'slot1', 'build_id': 1235, 'platform': 'centos7_x86_opt', 'completed': False}, ]} # Mock Suprocess :
# Test with all slots not install c['completed'])) self.assertEqual(todos, parsed_slots)
# Mark 1 slot as installed c['platform'])]) self.assertEqual(todos, parsed_slots)
# Mark all as completed, check log c['platform'])]) "skipping" % (c['slot'], c['build_id'], c['platform'])) sorted(self.handler.messages['info']))
self.manager = NightliesInstallTask(dry_run=True)
todos = self.manager.get_list_of_tasks()
# Perform 1 installation self.manager.perform_task(todos[0]) 'IN DRY-RUN MODE: Need to fix the links for slot1 1235', 'IN DRY-RUN MODE: Updating slot1 1235 centos7_x64_opt', 'IN DRY-RUN MODE: Invoking: lbn-install ' '--dest=/tmp/toto/cvmfstest.cern.ch/' 'nightlies/slot1/1235 --platforms=centos7_x64_opt slot1 1235', 'IN DRY-RUN MODE: Install has changed - copying list of ' 'installed tars'] self.assertEqual(logs, self.handler.messages['info'])
todos = self.manager.get_list_of_tasks()
# Perform 1 installation self.manager.perform_task(todos[0]) 'Need to fix the links for slot1 1235', 'Updating slot1 1235 centos7_x64_opt', 'Invoking: lbn-install --dest=/tmp/toto/cvmfstest.cern.ch/' 'nightlies/slot1/1235 --platforms=centos7_x64_opt slot1 1235', 'Install has changed - copying list of installed tars'] self.handler.messages['info'] = [] # Perform the same installation, should fail self.assertRaises(Exception, self.manager.perform_task, todos[0]) 'Updating slot1 1235 centos7_x64_opt', 'Invoking: lbn-install --dest=/tmp/toto/cvmfstest.cern.ch/' 'nightlies/slot1/1235 --platforms=centos7_x64_opt slot1 1235', 'No new files to install - aborting transaction'] self.assertEqual(logs, self.handler.messages['info'])
todos = self.manager.get_list_of_tasks()
# Perform 1 installation with error self.manager.perform_task(todos[0]) 'Need to fix the links for slot1 1235', 'Updating slot1 1235 centos7_x64_opt', 'Invoking: lbn-install --dest=/tmp/toto/cvmfstest.cern.ch/' 'nightlies/slot1/1235 --platforms=centos7_x64_opt slot1 1235', 'Installation problem. Ignoring to avoid transaction rollback', 'Install has changed - copying list of installed tars'] sorted(self.handler.messages['info'])) 'lbn-install --dest=/tmp/toto/cvmfstest.cern.ch/' 'nightlies/slot1/1235 --platforms=centos7_x64_opt ' 'slot1 1235')
if __name__ == "__main__": unittest.main() |