Tests Package

Utils Module

class HPCStats.Tests.Utils.HPCStatsTestCase(methodName='runTest')

Bases: unittest.case.TestCase

HPCStats.Tests.Utils.loadtestcase(testcase)

tests_ArchitectureImporterArchfile Module

class HPCStats.Tests.tests_ArchitectureImporterArchfile.TestsArchitectureImporterArchfileLoad(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp()
test_convert_freq()

ArchitectureImporterArchfile.convert_freq() should properly convert frequency string into float

test_convert_mem()

ArchitectureImporterArchfile.convert_mem() should properly convert memory string into integer

test_init()

ArchitectureImporterArchfile.__init__() runs w/o problem

test_load_1(*args, **keywargs)

ArchitectureImporterArchfile.load() works with simple data

test_load_missing_option(*args, **keywargs)

ArchitectureImporterArchfile.load() raise exception in one option is missing

test_load_missing_section(*args, **keywargs)

ArchitectureImporterArchfile.load() raise exception in one section is missing

class HPCStats.Tests.tests_ArchitectureImporterArchfile.TestsArchitectureImporterArchfileUpdate(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp(*args, **keywargs)
test_update()

ProjectImporterCSV.update() creates cluster and node if not existing

test_update_2()

ProjectImporterCSV.update() detect existing cluster and node

tests_BusinessCodeImporterCSV Module

class HPCStats.Tests.tests_BusinessCodeImporterCSV.TestsBusinessCodeImporterCSVLoad(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp()
test_init()

ProjectImporterCSV.__init__() runs w/o problem

test_load_1(*args, **keywargs)

BusinessCodeImporterCSV.load() works with simple data

test_load_business_empty_code(*args, **keywargs)

BusinessCodeImporterCSV.load() raise exception when business code is empty

test_load_business_empty_description(*args, **keywargs)

BusinessCodeImporterCSV.load() set description to None when empty.

test_load_invalid_line(*args, **keywargs)

BusinessCodeImporterCSV.load() raise exception when a business code line in CSV file is invalid

test_load_multiple_lines(*args, **keywargs)

BusinessCodeImporterCSV.load() works with multiple lines

class HPCStats.Tests.tests_BusinessCodeImporterCSV.TestsBusinessCodeImporterCSVUpdate(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp(*args, **keywargs)
test_update_exists()

ProjectImporterCSV.update() works when business code exists

test_update_exists_with_mock(*args, **keywargs)

ProjectImporterCSV.update() call Business.update() when business code exists

test_update_not_exists()

ProjectImporterCSV.update() works when business code does not exist

test_update_not_exists_with_mock(*args, **keywargs)

ProjectImporterCSV.update() call Business.save() when business code does not exist

tests_EventImporterSlurm Module

class HPCStats.Tests.tests_EventImporterSlurm.TestsEventImporterSlurm(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

init_load_data()

Utility method to initialize data to make load() simply.

setUp(*args, **keywargs)
test_init()

EventImporterSlurm.__init__() initializes w/o error

test_is_old_schema(*args, **keywargs)

EventImporterSlurm._is_old_schema() should return True is SlurmDBD <15.08 is detected, False otherwise.

test_load_invalid_tres(*args, **keywargs)

EventImporterSlurm.load() raises exception if invalid tres for an event is found

test_load_old_schema(*args, **keywargs)

EventImporterSlurm.load() works with simple data from old SlurmDBD <15.08 schema.

test_load_search_datetime(*args, **keywargs)

EventImporterSlurm.load() must search new events starting from correct datetime.

test_load_simple(*args, **keywargs)

EventImporterSlurm.load() works with simple data.

test_load_unfound_node(*args, **keywargs)

EventImporterSlurm.load() raises Exception if one event is linked to a node not loaded by ArchitectureImporter.

test_merge_successive_events(*args, **keywargs)

EventImporterSlurm.merge_successive_events() should merge successive events in the list if they are on the same node w/ same type.

test_txt_slurm_event_type(*args, **keywargs)

EventImporterSlurm.txt_slurm_event_type() should give the appropriate human readable string represation of an event type according to its hex bitmap value.

tests_HPCStatsArgumentParser Module

class HPCStats.Tests.tests_HPCStatsArgumentParser.TestsHPCStatsArgumentParser(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp()
test_import()

HPCStatsArgumentParser.parse_args() w/ import action

test_init()

HPCStatsArgumentParser.__init__() + add_args() run w/o problem

test_modify()

HPCStatsArgumentParser.parse_args() w/ modify action

test_modify_business_missing_desc()

HPCStatsArgumentParser.parse_args() raise exception when modify business code w/o description

test_modify_domain_missing_name()

HPCStatsArgumentParser.parse_args() raise exception when modify domain w/o name

test_modify_missing_param()

HPCStatsArgumentParser.parse_args() raise exception when the main param are missing

test_modify_params_mutually_exclusive()

HPCStatsArgumentParser.parse_args() raise exception in case of conflict w/ mutually exclusive main params

test_modify_project_conflict_params()

HPCStatsArgumentParser.parse_args() raise exception when modify project w/ conflicting params

test_modify_project_missing_param()

HPCStatsArgumentParser.parse_args() raise exception when modify project w/o param

test_report()

HPCStatsArgumentParser.parse_args() w/ report action

tests_HPCStatsImporter Module

class HPCStats.Tests.tests_HPCStatsImporter.TestsHPCStatsImporter(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp()
test_init()

HPCStatsImporter.__init__() run w/o problem

test_run(*args, **keywargs)

HPCStatsImporter.run() calls all importer load/update methods.

test_run_exception_no_hpcstatsdb()

HPCStatsImporter.run() raise exception when hpcstatsdb section is missing.

tests_JobImporterSlurm Module

class HPCStats.Tests.tests_JobImporterSlurm.TestsJobImporterSlurm(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

load_app()

Load App objects for JobImporterSlurm.load() normal operation.

setUp(*args, **keywargs)
test_init()

JobImporterSlurm.__init__() initializes object with attributes

test_is_old_schema(*args, **keywargs)

JobImporterSlurm._is_old_schema() should return True is SlurmDBD <15.08 is detected, False otherwise.

test_job_partition()

JobImporterSlurm.job_partition() must return correct partition for based on job partition list and its nodelist.

test_load(*args, **keywargs)

JobImporterSlurm.load() works with simple data.

test_load_account_not_found(*args, **keywargs)

JobImporterSlurm.load() raises exception when account not found

test_load_business_not_found(*args, **keywargs)

JobImporterSlurm.load() raises exception when business not found.

test_load_invalid_nodelist(*args, **keywargs)

JobImporterSlurm.load() raises exception when format of nodelist is invalid.

test_load_invalid_tres(*args, **keywargs)

JobImporterSlurm.load() raises exception if invalid tres for a job is found

test_load_invalid_wckey(*args, **keywargs)

JobImporterSlurm.load() raises exception when format of wckey is invalid.

test_load_node_not_found(*args, **keywargs)

JobImporterSlurm.load() does not create runs when node not found.

test_load_old_schema(*args, **keywargs)

JobImporterSlurm.load() works with simple data from old SlurmDBD <15.08 schema.

test_load_project_not_found(*args, **keywargs)

JobImporterSlurm.load() raises exception when project not found.

test_load_search_batchid(*args, **keywargs)

JobImporterSlurm.load() must search jobs after correct batch_id.

test_load_with_parts(*args, **keywargs)

JobImporterSlurm.load() works with simple data.

tests_ProjectImporterCSV Module

class HPCStats.Tests.tests_ProjectImporterCSV.TestsProjectImporterCSVLoad(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp()
test_init()

ProjectImporterCSV.__init__() runs w/o problem

test_load_1(*args, **keywargs)

ProjectImporterCSV.load() works with simple data

test_load_domain_empty_key(*args, **keywargs)

ProjectImporterCSV.load() raise exception when domain key is empty

test_load_domain_empty_name(*args, **keywargs)

ProjectImporterCSV.load() raise exception when domain name is empty

test_load_domain_invalid(*args, **keywargs)

ProjectImporterCSV.load() raise exception when domain format is invalid

test_load_duplicate_project(*args, **keywargs)

ProjectImporterCSV.load() raise Error when duplicate project codes found in CSV file

test_load_duplicate_sectors_domains(*args, **keywargs)

ProjectImporterCSV.load() does not create duplicate sectors and domains

test_load_multiple_lines(*args, **keywargs)

ProjectImporterCSV.load() works with multiple lines

class HPCStats.Tests.tests_ProjectImporterCSV.TestsProjectImporterCSVUpdate(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp(*args, **keywargs)
test_update()

ProjectImporterCSV.update() works with simple data

tests_UserImporterLdap Module

class HPCStats.Tests.tests_UserImporterLdap.TestsUserImporterLdap(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp(*args, **keywargs)
test_check_groups_alias_file(*args, **keywargs)

UserImporterLdap.check() should raise HPCStatsSourceError if groups_alias_file does not exist

test_init()

UserImporterLdap.__init__() initializes w/o error

test_load_groups_alias()

UserImporterLdap.load_groups_alias() tests

test_load_simple(*args, **keywargs)

UserImporterLdap.load() should work with simple data from LDAP.

test_load_simple2(*args, **keywargs)

UserImporterLdap.load() should work with simple data from LDAP and HPCStatsDB.

test_load_update_close_account(*args, **keywargs)

UserImporterLdap.update() close account found as unclosed in HPCStatsDB and not found in LDAP.

test_load_update_new_user_no_account(*args, **keywargs)

UserImporterLdap.update() save new user/account found in LDAP and not found in HPCStatsDB with a creation date equals to epoch because there is none existing accounts

test_load_update_new_user_other_accounts(*args, **keywargs)

UserImporterLdap.update() create new user/account found in LDAP and not found in HPCStatsDB with a creation date equals to today because there are already existing accounts.

test_load_update_user_closed_account(*args, **keywargs)

UserImporterLdap.update() update user found in LDAP and in HPCStatsDB with a closed account on the cluster.

test_load_update_user_w_account(*args, **keywargs)

UserImporterLdap.update() update user found in LDAP and in HPCStatsDB with an unclosed account on the cluster.

test_load_update_user_wo_account(*args, **keywargs)

UserImporterLdap.update() create account and update user found in LDAP and in HPCStatsDB but w/o account on the cluster.

test_load_user_no_dp_group(*args, **keywargs)

UserImporterLdap.load() should work with user having no secondary group.

tests_UserImporterLdapSlurm Module

class HPCStats.Tests.tests_UserImporterLdapSlurm.TestsUserImporterLdapSlurm(methodName='runTest')

Bases: HPCStats.Tests.Utils.HPCStatsTestCase

setUp(*args, **keywargs)
test_init()

UserImporterLdap.__init__() initializes w/o error

test_load_no_redundancy(*args, **keywargs)

UserImporterLdapSlurm.load() should manage redundancy with LDAP.

test_load_user_in_group(*args, **keywargs)

UserImporterLdapSlurm.load() should not load user from Slurm if already loaded because it is member of cluster group.

test_load_user_no_ldap(*args, **keywargs)

UserImporterLdapSlurm.load() should not user from Slurm if not found in LDAP.

test_load_user_ok_ldap(*args, **keywargs)

UserImporterLdapSlurm.load() should load user from Slurm if also found in LDAP.

test_update_new_user(*args, **keywargs)

UserImporterLdapSlurm.slurm() should save the user and the account if not existing in DB

test_update_user_account_exist(*args, **keywargs)

UserImporterLdapSlurm.slurm() should update the user and do not touch the account if they already exist in DB