diff --git a/lib/litmus_paper/cli/admin/force.rb b/lib/litmus_paper/cli/admin/force.rb index db6b1a1..f6fe783 100644 --- a/lib/litmus_paper/cli/admin/force.rb +++ b/lib/litmus_paper/cli/admin/force.rb @@ -9,7 +9,7 @@ def self.description def self.build_request(options, args) options.merge! _default_options opt_parser = _extend_default_parser(options) do |opts| - opts.banner = "Usage: litmusctl force [service] [options]" + opts.banner = "Usage: litmusctl force [remove] [service] [options]" opts.on("-d", "--delete", "Remove status file") do options[:delete] = true end @@ -19,6 +19,10 @@ def self.build_request(options, args) end opt_parser.parse! args + if args[0] == "remove" + options[:delete] = true + args.shift + end if args[0] == "health" && !options[:delete] direction, value, service = args else diff --git a/spec/litmus_paper/cli/admin_spec.rb b/spec/litmus_paper/cli/admin_spec.rb index a3fe815..ac16047 100644 --- a/spec/litmus_paper/cli/admin_spec.rb +++ b/spec/litmus_paper/cli/admin_spec.rb @@ -83,6 +83,14 @@ def _litmusctl(args) status.should_not match(/for testing/) end + it "removes an upfile for the service with 'remove'" do + _litmusctl('force up test -r "for testing"').should match("File created") + _litmusctl('force remove up test').should match("File deleted") + status = _litmusctl('status passing_test') + status.should match(/Health: \d\d/) + status.should_not match(/for testing/) + end + it "removes a healthfile for the service" do _litmusctl('force health 88 test -r "for testing"').should match("File created") _litmusctl('force health test -d').should match("File deleted") @@ -91,6 +99,22 @@ def _litmusctl(args) status.should_not match(/for testing/) end + it "removes a healthfile for the service with 'remove'" do + _litmusctl('force health 88 test -r "for testing"').should match("File created") + _litmusctl('force remove health test').should match("File deleted") + status = _litmusctl('status passing_test') + status.should match(/Health: \d\d/) + status.should_not match(/for testing/) + end + + it "removes a downfile for the service with 'remove'" do + _litmusctl('force down test -r "for testing"').should match("File created") + _litmusctl('force remove down test').should match("File deleted") + status = _litmusctl('status passing_test') + status.should match(/Health: \d\d/) + status.should_not match(/for testing/) + end + it "returns not found if downfile doesn't exist" do _litmusctl('force down test -d').should match("NOT FOUND") end