job.test package

Subpackages

Submodules

job.test.test_clock module

class job.test.test_clock.TestClock(methodName='runTest')

Bases: django.test.testcases.TestCase

Tests functions in the clock module.

setUp()
test_check_rule(*args, **keywargs)

Tests a valid rule triggers a new event.

test_check_rule_event_type_error()

Tests checking a rule with an event type configuration problem.

test_check_rule_last_event(*args, **keywargs)

Tests a valid rule checks the most recent matching event type.

test_check_rule_name_error()

Tests checking a rule with a name configuration problem.

test_check_rule_schedule_error()

Tests checking a rule with a schedule configuration problem.

test_check_rule_skip(*args, **keywargs)

Tests a valid rule does not trigger a new event when the schedule threshold has not been met.

test_check_schedule_day_drift(*args, **keywargs)

Tests checking a schedule for once a day without slowly drifting away from the target time.

test_check_schedule_day_exact(*args, **keywargs)

Tests checking a schedule for once a day.

test_check_schedule_day_first(*args, **keywargs)

Tests checking a daily schedule that was never triggered before and is due now.

test_check_schedule_day_last(*args, **keywargs)

Tests checking a daily schedule that was triggered before and is due now.

test_check_schedule_day_last_skip(*args, **keywargs)

Tests checking a daily schedule that was triggered before and is not due.

test_check_schedule_day_recover(*args, **keywargs)

Tests checking a schedule to recover after being down for several days.

test_check_schedule_hour_drift_min(*args, **keywargs)

Tests checking a schedule for once an hour without slowly drifting away from the target time.

test_check_schedule_hour_exact(*args, **keywargs)

Tests checking a schedule for once an hour.

test_check_schedule_hour_first(*args, **keywargs)

Tests checking an hourly schedule that was never triggered before and is due now.

test_check_schedule_hour_first_skip(*args, **keywargs)

Tests checking an hourly schedule that was never triggered before and is not due.

test_check_schedule_hour_last(*args, **keywargs)

Tests checking an hourly schedule that was triggered before and is due now.

test_check_schedule_hour_last_skip(*args, **keywargs)

Tests checking an hourly schedule that was triggered before and is not due.

test_check_schedule_hour_recover(*args, **keywargs)

Tests checking a schedule to recover after being down for several hours.

test_multiple_processors()

Tests running multiple processors for the same trigger rule.

test_perform_tick(*args, **keywargs)

Tests performing a single clock tick.

test_perform_tick_error(*args, **keywargs)

Tests performing a clock tick will continue even when rules fail.

test_perform_tick_skip(*args, **keywargs)

Tests performing a single clock tick with rules that should be skipped.

test_trigger_event_first()

Tests triggering a new event the first time for a rule.

test_trigger_event_last()

Tests triggering a new event after the rule has processed an event previously.

job.test.test_models module

