kuroko2 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +15 -0
- data/Rakefile +26 -0
- data/app/assets/images/kuroko2/avatar.png +0 -0
- data/app/assets/images/kuroko2/kuroko-logo-horizontal.png +0 -0
- data/app/assets/javascripts/kuroko2/application.js +28 -0
- data/app/assets/javascripts/kuroko2/bootstrap.js +2363 -0
- data/app/assets/javascripts/kuroko2/definition_linker.js +20 -0
- data/app/assets/javascripts/kuroko2/instance_linker.js +10 -0
- data/app/assets/javascripts/kuroko2/job_definition_stats.js +67 -0
- data/app/assets/javascripts/kuroko2/job_definitions.js +79 -0
- data/app/assets/javascripts/kuroko2/job_instances.js +88 -0
- data/app/assets/javascripts/kuroko2/job_timelines.js.coffee +24 -0
- data/app/assets/javascripts/kuroko2/narrow_job_definitions.js +30 -0
- data/app/assets/stylesheets/kuroko2/admin-lte.css +3402 -0
- data/app/assets/stylesheets/kuroko2/application.scss +86 -0
- data/app/assets/stylesheets/kuroko2/bootstrap.css +6799 -0
- data/app/assets/stylesheets/kuroko2/fonts.scss +1 -0
- data/app/assets/stylesheets/kuroko2/job_definitions.scss +19 -0
- data/app/assets/stylesheets/kuroko2/users.scss +7 -0
- data/app/controllers/kuroko2/api/application_controller.rb +49 -0
- data/app/controllers/kuroko2/api/job_instances_controller.rb +46 -0
- data/app/controllers/kuroko2/api/stats_controller.rb +28 -0
- data/app/controllers/kuroko2/application_controller.rb +43 -0
- data/app/controllers/kuroko2/dashboard_controller.rb +27 -0
- data/app/controllers/kuroko2/execution_logs_controller.rb +19 -0
- data/app/controllers/kuroko2/executions_controller.rb +28 -0
- data/app/controllers/kuroko2/job_definition_stats_controller.rb +54 -0
- data/app/controllers/kuroko2/job_definitions_controller.rb +100 -0
- data/app/controllers/kuroko2/job_instances_controller.rb +87 -0
- data/app/controllers/kuroko2/job_schedules_controller.rb +39 -0
- data/app/controllers/kuroko2/job_suspend_schedules_controller.rb +38 -0
- data/app/controllers/kuroko2/job_timelines_controller.rb +56 -0
- data/app/controllers/kuroko2/logs_controller.rb +15 -0
- data/app/controllers/kuroko2/sessions_controller.rb +32 -0
- data/app/controllers/kuroko2/stars_controller.rb +30 -0
- data/app/controllers/kuroko2/tokens_controller.rb +47 -0
- data/app/controllers/kuroko2/users_controller.rb +62 -0
- data/app/controllers/kuroko2/workers_controller.rb +5 -0
- data/app/errors/http/bad_request.rb +4 -0
- data/app/errors/http/forbidden.rb +4 -0
- data/app/errors/http/unauthorized.rb +4 -0
- data/app/helpers/kuroko2/application_helper.rb +8 -0
- data/app/helpers/kuroko2/dashboard_helper.rb +4 -0
- data/app/helpers/kuroko2/executions_helper.rb +4 -0
- data/app/helpers/kuroko2/job_definitions_helper.rb +38 -0
- data/app/helpers/kuroko2/job_instances_helper.rb +71 -0
- data/app/helpers/kuroko2/job_schedules_helper.rb +4 -0
- data/app/helpers/kuroko2/logs_helper.rb +4 -0
- data/app/helpers/kuroko2/sessions_helper.rb +4 -0
- data/app/helpers/kuroko2/stars_helper.rb +4 -0
- data/app/helpers/kuroko2/tokens_helper.rb +4 -0
- data/app/helpers/kuroko2/users_helper.rb +4 -0
- data/app/helpers/kuroko2/workers_helper.rb +4 -0
- data/app/jobs/kuroko2/application_job.rb +4 -0
- data/app/mailers/kuroko2/application_mailer.rb +6 -0
- data/app/mailers/kuroko2/notifications.rb +63 -0
- data/app/models/concerns/kuroko2/table_name_customizable.rb +16 -0
- data/app/models/kuroko2/admin_assignment.rb +6 -0
- data/app/models/kuroko2/api/application_resource.rb +10 -0
- data/app/models/kuroko2/api/job_instance_resource.rb +7 -0
- data/app/models/kuroko2/application_record.rb +5 -0
- data/app/models/kuroko2/execution.rb +55 -0
- data/app/models/kuroko2/job_definition.rb +147 -0
- data/app/models/kuroko2/job_definition_tag.rb +6 -0
- data/app/models/kuroko2/job_instance.rb +118 -0
- data/app/models/kuroko2/job_schedule.rb +93 -0
- data/app/models/kuroko2/job_suspend_schedule.rb +35 -0
- data/app/models/kuroko2/log.rb +3 -0
- data/app/models/kuroko2/memory_consumption_log.rb +49 -0
- data/app/models/kuroko2/memory_expectancy.rb +21 -0
- data/app/models/kuroko2/process_signal.rb +14 -0
- data/app/models/kuroko2/star.rb +6 -0
- data/app/models/kuroko2/tag.rb +8 -0
- data/app/models/kuroko2/tick.rb +12 -0
- data/app/models/kuroko2/token.rb +101 -0
- data/app/models/kuroko2/user.rb +48 -0
- data/app/models/kuroko2/worker.rb +12 -0
- data/app/views/kaminari/history/_paginator.html.slim +15 -0
- data/app/views/kaminari/list/_paginator.html.slim +17 -0
- data/app/views/kuroko2/dashboard/_taglist.html.slim +13 -0
- data/app/views/kuroko2/dashboard/index.html.slim +49 -0
- data/app/views/kuroko2/execution_logs/index.json.jbuilder +16 -0
- data/app/views/kuroko2/executions/index.html.slim +35 -0
- data/app/views/kuroko2/job_definition_stats/execution_time.json.jbuilder +13 -0
- data/app/views/kuroko2/job_definition_stats/index.html.slim +48 -0
- data/app/views/kuroko2/job_definition_stats/memory.json.jbuilder +10 -0
- data/app/views/kuroko2/job_definitions/_alert.html.slim +7 -0
- data/app/views/kuroko2/job_definitions/_form.html.slim +93 -0
- data/app/views/kuroko2/job_definitions/_list.html.slim +26 -0
- data/app/views/kuroko2/job_definitions/_search_results.html.slim +51 -0
- data/app/views/kuroko2/job_definitions/_taglist.html.slim +13 -0
- data/app/views/kuroko2/job_definitions/edit.html.slim +15 -0
- data/app/views/kuroko2/job_definitions/index.html.slim +11 -0
- data/app/views/kuroko2/job_definitions/new.html.slim +12 -0
- data/app/views/kuroko2/job_definitions/show.html.slim +90 -0
- data/app/views/kuroko2/job_instances/_instance.html.slim +42 -0
- data/app/views/kuroko2/job_instances/index.html.slim +58 -0
- data/app/views/kuroko2/job_instances/show.html.slim +19 -0
- data/app/views/kuroko2/job_instances/working.html.slim +37 -0
- data/app/views/kuroko2/job_schedules/index.html.slim +32 -0
- data/app/views/kuroko2/job_suspend_schedules/index.html.slim +27 -0
- data/app/views/kuroko2/job_timelines/dataset.json.jbuilder +11 -0
- data/app/views/kuroko2/job_timelines/index.html.slim +31 -0
- data/app/views/kuroko2/kaminari/history/_paginator.html.slim +15 -0
- data/app/views/kuroko2/kaminari/list/_paginator.html.slim +17 -0
- data/app/views/kuroko2/layouts/application.html.slim +68 -0
- data/app/views/kuroko2/logs/index.html.slim +33 -0
- data/app/views/kuroko2/notifications/executor_not_assigned.text.erb +22 -0
- data/app/views/kuroko2/notifications/job_failure.html.slim +21 -0
- data/app/views/kuroko2/notifications/job_failure.text.erb +18 -0
- data/app/views/kuroko2/notifications/notify_long_elapsed_time.text.erb +9 -0
- data/app/views/kuroko2/notifications/process_absence.text.erb +22 -0
- data/app/views/kuroko2/notifications/remind_failure.html.slim +21 -0
- data/app/views/kuroko2/notifications/remind_failure.text.erb +10 -0
- data/app/views/kuroko2/sessions/new.html.slim +20 -0
- data/app/views/kuroko2/tokens/index.html.slim +42 -0
- data/app/views/kuroko2/users/index.html.slim +55 -0
- data/app/views/kuroko2/users/show.html.slim +76 -0
- data/app/views/kuroko2/workers/index.html.slim +40 -0
- data/app/views/layouts/kuroko2/application.html.slim +72 -0
- data/app/views/layouts/mailer.html.erb +13 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/bin/cleanup_old_instances.rb +9 -0
- data/bin/remind_failure.rb +5 -0
- data/config/initializers/000_kuroko2.rb +16 -0
- data/config/initializers/assets.rb +9 -0
- data/config/initializers/garage.rb +2 -0
- data/config/initializers/kaminari_config.rb +3 -0
- data/config/initializers/omniauth.rb +5 -0
- data/config/locales/en.yml +28 -0
- data/config/routes.rb +54 -0
- data/db/migrate/001_create_job_definitions.rb +22 -0
- data/db/migrate/002_create_job_instances.rb +17 -0
- data/db/migrate/003_create_job_schedules.rb +14 -0
- data/db/migrate/004_create_ticks.rb +7 -0
- data/db/migrate/005_create_logs.rb +13 -0
- data/db/migrate/006_create_tokens.rb +21 -0
- data/db/migrate/007_create_executions.rb +26 -0
- data/db/migrate/008_create_process_signals.rb +15 -0
- data/db/migrate/009_create_users.rb +20 -0
- data/db/migrate/010_create_admin_assignments.rb +12 -0
- data/db/migrate/011_create_stars.rb +12 -0
- data/db/migrate/012_create_workers.rb +15 -0
- data/db/migrate/018_create_job_definition_tags.rb +13 -0
- data/db/migrate/019_create_tags.rb +11 -0
- data/db/migrate/021_create_memory_expectancies.rb +17 -0
- data/db/migrate/025_create_job_suspend_schedules.rb +12 -0
- data/lib/kuroko2/command/executor.rb +62 -0
- data/lib/kuroko2/command/kill.rb +24 -0
- data/lib/kuroko2/command/monitor.rb +109 -0
- data/lib/kuroko2/command/shell.rb +163 -0
- data/lib/kuroko2/configuration.rb +19 -0
- data/lib/kuroko2/engine.rb +59 -0
- data/lib/kuroko2/execution_logger/cloud_watch_logs.rb +92 -0
- data/lib/kuroko2/execution_logger/void.rb +13 -0
- data/lib/kuroko2/execution_logger.rb +20 -0
- data/lib/kuroko2/memory_sampler.rb +50 -0
- data/lib/kuroko2/return_to_validator.rb +14 -0
- data/lib/kuroko2/servers/base.rb +30 -0
- data/lib/kuroko2/servers/command_executor.rb +27 -0
- data/lib/kuroko2/servers/job_scheduler.rb +25 -0
- data/lib/kuroko2/servers/workflow_processor.rb +25 -0
- data/lib/kuroko2/util/logger.rb +19 -0
- data/lib/kuroko2/util/rails_logger_formatter.rb +9 -0
- data/lib/kuroko2/version.rb +3 -0
- data/lib/kuroko2/workflow/assertion_error.rb +6 -0
- data/lib/kuroko2/workflow/engine.rb +141 -0
- data/lib/kuroko2/workflow/engine_error.rb +6 -0
- data/lib/kuroko2/workflow/node.rb +124 -0
- data/lib/kuroko2/workflow/notifier/concerns/chat_message_builder.rb +39 -0
- data/lib/kuroko2/workflow/notifier/hipchat.rb +88 -0
- data/lib/kuroko2/workflow/notifier/mail.rb +44 -0
- data/lib/kuroko2/workflow/notifier/slack.rb +121 -0
- data/lib/kuroko2/workflow/notifier.rb +31 -0
- data/lib/kuroko2/workflow/processor.rb +40 -0
- data/lib/kuroko2/workflow/scheduler.rb +42 -0
- data/lib/kuroko2/workflow/script_parser.rb +66 -0
- data/lib/kuroko2/workflow/shell_scanner.rb +34 -0
- data/lib/kuroko2/workflow/syntax_error.rb +6 -0
- data/lib/kuroko2/workflow/task/auto_skip_error.rb +20 -0
- data/lib/kuroko2/workflow/task/base.rb +32 -0
- data/lib/kuroko2/workflow/task/env.rb +45 -0
- data/lib/kuroko2/workflow/task/execute.rb +128 -0
- data/lib/kuroko2/workflow/task/expected_time.rb +9 -0
- data/lib/kuroko2/workflow/task/fork.rb +45 -0
- data/lib/kuroko2/workflow/task/kuroko_runner.rb +24 -0
- data/lib/kuroko2/workflow/task/noop.rb +13 -0
- data/lib/kuroko2/workflow/task/queue.rb +27 -0
- data/lib/kuroko2/workflow/task/rails_env.rb +24 -0
- data/lib/kuroko2/workflow/task/sequence.rb +13 -0
- data/lib/kuroko2/workflow/task/sleep.rb +29 -0
- data/lib/kuroko2/workflow/task/sub_process.rb +53 -0
- data/lib/kuroko2/workflow/task/time_base.rb +44 -0
- data/lib/kuroko2/workflow/task/timeout.rb +9 -0
- data/lib/kuroko2/workflow/task/wait.rb +143 -0
- data/lib/kuroko2.rb +26 -0
- data/lib/tasks/kuroko2_tasks.rake +4 -0
- data/spec/command/kill_spec.rb +20 -0
- data/spec/command/monitor_spec.rb +68 -0
- data/spec/command/shell_spec.rb +87 -0
- data/spec/controllers/dashboard_controller_spec.rb +5 -0
- data/spec/controllers/executions_controller_spec.rb +23 -0
- data/spec/controllers/job_definition_stats_controller_spec.rb +95 -0
- data/spec/controllers/job_definitions_controller_spec.rb +89 -0
- data/spec/controllers/job_instances_controller_spec.rb +62 -0
- data/spec/controllers/job_schedules_controller_spec.rb +39 -0
- data/spec/controllers/job_suspend_schedules_controller_spec.rb +39 -0
- data/spec/controllers/job_timelines_controller_spec.rb +114 -0
- data/spec/controllers/logs_controller_spec.rb +5 -0
- data/spec/controllers/sessions_controller_spec.rb +58 -0
- data/spec/controllers/stars_controller_spec.rb +28 -0
- data/spec/controllers/tokens_controller_spec.rb +5 -0
- data/spec/controllers/users_controller_spec.rb +51 -0
- data/spec/controllers/workers_controller_spec.rb +5 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +5 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +34 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/config/application.rb +25 -0
- data/spec/dummy/config/boot.rb +3 -0
- data/spec/dummy/config/cable.yml +9 -0
- data/spec/dummy/config/database.yml +29 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +54 -0
- data/spec/dummy/config/environments/production.rb +86 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/new_framework_defaults.rb +23 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/kuroko2.yml +35 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/puma.rb +47 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/schema.rb +217 -0
- data/spec/dummy/lib/dummy_extention.rb +14 -0
- data/spec/dummy/lib/kuroko2/workflow/task/custom_task1.rb +13 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/execution_logger/cloud_watch_logs_spec.rb +95 -0
- data/spec/factories/execution_factory.rb +13 -0
- data/spec/factories/job_definition_factory.rb +21 -0
- data/spec/factories/job_instance_factory.rb +4 -0
- data/spec/factories/job_schedule_factory.rb +10 -0
- data/spec/factories/job_suspend_schedule_factory.rb +8 -0
- data/spec/factories/memory_expectancy_factory.rb +5 -0
- data/spec/factories/process_signal_factory.rb +4 -0
- data/spec/factories/star_factory.rb +4 -0
- data/spec/factories/tick_factory.rb +4 -0
- data/spec/factories/token_factory.rb +10 -0
- data/spec/factories/user_factory.rb +11 -0
- data/spec/factories/worker_factory.rb +8 -0
- data/spec/features/dashborad_spec.rb +82 -0
- data/spec/features/job_definition_spec.rb +74 -0
- data/spec/features/job_instance_spec.rb +94 -0
- data/spec/features/sign_in_and_out_spec.rb +17 -0
- data/spec/features/users_spec.rb +90 -0
- data/spec/features/workers_spec.rb +44 -0
- data/spec/helpers/executions_helper_spec.rb +4 -0
- data/spec/helpers/job_definition_helper_spec.rb +42 -0
- data/spec/helpers/job_schedules_helper_spec.rb +4 -0
- data/spec/helpers/logs_helper_spec.rb +4 -0
- data/spec/helpers/tokens_helper_spec.rb +4 -0
- data/spec/helpers/users_helper_spec.rb +4 -0
- data/spec/helpers/workers_helper_spec.rb +4 -0
- data/spec/mailers/notifications_spec.rb +54 -0
- data/spec/memory_sampler_spec.rb +11 -0
- data/spec/models/admin_assignment_spec.rb +4 -0
- data/spec/models/execution_spec.rb +26 -0
- data/spec/models/job_definition_spec.rb +163 -0
- data/spec/models/job_instance_spec.rb +115 -0
- data/spec/models/job_schedule_spec.rb +121 -0
- data/spec/models/job_suspend_schedule_spec.rb +32 -0
- data/spec/models/memory_consumption_log_spec.rb +50 -0
- data/spec/models/memory_expectancy_spec.rb +26 -0
- data/spec/models/star_spec.rb +4 -0
- data/spec/models/tick_spec.rb +23 -0
- data/spec/models/token_spec.rb +54 -0
- data/spec/models/user_spec.rb +17 -0
- data/spec/models/worker_spec.rb +5 -0
- data/spec/rails_helper.rb +81 -0
- data/spec/requests/api/job_instances_spec.rb +96 -0
- data/spec/requests/api/stats_spec.rb +45 -0
- data/spec/return_to_validator_spec.rb +28 -0
- data/spec/settings_spec.rb +10 -0
- data/spec/spec_helper.rb +49 -0
- data/spec/support/feature_sign_in_helper.rb +31 -0
- data/spec/support/sign_in_helper.rb +5 -0
- data/spec/support/wait_for_ajax.rb +11 -0
- data/spec/workflow/engine_spec.rb +241 -0
- data/spec/workflow/node_spec.rb +62 -0
- data/spec/workflow/notifier/hipchat_spec.rb +117 -0
- data/spec/workflow/notifier/mail_spec.rb +86 -0
- data/spec/workflow/notifier/slack_spec.rb +110 -0
- data/spec/workflow/script_parser_spec.rb +119 -0
- data/spec/workflow/shell_scanner_spec.rb +47 -0
- data/spec/workflow/task/auto_skip_error_spec.rb +35 -0
- data/spec/workflow/task/env_spec.rb +47 -0
- data/spec/workflow/task/execute_spec.rb +127 -0
- data/spec/workflow/task/expected_time_spec.rb +52 -0
- data/spec/workflow/task/fork_spec.rb +30 -0
- data/spec/workflow/task/queue_spec.rb +45 -0
- data/spec/workflow/task/rails_env_spec.rb +30 -0
- data/spec/workflow/task/sleep_spec.rb +22 -0
- data/spec/workflow/task/sub_process_spec.rb +32 -0
- data/spec/workflow/task/wait_spec.rb +162 -0
- metadata +1038 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Login with google oauth2", type: :feature do
|
|
4
|
+
before do
|
|
5
|
+
mock_omni_auth_google_oauth2
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'signs in and signs out' do
|
|
9
|
+
visit kuroko2_path
|
|
10
|
+
click_on('Sign in with Google')
|
|
11
|
+
expect(page.current_path).to eq(kuroko2_path)
|
|
12
|
+
expect(page).to have_content('Favorite Job Definitions')
|
|
13
|
+
|
|
14
|
+
click_on('Sign out')
|
|
15
|
+
expect(page).to have_content('Please sign in with Google account.')
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Users management", type: :feature do
|
|
4
|
+
let(:user) { create(:user) }
|
|
5
|
+
|
|
6
|
+
before do
|
|
7
|
+
sign_in(user)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'shows users' do
|
|
11
|
+
visit kuroko2.users_path
|
|
12
|
+
expect(page).to have_selector('#users tbody tr', count: 1)
|
|
13
|
+
expect(page).to have_content(user.name)
|
|
14
|
+
|
|
15
|
+
click_on('View Details')
|
|
16
|
+
expect(page).to have_content("##{user.id} #{user.name}")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'creates group users' do
|
|
20
|
+
visit kuroko2.users_path
|
|
21
|
+
fill_in 'Name', with: 'Test Group User'
|
|
22
|
+
fill_in 'Email', with: 'test_group_user@example.com'
|
|
23
|
+
click_on 'Add mail address'
|
|
24
|
+
|
|
25
|
+
expect(page).to have_selector('#users tbody tr', count: 2)
|
|
26
|
+
expect(page).to have_content(user.name)
|
|
27
|
+
expect(page).to have_content('Test Group User')
|
|
28
|
+
|
|
29
|
+
within '.sidebar-menu' do
|
|
30
|
+
click_on 'Groups'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
expect(page).to have_selector('#users tbody tr', count: 1)
|
|
34
|
+
expect(page).to have_content('Test Group User')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
context 'A user has some tagged job_definitions', js: true do
|
|
38
|
+
let(:common_tag) { 'common_tag' }
|
|
39
|
+
|
|
40
|
+
before do
|
|
41
|
+
10.times.each do |i|
|
|
42
|
+
create(:job_definition).tap do |d|
|
|
43
|
+
d.text_tags = "#{common_tag}, tag_#{i}"
|
|
44
|
+
d.admins << user
|
|
45
|
+
d.save!
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'shows tags' do
|
|
51
|
+
visit kuroko2.user_path(user.id)
|
|
52
|
+
expect(page).to have_content(common_tag)
|
|
53
|
+
10.times.each do |i|
|
|
54
|
+
expect(page).to have_content("tag_#{i}")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
expect(page).to have_selector('#definitions_list table tbody tr', count: 10)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'selects tagged jobs' do
|
|
61
|
+
visit kuroko2.user_path(user.id)
|
|
62
|
+
|
|
63
|
+
expect(page).to have_content(common_tag)
|
|
64
|
+
|
|
65
|
+
click_on(common_tag)
|
|
66
|
+
wait_for_ajax
|
|
67
|
+
expect(page).to have_selector('#definitions_list table tbody tr', count: 10)
|
|
68
|
+
|
|
69
|
+
click_on("tag_1")
|
|
70
|
+
wait_for_ajax
|
|
71
|
+
expect(page).to have_selector('#definitions_list table tbody tr', count: 1)
|
|
72
|
+
|
|
73
|
+
click_on("tag_1")
|
|
74
|
+
wait_for_ajax
|
|
75
|
+
expect(page).to have_selector('#definitions_list table tbody tr', count: 10)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context 'if the favorite job is working' do
|
|
79
|
+
before do
|
|
80
|
+
user.assigned_job_definitions.first.job_instances.create
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'shows working jobs' do
|
|
84
|
+
visit kuroko2.user_path(user.id)
|
|
85
|
+
expect(page).not_to have_content('There are no working jobs.')
|
|
86
|
+
expect(page).to have_selector('#instances div table tr', count: 2)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe "Show list of workers", type: :feature do
|
|
4
|
+
|
|
5
|
+
let(:user) { create(:user) }
|
|
6
|
+
let(:job_definition) do
|
|
7
|
+
create(:job_definition_with_instances, script: <<-EOF.strip_heredoc)
|
|
8
|
+
execute: echo Hello!
|
|
9
|
+
EOF
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
let(:shell) { Kuroko2::Command::Shell.new(hostname: 'rspec', worker_id: 1, worker: worker) }
|
|
13
|
+
let(:token) { job_definition.job_instances.first.tokens.first }
|
|
14
|
+
let!(:worker) { create(:worker) }
|
|
15
|
+
let(:workflow) { Kuroko2::Workflow::Engine.new }
|
|
16
|
+
|
|
17
|
+
before do
|
|
18
|
+
workflow.process(token)
|
|
19
|
+
workflow.process(token)
|
|
20
|
+
sign_in(user)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'shows execution jobs on the worker', js: true do
|
|
24
|
+
visit kuroko2.workers_path
|
|
25
|
+
expect(page).to have_selector('#workers table tbody tr', count: 2)
|
|
26
|
+
expect(page).not_to have_content('echo Hello!')
|
|
27
|
+
|
|
28
|
+
worker.update_column(:execution_id, token.execution.id)
|
|
29
|
+
|
|
30
|
+
visit kuroko2.workers_path
|
|
31
|
+
expect(page).to have_selector('#workers table tbody tr', count: 2)
|
|
32
|
+
expect(page).to have_content('echo Hello!')
|
|
33
|
+
expect(page).to have_selector('#workers table tbody tr td .btn', text: 'Details', count: 1)
|
|
34
|
+
|
|
35
|
+
worker.update_column(:execution_id, token.execution.id)
|
|
36
|
+
token.execution.finish(output: '', exit_status: 1)
|
|
37
|
+
worker.update_column(:execution_id, nil)
|
|
38
|
+
|
|
39
|
+
visit kuroko2.workers_path
|
|
40
|
+
expect(page).to have_selector('#workers table tbody tr', count: 2)
|
|
41
|
+
expect(page).not_to have_content('echo Hello!')
|
|
42
|
+
expect(page).to have_selector('#workers table tbody tr td .btn', text: 'Details', count: 0)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe Kuroko2::JobDefinitionsHelper do
|
|
4
|
+
describe '#first_line' do
|
|
5
|
+
subject { first_line(text) }
|
|
6
|
+
|
|
7
|
+
let(:line) { 'First Line' }
|
|
8
|
+
|
|
9
|
+
context 'multi line text' do
|
|
10
|
+
let(:text) do
|
|
11
|
+
<<-EOF.strip_heredoc
|
|
12
|
+
#{line}
|
|
13
|
+
|
|
14
|
+
Additional
|
|
15
|
+
EOF
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it { is_expected.to eq line }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context 'single line text' do
|
|
22
|
+
let(:text) { line }
|
|
23
|
+
|
|
24
|
+
it { is_expected.to eq line }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe '#markdown_format' do
|
|
29
|
+
subject { markdown_format(text) }
|
|
30
|
+
|
|
31
|
+
let(:text) do
|
|
32
|
+
<<-EOF.strip_heredoc
|
|
33
|
+
# Title
|
|
34
|
+
LGTM
|
|
35
|
+
EOF
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it { is_expected.to match %r(<h1>Title</h1>) }
|
|
39
|
+
it { is_expected.to match %r(LGTM) }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe Kuroko2::Notifications do
|
|
4
|
+
let(:instance) { create(:job_definition_with_instances, name: job_name).job_instances.first }
|
|
5
|
+
let(:definition) { instance.job_definition }
|
|
6
|
+
let(:admins) { definition.admins }
|
|
7
|
+
let(:job_name) { 'My Job' }
|
|
8
|
+
|
|
9
|
+
describe 'job_failure' do
|
|
10
|
+
let(:mail) { Kuroko2::Notifications.job_failure(instance) }
|
|
11
|
+
|
|
12
|
+
it 'renders the headers' do
|
|
13
|
+
expect(mail.subject).to eq "[CRITICAL] Failed to execute '#{job_name}' on kuroko"
|
|
14
|
+
expect(mail.to).to eq(admins.map(&:email))
|
|
15
|
+
expect(mail.from).to eq(['no-reply@example.com'])
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'renders the body' do
|
|
19
|
+
expect(mail.body.encoded).to match("Name: #{job_name}")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe 'job_failure' do
|
|
24
|
+
let(:mail) { Kuroko2::Notifications.remind_failure(instance) }
|
|
25
|
+
|
|
26
|
+
before {
|
|
27
|
+
instance.error_at = 2.days.ago
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
it 'renders the headers' do
|
|
31
|
+
expect(mail.subject).to eq "[WARN] '#{job_name}' is still in ERROR state"
|
|
32
|
+
expect(mail.to).to eq(admins.map(&:email))
|
|
33
|
+
expect(mail.from).to eq(['no-reply@example.com'])
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'renders the body' do
|
|
37
|
+
expect(mail.body.encoded).to match("Name: #{job_name}")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe 'notify_long_elapsed_time' do
|
|
42
|
+
let(:mail) { Kuroko2::Notifications.notify_long_elapsed_time(instance) }
|
|
43
|
+
|
|
44
|
+
it 'renders the headers' do
|
|
45
|
+
expect(mail.subject).to eq "[WARN] The running time is longer than expected '#{definition.name}' on kuroko"
|
|
46
|
+
expect(mail.to).to eq(admins.map(&:email))
|
|
47
|
+
expect(mail.from).to eq(['no-reply@example.com'])
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'renders the body' do
|
|
51
|
+
expect(mail.body.encoded).to match("Name: #{job_name}")
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Kuroko2::MemorySampler do
|
|
4
|
+
describe 'get_by_pgid' do
|
|
5
|
+
let!(:pid) { Process.spawn(*%w[sleep 10], pgroup: true) }
|
|
6
|
+
|
|
7
|
+
it 'returns memory consumption' do
|
|
8
|
+
expect(described_class.get_by_pgid(pid)).to be_kind_of(Integer)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe Kuroko2::Execution do
|
|
4
|
+
|
|
5
|
+
describe '.poll' do
|
|
6
|
+
context 'with active execution' do
|
|
7
|
+
let(:definition) { create(:job_definition) }
|
|
8
|
+
let(:token) { create(:token) }
|
|
9
|
+
|
|
10
|
+
context 'default queue' do
|
|
11
|
+
subject { Kuroko2::Execution.poll }
|
|
12
|
+
let!(:execution) { create(:execution, job_definition: definition, token: token, started_at: nil) }
|
|
13
|
+
|
|
14
|
+
it { is_expected.to eq execution }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
context 'given queue' do
|
|
18
|
+
subject { Kuroko2::Execution.poll(queue) }
|
|
19
|
+
let!(:execution) { create(:execution, job_definition: definition, token: token, started_at: nil, queue: queue) }
|
|
20
|
+
let(:queue) { 'QUEUE' }
|
|
21
|
+
|
|
22
|
+
it { is_expected.to eq execution }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe Kuroko2::JobDefinition do
|
|
4
|
+
let!(:definition) { create(:job_definition_with_instances) }
|
|
5
|
+
|
|
6
|
+
describe '#destroy' do
|
|
7
|
+
subject { definition.destroy }
|
|
8
|
+
|
|
9
|
+
context 'token dependency' do
|
|
10
|
+
context 'without token' do
|
|
11
|
+
before { Kuroko2::Token.destroy_all }
|
|
12
|
+
|
|
13
|
+
it { is_expected.to be_truthy }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context 'with token' do
|
|
17
|
+
it { is_expected.to be_falsey }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context 'schedules dependency' do
|
|
22
|
+
before do
|
|
23
|
+
Kuroko2::Token.destroy_all
|
|
24
|
+
definition.job_schedules.create(cron: '0 * * * *')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it do
|
|
28
|
+
is_expected.to be_truthy
|
|
29
|
+
expect(Kuroko2::JobSchedule.all.size).to be_zero
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "#proceed_multi_instance?" do
|
|
35
|
+
let(:prevent_multi) { 1 }
|
|
36
|
+
let!(:definition) do
|
|
37
|
+
create(
|
|
38
|
+
:job_definition_with_instances,
|
|
39
|
+
prevent_multi: prevent_multi,
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
subject { definition.proceed_multi_instance? }
|
|
44
|
+
|
|
45
|
+
context 'prevent_multi is default (working, failure)' do
|
|
46
|
+
context "the token's status is working" do
|
|
47
|
+
it { is_expected.to be_falsey }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
context "the token's status is failure" do
|
|
51
|
+
before do
|
|
52
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
53
|
+
update_all(status: Kuroko2::Token::FAILURE)
|
|
54
|
+
end
|
|
55
|
+
it { is_expected.to be_falsey }
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
context "the token's status is finished" do
|
|
59
|
+
before do
|
|
60
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
61
|
+
update_all(status: Kuroko2::Token::FINISHED)
|
|
62
|
+
end
|
|
63
|
+
it { is_expected.to be_truthy }
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
context 'prevent_multi is only working' do
|
|
68
|
+
let(:prevent_multi) { 2 }
|
|
69
|
+
|
|
70
|
+
context "the token's status is working" do
|
|
71
|
+
it { is_expected.to be_falsey }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
context "the token's status is failure" do
|
|
75
|
+
before do
|
|
76
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
77
|
+
update_all(status: Kuroko2::Token::FAILURE)
|
|
78
|
+
end
|
|
79
|
+
it { is_expected.to be_truthy }
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
context "the token's status is finished" do
|
|
83
|
+
before do
|
|
84
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
85
|
+
update_all(status: Kuroko2::Token::FINISHED)
|
|
86
|
+
end
|
|
87
|
+
it { is_expected.to be_truthy }
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
context 'prevent_multi is only failure' do
|
|
92
|
+
let(:prevent_multi) { 3 }
|
|
93
|
+
|
|
94
|
+
context "the token's status is working" do
|
|
95
|
+
it { is_expected.to be_truthy }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
context "the token's status is failure" do
|
|
99
|
+
before do
|
|
100
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
101
|
+
update_all(status: Kuroko2::Token::FAILURE)
|
|
102
|
+
end
|
|
103
|
+
it { is_expected.to be_falsey }
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
context "the token's status is finished" do
|
|
107
|
+
before do
|
|
108
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
109
|
+
update_all(status: Kuroko2::Token::FINISHED)
|
|
110
|
+
end
|
|
111
|
+
it { is_expected.to be_truthy }
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
context 'prevent_multi is only failure' do
|
|
116
|
+
let(:prevent_multi) { 3 }
|
|
117
|
+
|
|
118
|
+
context "the token's status is working" do
|
|
119
|
+
it { is_expected.to be_truthy }
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
context "the token's status is failure" do
|
|
123
|
+
before do
|
|
124
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
125
|
+
update_all(status: Kuroko2::Token::FAILURE)
|
|
126
|
+
end
|
|
127
|
+
it { is_expected.to be_falsey }
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
context "the token's status is finished" do
|
|
131
|
+
before do
|
|
132
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
133
|
+
update_all(status: Kuroko2::Token::FINISHED)
|
|
134
|
+
end
|
|
135
|
+
it { is_expected.to be_truthy }
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
context 'prevent_multi disabled' do
|
|
140
|
+
let(:prevent_multi) { 0 }
|
|
141
|
+
|
|
142
|
+
context "the token's status is working" do
|
|
143
|
+
it { is_expected.to be_truthy }
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
context "the token's status is failure" do
|
|
147
|
+
before do
|
|
148
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
149
|
+
update_all(status: Kuroko2::Token::FAILURE)
|
|
150
|
+
end
|
|
151
|
+
it { is_expected.to be_truthy }
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
context "the token's status is finished" do
|
|
155
|
+
before do
|
|
156
|
+
Kuroko2::Token.where(job_definition_id: definition.id).
|
|
157
|
+
update_all(status: Kuroko2::Token::FINISHED)
|
|
158
|
+
end
|
|
159
|
+
it { is_expected.to be_truthy }
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe Kuroko2::JobInstance do
|
|
4
|
+
let(:log) { Kuroko2::Log.take }
|
|
5
|
+
|
|
6
|
+
describe '#logs' do
|
|
7
|
+
let(:definition) { create(:job_definition) }
|
|
8
|
+
let(:instance) { create(:job_instance, job_definition: definition) }
|
|
9
|
+
|
|
10
|
+
it do
|
|
11
|
+
instance.logs.info('log info')
|
|
12
|
+
expect(log.level).to eq 'INFO'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe '#initialize' do
|
|
17
|
+
let(:definition) { create(:job_definition) }
|
|
18
|
+
let(:instance) { definition.job_instances.create! }
|
|
19
|
+
|
|
20
|
+
it do
|
|
21
|
+
expect(instance.tokens.count).to eq 1
|
|
22
|
+
expect(instance.reload.tokens.count).to eq 1
|
|
23
|
+
expect(instance.tokens.first.script).to eq instance.job_definition.script
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context 'Overwrite script on creating' do
|
|
27
|
+
let(:script) { 'env: ALTERNATIVE=1' }
|
|
28
|
+
let(:instance) { definition.job_instances.create!(script: script) }
|
|
29
|
+
|
|
30
|
+
it 'Inject alternative script to the instance' do
|
|
31
|
+
expect(instance.tokens.count).to eq 1
|
|
32
|
+
expect(instance.tokens.first.script).to eq script
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe '#cancel' do
|
|
38
|
+
let(:definition) { create(:job_definition) }
|
|
39
|
+
let(:instance) { definition.job_instances.create! }
|
|
40
|
+
|
|
41
|
+
subject! { instance.cancel }
|
|
42
|
+
|
|
43
|
+
it do
|
|
44
|
+
expect(instance).to be_canceled_at
|
|
45
|
+
expect(instance.tokens.size).to eq 0
|
|
46
|
+
expect(instance.executions.size).to eq 0
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe '#generate_token' do
|
|
51
|
+
before do
|
|
52
|
+
ActionMailer::Base.deliveries.clear
|
|
53
|
+
create(:job_instance, job_definition: definition)
|
|
54
|
+
end
|
|
55
|
+
subject! { definition.job_instances.create }
|
|
56
|
+
|
|
57
|
+
context 'notify_cancellation is false' do
|
|
58
|
+
let(:definition) { create(:job_definition, notify_cancellation: false, prevent_multi: true) }
|
|
59
|
+
|
|
60
|
+
it { expect(ActionMailer::Base.deliveries).to be_empty }
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
context 'notify_cancellation is false' do
|
|
64
|
+
let(:definition) { create(:job_definition, notify_cancellation: true, prevent_multi: true) }
|
|
65
|
+
|
|
66
|
+
it { expect(ActionMailer::Base.deliveries).not_to be_empty }
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
describe '#status' do
|
|
71
|
+
let(:instance) do
|
|
72
|
+
create(
|
|
73
|
+
:job_instance,
|
|
74
|
+
finished_at: finished_at,
|
|
75
|
+
error_at: error_at,
|
|
76
|
+
canceled_at: canceled_at,
|
|
77
|
+
job_definition: definition,
|
|
78
|
+
)
|
|
79
|
+
end
|
|
80
|
+
let(:finished_at) { nil }
|
|
81
|
+
let(:error_at) { nil }
|
|
82
|
+
let(:canceled_at) { nil }
|
|
83
|
+
let(:definition) { create(:job_definition) }
|
|
84
|
+
|
|
85
|
+
context 'with finished_at present' do
|
|
86
|
+
let(:finished_at) { Time.now }
|
|
87
|
+
|
|
88
|
+
it 'returns "success"' do
|
|
89
|
+
expect(instance.status).to eq('success')
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
context 'with canceled_at present' do
|
|
94
|
+
let(:canceled_at) { Time.now }
|
|
95
|
+
|
|
96
|
+
it 'returns "canceled"' do
|
|
97
|
+
expect(instance.status).to eq('canceled')
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
context 'with error_at present' do
|
|
102
|
+
let(:error_at) { Time.now }
|
|
103
|
+
|
|
104
|
+
it 'returns "error"' do
|
|
105
|
+
expect(instance.status).to eq('error')
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
context 'when no timestamp is set' do
|
|
110
|
+
it 'returns "working"' do
|
|
111
|
+
expect(instance.status).to eq('working')
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|