forked from theforeman/foreman_maintain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
advanced_procedure_command_test.rb
119 lines (96 loc) · 3.91 KB
/
advanced_procedure_command_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
require 'test_helper'
require 'foreman_maintain/cli'
include CliAssertions
module ForemanMaintain
describe 'Advanced::Procedure' do
include CliAssertions
before do
ForemanMaintain.detector.refresh
end
let :command do
%w[advanced]
end
it 'prints procedure' do
assert_cmd <<-OUTPUT.strip_heredoc
Usage:
foreman-maintain advanced [OPTIONS] SUBCOMMAND [ARG] ...
Parameters:
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands:
procedure Run maintain procedures manually
Options:
-h, --help print help
OUTPUT
end
describe 'advanced procedure' do
let :command do
%w[advanced procedure]
end
it 'prints: run and by-tag subcommands' do
assert_cmd <<-OUTPUT.strip_heredoc
Usage:
foreman-maintain advanced procedure [OPTIONS] SUBCOMMAND [ARG] ...
Parameters:
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands:
run Run maintain procedures manually
by-tag Run maintain procedures in bulks
Options:
-h, --help print help
OUTPUT
end
end
describe 'advanced procedure by-tag' do
let :command do
%w[advanced procedure by-tag]
end
it 'prints: available subcommands for by-tag' do
assert_cmd <<-OUTPUT.strip_heredoc
Usage:
foreman-maintain advanced procedure by-tag [OPTIONS] SUBCOMMAND [ARG] ...
Parameters:
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands:
migrations Run procedures tagged #migrations: upgrade_migration
post-migrations Run procedures tagged #post_migrations: upgrade_post_migration
pre-migrations Run procedures tagged #pre_migrations: stop_service, upgrade_pre_migration
release Run procedures tagged #release: delete_articles_one_year_old
restart Run procedures tagged #restart: present_service_restart
start Run procedures tagged #start: present_service_start
Options:
-h, --help print help
OUTPUT
end
end
describe 'advanced procedure run' do
let :command do
%w[advanced procedure run]
end
it 'prints: available subcommands for run' do
assert_cmd <<-OUTPUT.strip_heredoc
Usage:
foreman-maintain advanced procedure run [OPTIONS] SUBCOMMAND [ARG] ...
Parameters:
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands:
delete-articles-one-year-old Delete all articles created 1 year ago
delete-articles-with-zero-comments Delete all articles with zero comments
present-service-restart Restart present service
present-service-start Start the present service
run-once Procedures::RunOnce
setup Setup
stop-service Stop the running service
upgrade-migration Procedures::Upgrade::Migration
upgrade-post-migration Procedures::Upgrade::PostMigration
upgrade-pre-migration Procedures::Upgrade::PreMigration
Options:
-h, --help print help
OUTPUT
end
end
end
end