class job.test.test_models.TestJob(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()
test_get_seed_job_results()

Test retrieving job results from a Seed job type

class job.test.test_models.TestJobManager(methodName='runTest')

Bases: django.test.testcases.TransactionTestCase

test_process_job_input()

Tests calling JobManager.process_job_input()

test_process_job_output()

Tests calling JobManager.process_job_output()

test_queue_job_timestamps()

Tests that job attributes are updated when a job is queued.

test_queue_superseded_jobs()

Tests that JobManager.update_jobs_to_queued() does not queue superseded jobs

test_superseded_job()

Tests creating a job that supersedes another job

class job.test.test_models.TestJobType(methodName='runTest')

Bases: django.test.testcases.TransactionTestCase

setUp()
test_get_job_version_array()
test_get_seed_cpu_resource_from_seed_interface()
test_get_seed_disk_resource_from_seed_interface()
test_get_seed_mem_resource_from_seed_interface()
test_get_seed_sharedmem_resource_from_seed_interface()
class job.test.test_models.TestJobTypeFailedStatus(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()
test_successful()

Tests calling the get_failed_jobs_with_system_errors method on JobManager.

class job.test.test_models.TestJobTypeRevision(methodName='runTest')

Bases: django.test.testcases.TransactionTestCase

setUp()
test_revision_get_input_interface()
test_revision_get_output_interface()
class job.test.test_models.TestJobTypeRunningStatus(methodName='runTest')

Bases: django.test.testcases.TestCase

setUp()
test_successful()

Tests calling the get_running_job_status method on JobExecutionManager.

class job.test.test_models.TestJobTypeTagManager(methodName='runTest')

Bases: django.test.testcases.TransactionTestCase

setUp()
test_clear_job_type_tags()

Tests calling JobTypeManager.clear_job_type_tags()

test_create_job_type_tags()

Tests calling JobTypeManager.create_job_type_tags()

job.test.test_views module

class job.test.test_views.TestCancelJobsViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_cancel(*args, **keywargs)

Tests calling the job cancel view successfully

test_cancel_invalid(*args, **keywargs)

Tests calling the job cancel view with an invalid jobtype name/version

class job.test.test_views.TestGetAuthDisabledJobsView(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_success_on_post(*args, **keywargs)

Tests success when posting to the jobs view with authentication.

test_successful_on_get()

Tests successfully retrieving jobs without authentication.

test_unathenticated_on_post(*args, **keywargs)

Tests for failure when posting to the jobs view with authentication.

class job.test.test_views.TestJobDetailsViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_successful_empty()

Tests successfully calling the job details view with no data or results.

test_successful_execution()

Tests successfully calling the job details view and checking the execution response.

test_successful_resources()

Tests successfully calling the job details view for resources.

test_superseded()

Tests successfully calling the job details view for superseded jobs.

class job.test.test_views.TestJobExecutionDetailsViewV6(methodName='runTest')

Bases: rest_framework.test.APITransactionTestCase

api = u'v6'
setUp()
test_get_job_execution_bad_exe_num()
test_get_job_execution_for_job_exe_id()
class job.test.test_views.TestJobExecutionSpecificLogViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_bad_job_exe_id()
test_combined_log_html_no_time(*args, **keywargs)
test_combined_log_json_no_content(*args, **keywargs)
test_combined_log_json_no_time(*args, **keywargs)
test_combined_log_json_with_time(*args, **keywargs)
test_combined_log_text_no_time(*args, **keywargs)
test_stderr_log_html_no_time(*args, **keywargs)
test_stdout_log_html_no_time(*args, **keywargs)
class job.test.test_views.TestJobExecutionsViewV6(methodName='runTest')

Bases: rest_framework.test.APITransactionTestCase

api = u'v6'
setUp()
test_get_job_execution_bad_id()
test_get_job_execution_filter_error()
test_get_job_execution_filter_node()
test_get_job_execution_filter_status()
test_get_job_executions()

This test checks to make sure there are 4 job executions.

class job.test.test_views.TestJobInputFilesViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_bad_file_name()

Tests unsuccessfully calling the get files by name view

test_file_name_successful()

Tests successfully calling the get files by name view

test_filter_job_input()

Tests successfully calling the job inputs files view with job_input string filtering

test_successful_file()

Tests successfully calling the job input files view

test_time_successful()

Tests unsuccessfully calling the get files by name view

class job.test.test_views.TestJobTypeDetailsViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_edit_bad_configuration()

Tests passing an invalid configuration of a job type to the patch interface

test_edit_configuration()

Tests editing the configuration of a job type

test_edit_manifest()

Tests editing the manifest of a job type

test_edit_not_found()

Tests calling the get job type details view with a job name/version that does not exist.

test_edit_simple(*args, **keywargs)

Tests editing only the basic attributes of a job type

test_edit_warnings(*args, **keywargs)

Tests deprecating a job type and getting warnings

test_not_found()

Tests calling the get job type details view with a job name/version that does not exist.

test_successful()

Tests successfully calling the get job type details view.

class job.test.test_views.TestJobTypeNamesViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_id()

Tests successfully calling the job types view filtered by id.

test_is_active()

Tests successfully calling the job types view filtered by inactive state.

test_is_system()

Tests successfully calling the job types view filtered by system status.

test_keyword()

Tests successfully calling the job types view filtered by keyword.

test_successful()

Tests successfully calling the get all job types view.

class job.test.test_views.TestJobTypeRevisionsViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_details_not_found()

Tests successfully calling the get job type revision details view with a job type revision that does not exist.

test_not_found()

Tests successfully calling the get job type revisions view with a job type that does not exist.

test_successful_details()

Tests successfully calling the get job type revision details view.

test_successful_list()

Tests successfully calling the get job type revisions view.

class job.test.test_views.TestJobTypesPendingView(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_successful()

Tests successfully calling the pending status view.

class job.test.test_views.TestJobTypesPostViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_add_seed_job_type()

Tests adding a seed image.

test_add_seed_job_type_minimum_manifest()

Tests adding a Seed image with a minimum Seed manifest

test_add_seed_version_job_type()

Tests adding a new version of a seed image.

test_create_seed_bad_param()

Tests creating a job type with invalid type fields.

test_create_seed_missing_mount()

Tests creating a new seed job type with a mount referenced in configuration but not interface.

test_create_seed_missing_param()

Tests creating a seed job type with missing fields.

test_create_seed_missing_setting()

Tests creating a new seed job type with a setting referenced in configuration but not interface.

test_create_seed_partial_gpu_resource()

Tests creating a job type with partial GPU resource.

test_create_seed_secrets()

Tests creating a new seed job type with secrets.

test_create_seed_validation()

Tests creating a job type with the name ‘validation’.

test_edit_seed_job_type()

Tests editing an existing seed job type.

test_edit_seed_job_type_and_update(*args, **keywargs)

Tests editing an existing seed job type and automatically updating recipes.

class job.test.test_views.TestJobTypesRunningView(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_successful()

Tests successfully calling the running status view.

class job.test.test_views.TestJobTypesStatusView(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_active()

Tests successfully filtering the job types status view by is_active.

test_active_and_date_range()

Tests successfully filtering the job types status view by is_active and start/end.

test_date_range()

Tests successfully filtering the job types status view by start/end.

test_successful()

Tests successfully calling the job types status view.

class job.test.test_views.TestJobTypesSystemFailuresView(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_successful()

Tests successfully calling the system failures view.

class job.test.test_views.TestJobTypesValidationViewV6(methodName='runTest')

Bases: rest_framework.test.APITransactionTestCase

Tests related to the job-types validation endpoint

api = u'v6'
setUp()
test_bad_error()

Tests validating a new job type with an invalid error relationship.

test_bad_param()

Tests validating a new job type with missing fields.

test_deprecated_output_workspace()

Tests validating a new job type with an inactive output workspace.

test_empty_media()

Tests validating a new job type with media types not specified

test_empty_output_successful()

Tests validating a new job type without outputs

test_invalid_output_workspace()

Tests validating a new job type with an invalid output workspace.

test_missing_mount()

Tests validating a new job type with a mount referenced in manifest but not configuration.

test_missing_output_workspace()

Tests validating a new job type with a missing output workspace.

test_missing_setting()

Tests validating a new job type with a setting referenced in manifest but not configuration.

test_nonstandard_resource()

Tests validating a new job type with a nonstandard resource.

test_secret_setting()

Tests validating a new job type with a secret setting.

test_successful()

Tests validating a new job type.

test_successful_configuration()

Tests validating a new job type with a valid configuration.

test_unknown_mount()

Tests validating a new job type with a mount referenced in configuration but not manifest.

test_unknown_setting()

Tests validating a new job type with a setting referenced in configuration but not manifest.

class job.test.test_views.TestJobTypesViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_id()

Tests successfully calling the job types view filtered by id.

test_is_active()

Tests successfully calling the job types view filtered by inactive state.

test_is_system()

Tests successfully calling the job types view filtered by system status.

test_keyword()

Tests successfully calling the job types view filtered by keyword.

test_successful()

Tests successfully calling the get all job types view.

test_version_is_active()

Tests successfully calling the job type versions view filtered by inactive state.

test_version_successful()

Tests successfully calling the job type versions view.

class job.test.test_views.TestJobsPostViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_invalid_configuration()

Tests successfully calling POST jobs view to queue a new job with a job type configuration

test_invalid_data()

Tests successfully calling POST jobs view to queue a new job with invalid input data

test_successful(*args, **keywargs)

Tests successfully calling POST jobs view to queue a new job

test_successful_configuration(*args, **keywargs)

Tests successfully calling POST jobs view to queue a new job with a job type configuration

class job.test.test_views.TestJobsViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_batch()

Tests filtering jobs by batch

test_error_category()

Tests successfully calling the jobs view filtered by error category.

test_error_id()

Tests successfully calling the jobs view filtered by error id.

test_job_id()

Tests successfully calling the jobs view filtered by job identifier.

test_job_type_id()

Tests successfully calling the jobs view filtered by job type identifier.

test_job_type_name()

Tests successfully calling the jobs view filtered by job type name.

test_jobs_successful()

Tests the v6/jobs/<job_id>/ api call for success

test_order_by()

Tests successfully calling the jobs view with sorting.

test_recipe()

Tests filtering jobs by recipe

test_source_collection()

Tests successfully calling the jobs view filtered by source collection.

test_source_sensor()

Tests successfully calling the jobs view filtered by source sensor.

test_source_sensor_class()

Tests successfully calling the jobs view filtered by source sensor class.

test_source_task()

Tests successfully calling the jobs view filtered by source task.

test_source_time_successful()

Tests successfully calling the get jobs by source time

test_status()

Tests successfully calling the jobs view filtered by status.

test_successful()

Tests successfully calling the jobs view.

test_superseded()

Tests getting superseded jobs.

class job.test.test_views.TestRequeueJobsViewV6(methodName='runTest')

Bases: rest_framework.test.APITestCase

api = u'v6'
setUp()
test_requeue(*args, **keywargs)

Tests calling the requeue view successfully

test_requeue_invalid(*args, **keywargs)

Tests calling the job requeue view with an invalid jobtype name/version

job.test.utils module

Defines utility methods for testing jobs and job types

job.test.utils.create_clock_event(rule=None, occurred=None)

Creates a scale clock trigger event model for unit testing

Returns:The trigger event model
Return type:trigger.models.TriggerEvent
job.test.utils.create_clock_rule(name=None, rule_type=u'CLOCK', event_type=None, schedule=u'PT1H0M0S', is_active=True)

Creates a scale clock trigger rule model for unit testing

Returns:The trigger rule model
Return type:trigger.models.TriggerRule
job.test.utils.create_input_file(job=None, input_file=None, job_input=None, file_name=u'my_test_file.txt', media_type=u'text/plain', file_size=100, file_path=None, workspace=None, countries=None, is_deleted=False, data_type_tags=[], last_modified=None, source_started=None, source_ended=None)

Creates a Scale file and job input file model for unit testing

Returns:The file model
Return type:storage.models.ScaleFile
job.test.utils.create_job(job_type=None, event=None, status=u'PENDING', error=None, input=None, num_exes=1, max_tries=None, node=None, queued=None, started=None, ended=None, last_status_change=None, priority=100, output=None, job_config=None, superseded_job=None, is_superseded=False, superseded=None, input_file_size=10.0, recipe=None, save=True)

Creates a job model for unit testing

Returns:The job model
Return type:job.models.Job
job.test.utils.create_job_exe(job_type=None, job=None, exe_num=None, node=None, timeout=None, input_file_size=10.0, queued=None, started=None, status=u'RUNNING', error=None, ended=None, output=None, task_results=None, configuration=None)

Creates a job_exe model for unit testing, may also create job_exe_end and job_exe_output models depending on status

Returns:The job_exe model
Return type:job.execution.job_exe.RunningJobExecution
job.test.utils.create_running_job_exe(agent_id=u'agent_1', job_type=None, job=None, node=None, timeout=None, input_file_size=10.0, queued=None, started=None, resources=None, priority=None, num_exes=1)

Creates a running job execution for unit testing

Returns:The running job execution
Return type:job.execution.job_exe.RunningJobExecution
job.test.utils.create_seed_job_type(manifest=None, priority=50, max_tries=3, max_scheduled=None, is_active=True, configuration=None, docker_image=u'fake', is_system=False, job_version=u'0.1.0', interface=None, interface_command=None, interface_inputs=None, interface_outputs=None, interface_mounts=None, interface_settings=None)
job.test.utils.create_seed_manifest(name=None, jobVersion=None, packageVersion=None, title=None, description=None, tags=None, maintainer=None, timeout=None, command=None, inputs_files=None, inputs_json=None, outputs_files=None, outputs_json=None, mounts=None, settings=None, resources=None, errors=None)
job.test.utils.create_task_status_update(task_id, agent_id, status, when, exit_code=None, reason=None, source=None, message=None, data=None)

Creates a job model for unit testing

Parameters:
  • task_id (string) – The unique ID of the task
  • agent_id (string) – The agent ID for the task
  • status (string) – The status of the task
  • when (datetime.datetime) – The timestamp of the update
  • exit_code (int) – The task’s exit code
  • reason (string) – The reason
  • source (string) – The source
  • message (string) – The message
  • data (dict) – The data dict
Returns:

The task status update

Return type:

job.tasks.update.TaskStatusUpdate

job.test.utils.edit_job_type_v6(job_type, manifest_dict=None, docker_image=None, icon_code=None, is_active=None, is_published=None, is_paused=None, max_scheduled=None, configuration_dict=None)

Updates a job type, including creating a new revision for unit testing

Module contents