Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge "`bosh releases` shows which releases are in use"

  • Loading branch information...
commit c1a19e410e6a21d1b28f26195fcd7fb14efdb393 2 parents 4566ce0 + 4b39d23
@oppegard oppegard authored Gerrit Code Review committed
View
7 cli/lib/cli/commands/release.rb
@@ -152,9 +152,9 @@ def list
releases_table = table do |t|
t.headings = "Name", "Versions"
releases.each do |r|
- versions = r["versions"].sort do |v1, v2|
+ versions = r["versions"].sort { |v1, v2|
version_cmp(v1, v2)
- end
+ }.map { |v| ((r["in_use"] || []).include?(v)) ? "#{v}*" : v }
t << [r["name"], versions.join(", ")]
end
@@ -162,6 +162,7 @@ def list
nl
say(releases_table)
+ say("(*) Currently deployed")
nl
say("Releases total: %d" % releases.size)
end
@@ -521,4 +522,4 @@ def match_remote_packages(manifest_yaml)
exit(1) unless confirmed?
end
end
-end
+end
View
9 director/lib/director.rb
@@ -249,9 +249,16 @@ def task_timeout?(task)
get "/releases" do
releases = Models::Release.order_by(:name.asc).map do |release|
+ versions_in_use = []
+ versions = release.versions_dataset.order_by(:version.asc).map do |rv|
+ versions_in_use << rv.version.to_s unless rv.deployments.empty?
+ rv.version.to_s
+ end
+
{
"name" => release.name,
- "versions" => release.versions_dataset.order_by(:version.asc).all.map { |rv| rv.version.to_s }
+ "versions" => versions,
+ "in_use" => versions_in_use
}
end
View
259 director/spec/functional/director_controller_spec.rb
@@ -19,7 +19,7 @@
"plugin" => "local",
"properties" => {"blobstore_path" => @blobstore_dir}
}
- Bosh::Director::Config.configure(test_config)
+ BD::Config.configure(test_config)
end
after(:each) do
@@ -42,24 +42,29 @@ def expect_redirect_to_queued_task(response)
response.should be_redirect
(last_response.location =~ /\/tasks\/(\d+)/).should_not be_nil
- new_task = Bosh::Director::Models::Task[$1]
+ new_task = BD::Models::Task[$1]
new_task.state.should == "queued"
new_task
end
+ def payload(content_type, params)
+ {"CONTENT_TYPE" => content_type.to_s,
+ :input => Yajl::Encoder.encode(params)}
+ end
+
it "requires auth" do
get "/"
last_response.status.should == 401
end
- it "allows Basic HTTP Auth with admin/admin credentials for test purposes (even though user doesn't exist)" do
+ it "allows Basic HTTP Auth with admin/admin credentials for " +
+ "test purposes (even though user doesn't exist)" do
basic_authorize "admin", "admin"
get "/"
last_response.status.should == 404
end
describe "Fetching status" do
-
it "not authenticated" do
get "/info"
last_response.status.should == 200
@@ -73,15 +78,14 @@ def expect_redirect_to_queued_task(response)
last_response.status.should == 200
expected = {
"name" => "Test Director",
- "version" => "#{Bosh::Director::VERSION} (#{Bosh::Director::Config.revision})",
- "uuid" => Bosh::Director::Config.uuid,
+ "version" => "#{BD::VERSION} (#{BD::Config.revision})",
+ "uuid" => BD::Config.uuid,
"user" => "admin",
"cpi" => "dummy"
}
Yajl::Parser.parse(last_response.body).should == expected
end
-
end
describe "API calls" do
@@ -89,63 +93,77 @@ def expect_redirect_to_queued_task(response)
describe "creating a stemcell" do
it "expects compressed stemcell file" do
- post "/stemcells", {}, {"CONTENT_TYPE" => "application/x-compressed", :input => spec_asset("tarball.tgz")}
+ post "/stemcells", {},
+ payload("application/x-compressed", spec_asset("tarball.tgz"))
expect_redirect_to_queued_task(last_response)
end
it "only consumes application/x-compressed" do
- post "/stemcells", {}, {"CONTENT_TYPE" => "application/octet-stream", :input => spec_asset("tarball.tgz")}
+ post "/stemcells", {},
+ payload("application/octet-stream", spec_asset("tarball.tgz"))
last_response.status.should == 404
end
end
describe "creating a release" do
it "expects compressed release file" do
- post "/releases", {}, {"CONTENT_TYPE" => "application/x-compressed", :input => spec_asset("tarball.tgz")}
+ post "/releases", {},
+ payload("application/x-compressed", spec_asset("tarball.tgz"))
expect_redirect_to_queued_task(last_response)
end
it "only consumes application/x-compressed" do
- post "/releases", {}, {"CONTENT_TYPE" => "application/octet-stream", :input => spec_asset("tarball.tgz")}
+ post "/releases", {},
+ payload("application/octet-stream", spec_asset("tarball.tgz"))
last_response.status.should == 404
end
end
describe "creating a deployment" do
it "expects compressed deployment file" do
- post "/deployments", {}, {"CONTENT_TYPE" => "text/yaml", :input => spec_asset("test_conf.yaml")}
+ post "/deployments", {},
+ payload("text/yaml", spec_asset("test_conf.yaml"))
expect_redirect_to_queued_task(last_response)
end
it "only consumes text/yaml" do
- post "/deployments", {}, {"CONTENT_TYPE" => "text/plain", :input => spec_asset("test_conf.yaml")}
+ post "/deployments", {},
+ payload("text/plain", spec_asset("test_conf.yaml"))
last_response.status.should == 404
end
end
describe "job management" do
it "allows putting jobs into different states" do
- Bosh::Director::Models::Deployment.create(:name => "foo", :manifest => YAML.dump({"foo" => "bar"}))
- put "/deployments/foo/jobs/nats?state=stopped", {}, {"CONTENT_TYPE" => "text/yaml", :input => spec_asset("test_conf.yaml")}
+ BD::Models::Deployment.
+ create(:name => "foo", :manifest => YAML.dump({"foo" => "bar"}))
+ put "/deployments/foo/jobs/nats?state=stopped", {},
+ payload("text/yaml", spec_asset("test_conf.yaml"))
expect_redirect_to_queued_task(last_response)
end
it "allows putting job instances into different states" do
- Bosh::Director::Models::Deployment.create(:name => "foo", :manifest => YAML.dump({"foo" => "bar"}))
- put "/deployments/foo/jobs/dea/2?state=stopped", {}, {"CONTENT_TYPE" => "text/yaml", :input => spec_asset("test_conf.yaml")}
+ BD::Models::Deployment.
+ create(:name => "foo", :manifest => YAML.dump({"foo" => "bar"}))
+ put "/deployments/foo/jobs/dea/2?state=stopped", {},
+ payload("text/yaml", spec_asset("test_conf.yaml"))
expect_redirect_to_queued_task(last_response)
end
it "doesn't like invalid indices" do
- put "/deployments/foo/jobs/dea/zb?state=stopped", {}, {"CONTENT_TYPE" => "text/yaml", :input => spec_asset("test_conf.yaml")}
+ put "/deployments/foo/jobs/dea/zb?state=stopped", {},
+ payload("text/yaml", spec_asset("test_conf.yaml"))
last_response.status.should == 400
end
end
describe "log management" do
it "allows fetching logs from a particular instance" do
- deployment = Bosh::Director::Models::Deployment.create(:name => "foo", :manifest => YAML.dump({"foo" => "bar"}))
- instance = Bosh::Director::Models::Instance.create(:deployment => deployment, :job => "nats", :index => "0", :state => "started")
+ deployment = BD::Models::Deployment.
+ create(:name => "foo", :manifest => YAML.dump({"foo" => "bar"}))
+ instance = BD::Models::Instance.
+ create(:deployment => deployment, :job => "nats",
+ :index => "0", :state => "started")
get "/deployments/foo/jobs/nats/0/logs", {}
expect_redirect_to_queued_task(last_response)
end
@@ -156,7 +174,8 @@ def expect_redirect_to_queued_task(response)
end
it "404 if no deployment" do
- deployment = Bosh::Director::Models::Deployment.create(:name => "bar", :manifest => YAML.dump({"foo" => "bar"}))
+ deployment = BD::Models::Deployment.
+ create(:name => "bar", :manifest => YAML.dump({"foo" => "bar"}))
get "/deployments/bar/jobs/nats/0/logs", {}
last_response.status.should == 404
end
@@ -165,7 +184,9 @@ def expect_redirect_to_queued_task(response)
describe "listing stemcells" do
it "has API call that returns a list of stemcells in JSON" do
stemcells = (1..10).map do |i|
- Bosh::Director::Models::Stemcell.create(:name => "stemcell-#{i}", :version => i, :cid => rand(25000 * i))
+ BD::Models::Stemcell.
+ create(:name => "stemcell-#{i}", :version => i,
+ :cid => rand(25000 * i))
end
get "/stemcells", {}, {}
@@ -176,8 +197,13 @@ def expect_redirect_to_queued_task(response)
body.kind_of?(Array).should be_true
body.size.should == 10
- response_collection = body.map { |e| [e["name"], e["version"], e["cid"]] }
- expected_collection = stemcells.sort_by { |e| e.name }.map { |e| [e.name.to_s, e.version.to_s, e.cid.to_s] }
+ response_collection = body.map do |e|
+ [e["name"], e["version"], e["cid"]]
+ end
+
+ expected_collection = stemcells.sort_by { |e| e.name }.map do |e|
+ [e.name.to_s, e.version.to_s, e.cid.to_s]
+ end
response_collection.should == expected_collection
end
@@ -194,10 +220,13 @@ def expect_redirect_to_queued_task(response)
describe "listing releases" do
it "has API call that returns a list of releases in JSON" do
releases = (1..10).map do |i|
- release = Bosh::Director::Models::Release.create(:name => "release-#{i}")
+ release = BD::Models::Release.create(:name => "release-#{i}")
(0..rand(3)).each do |v|
- Bosh::Director::Models::ReleaseVersion.create(:release => release, :version => v)
+ BD::Models::ReleaseVersion.
+ create(:release => release, :version => v)
end
+ d = BD::Models::Deployment.create(:name => "deployment-#{i}")
+ d.add_release_version(release.versions.sample)
release
end
@@ -208,8 +237,18 @@ def expect_redirect_to_queued_task(response)
body.kind_of?(Array).should be_true
body.size.should == 10
- response_collection = body.map { |e| [e["name"], e["versions"].join(" ")] }
- expected_collection = releases.sort_by { |e| e.name }.map { |e| [e.name.to_s, e.versions.map { |v| v.version.to_s }.join(" ")] }
+ response_collection = body.map do |e|
+ [e["name"], e["versions"].join(" "), e["in_use"].join(" ")]
+ end
+
+ expected_collection = releases.sort_by { |e| e.name }.map do |e|
+ [e.name.to_s,
+ e.versions.map { |v| v.version.to_s }.join(" "),
+ e.versions_dataset.order_by(:version.asc).reject { |rv|
+ rv.deployments.empty?
+ }.map { |rv| rv.version }.join(" ")
+ ]
+ end
response_collection.should == expected_collection
end
@@ -226,7 +265,7 @@ def expect_redirect_to_queued_task(response)
describe "listing deployments" do
it "has API call that returns a list of deployments in JSON" do
deployments = (1..10).map do |i|
- Bosh::Director::Models::Deployment.create(:name => "deployment-#{i}")
+ BD::Models::Deployment.create(:name => "deployment-#{i}")
end
get "/deployments", {}, {}
@@ -237,7 +276,9 @@ def expect_redirect_to_queued_task(response)
body.size.should == 10
response_collection = body.map { |e| [e["name"]] }
- expected_collection = deployments.sort_by { |e| e.name }.map { |e| [e.name.to_s] }
+ expected_collection = deployments.sort_by { |e| e.name }.map do |e|
+ [e.name.to_s]
+ end
response_collection.should == expected_collection
end
@@ -245,7 +286,9 @@ def expect_redirect_to_queued_task(response)
describe "getting deployment info" do
it "returns manifest" do
- deployment = Bosh::Director::Models::Deployment.create(:name => "test_deployment", :manifest => YAML.dump({"foo" => "bar"}))
+ deployment = BD::Models::Deployment.
+ create(:name => "test_deployment",
+ :manifest => YAML.dump({"foo" => "bar"}))
get "/deployments/test_deployment"
last_response.status.should == 200
@@ -256,15 +299,27 @@ def expect_redirect_to_queued_task(response)
describe "getting deployment vms info" do
it "returns a list of agent_ids, jobs and indices" do
- deployment = Bosh::Director::Models::Deployment.create(:name => "test_deployment", :manifest => YAML.dump({"foo" => "bar"}))
+ deployment = BD::Models::Deployment.
+ create(:name => "test_deployment",
+ :manifest => YAML.dump({"foo" => "bar"}))
vms = []
15.times do |i|
- vm_params = {"agent_id" => "agent-#{i}", "cid" => "cid-#{i}", "deployment_id" => deployment.id}
- vm = Bosh::Director::Models::Vm.create(vm_params)
-
- instance_params = {"deployment_id" => deployment.id, "vm_id" => vm.id, "job" => "job-#{i}", "index" => i, "state" => "started"}
- instance = Bosh::Director::Models::Instance.create(instance_params)
+ vm_params = {
+ "agent_id" => "agent-#{i}",
+ "cid" => "cid-#{i}",
+ "deployment_id" => deployment.id
+ }
+ vm = BD::Models::Vm.create(vm_params)
+
+ instance_params = {
+ "deployment_id" => deployment.id,
+ "vm_id" => vm.id,
+ "job" => "job-#{i}",
+ "index" => i,
+ "state" => "started"
+ }
+ instance = BD::Models::Instance.create(instance_params)
end
get "/deployments/test_deployment/vms"
@@ -275,15 +330,20 @@ def expect_redirect_to_queued_task(response)
body.size.should == 15
15.times do |i|
- body[i].should == {"agent_id" => "agent-#{i}", "job" => "job-#{i}", "index" => i, "cid" => "cid-#{i}"}
+ body[i].should == {
+ "agent_id" => "agent-#{i}",
+ "job" => "job-#{i}",
+ "index" => i,
+ "cid" => "cid-#{i}"
+ }
end
end
end
describe "deleting release" do
it "deletes the whole release" do
- release = Bosh::Director::Models::Release.create(:name => "test_release")
- release.add_version(Bosh::Director::Models::ReleaseVersion.make(:version => "1"))
+ release = BD::Models::Release.create(:name => "test_release")
+ release.add_version(BD::Models::ReleaseVersion.make(:version => "1"))
release.save
delete "/releases/test_release"
@@ -291,8 +351,8 @@ def expect_redirect_to_queued_task(response)
end
it "deletes a particular version" do
- release = Bosh::Director::Models::Release.create(:name => "test_release")
- release.add_version(Bosh::Director::Models::ReleaseVersion.make(:version => "1"))
+ release = BD::Models::Release.create(:name => "test_release")
+ release.add_version(BD::Models::ReleaseVersion.make(:version => "1"))
release.save
delete "/releases/test_release?version=1"
@@ -302,9 +362,9 @@ def expect_redirect_to_queued_task(response)
describe "getting release info" do
it "returns versions" do
- release = Bosh::Director::Models::Release.create(:name => "test_release")
+ release = BD::Models::Release.create(:name => "test_release")
(1..10).map do |i|
- release.add_version(Bosh::Director::Models::ReleaseVersion.make(:version => i))
+ release.add_version(BD::Models::ReleaseVersion.make(:version => i))
end
release.save
@@ -323,7 +383,7 @@ def expect_redirect_to_queued_task(response)
describe "listing tasks" do
it "has API call that returns a list of running tasks" do
["queued", "processing", "cancelling", "done"].each do |state|
- (1..20).map { |i| Bosh::Director::Models::Task.make(
+ (1..20).map { |i| BD::Models::Task.make(
:type => :update_deployment,
:state => state,
:timestamp => Time.now.to_i - i) }
@@ -341,7 +401,7 @@ def expect_redirect_to_queued_task(response)
it "has API call that returns a list of recent tasks" do
["queued", "processing"].each do |state|
- (1..20).map { |i| Bosh::Director::Models::Task.make(
+ (1..20).map { |i| BD::Models::Task.make(
:type => :update_deployment,
:state => state,
:timestamp => Time.now.to_i - i) }
@@ -355,7 +415,8 @@ def expect_redirect_to_queued_task(response)
describe "polling task status" do
it "has API call that return task status" do
- post "/releases", {}, {"CONTENT_TYPE" => "application/x-compressed", :input => spec_asset("tarball.tgz")}
+ post "/releases", {},
+ payload("application/x-compressed", spec_asset("tarball.tgz"))
new_task_id = last_response.location.match(/\/tasks\/(\d+)/)[1]
get "/tasks/#{new_task_id}"
@@ -366,7 +427,7 @@ def expect_redirect_to_queued_task(response)
task_json["state"].should == "queued"
task_json["description"].should == "create release"
- task = Bosh::Director::Models::Task[new_task_id]
+ task = BD::Models::Task[new_task_id]
task.state = "processed"
task.save
@@ -379,7 +440,8 @@ def expect_redirect_to_queued_task(response)
end
it "has API call that return task output and task output with ranges" do
- post "/releases", {}, {"CONTENT_TYPE" => "application/x-compressed", :input => spec_asset("tarball.tgz")}
+ post "/releases", {},
+ payload("application/x-compressed", spec_asset("tarball.tgz"))
new_task_id = last_response.location.match(/\/tasks\/(\d+)/)[1]
@@ -387,7 +449,7 @@ def expect_redirect_to_queued_task(response)
output_file.print("Test output")
output_file.close
- task = Bosh::Director::Models::Task[new_task_id]
+ task = BD::Models::Task[new_task_id]
task.output = @temp_dir
task.save
@@ -397,14 +459,15 @@ def expect_redirect_to_queued_task(response)
end
it "has API call that return task output with ranges" do
- post "/releases", {}, {"CONTENT_TYPE" => "application/x-compressed", :input => spec_asset("tarball.tgz")}
+ post "/releases", {},
+ payload("application/x-compressed", spec_asset("tarball.tgz"))
new_task_id = last_response.location.match(/\/tasks\/(\d+)/)[1]
output_file = File.new(File.join(@temp_dir, "debug"), 'w+')
output_file.print("Test output")
output_file.close
- task = Bosh::Director::Models::Task[new_task_id]
+ task = BD::Models::Task[new_task_id]
task.output = @temp_dir
task.save
@@ -430,7 +493,7 @@ def expect_redirect_to_queued_task(response)
output_file.close
end
- task = Bosh::Director::Models::Task.new
+ task = BD::Models::Task.new
task.state = "done"
task.type = :update_deployment
task.timestamp = Time.now.to_i
@@ -483,14 +546,15 @@ def expect_redirect_to_queued_task(response)
end
it "can fetch resources from blobstore" do
- id = Bosh::Director::Config.blobstore.create("some data")
+ id = BD::Config.blobstore.create("some data")
get "/resources/#{id}"
last_response.status.should == 200
last_response.body.should == "some data"
end
it "cleans up temp file after serving it" do
- tmp_file = File.join(Dir.tmpdir, "resource-#{UUIDTools::UUID.random_create}")
+ tmp_file = File.join(Dir.tmpdir,
+ "resource-#{UUIDTools::UUID.random_create}")
File.open(tmp_file, "w") do |f|
f.write("some data")
@@ -498,7 +562,7 @@ def expect_redirect_to_queued_task(response)
FileUtils.touch(tmp_file)
manager = mock("manager")
- Bosh::Director::Api::ResourceManager.stub!(:new).and_return(manager)
+ BD::Api::ResourceManager.stub!(:new).and_return(manager)
manager.stub!(:get_resource_path).with("deadbeef").and_return(tmp_file)
File.exists?(tmp_file).should be_true
@@ -509,69 +573,68 @@ def expect_redirect_to_queued_task(response)
end
describe "users" do
+ let (:username) { "john" }
+ let (:password) { "123" }
+ let (:user_data) {{"username" => "john", "password" => "123"}}
+
it "creates a user" do
- Bosh::Director::Models::User.all.size.should == 0
+ BD::Models::User.all.size.should == 0
- user_data = Yajl::Encoder.encode({"username" => "john", "password" => "123"})
- post "/users", {}, {"CONTENT_TYPE" => "application/json", :input => user_data}
+ post "/users", {}, payload("application/json", user_data)
- new_user = Bosh::Director::Models::User[:username => "john"]
+ new_user = BD::Models::User[:username => username]
new_user.should_not be_nil
- BCrypt::Password.new(new_user.password).should == "123"
+ BCrypt::Password.new(new_user.password).should == password
end
it "doesn't create a user with exising username" do
- user_data = Yajl::Encoder.encode({"username" => "john", "password" => "123"})
- post "/users", {}, {"CONTENT_TYPE" => "application/json", :input => user_data}
+ post "/users", {}, payload("application/json", user_data)
- login_as("john", "123")
- post "/users", {}, {"CONTENT_TYPE" => "application/json", :input => user_data}
+ login_as(username, password)
+ post "/users", {}, payload("application/json", user_data)
last_response.status.should == 400
- Bosh::Director::Models::User.all.size.should == 1
+ BD::Models::User.all.size.should == 1
end
it "updates user password but not username" do
- user_data = Yajl::Encoder.encode({"username" => "john", "password" => "123"})
- post "/users", {}, {"CONTENT_TYPE" => "application/json", :input => user_data}
+ post "/users", {}, payload("application/json", user_data)
- login_as("john", "123")
- new_data = Yajl::Encoder.encode({"username" => "john", "password" => "456"})
- put "/users/john", {}, {"CONTENT_TYPE" => "application/json", :input => new_data}
+ login_as(username, password)
+ new_data = {"username" => username, "password" => "456"}
+ put "/users/#{username}", {}, payload("application/json", new_data)
last_response.status.should == 204
- user = Bosh::Director::Models::User[:username => "john"]
+ user = BD::Models::User[:username => username]
BCrypt::Password.new(user.password).should == "456"
- login_as("john", "456")
- change_name = Yajl::Encoder.encode({"username" => "john2", "password" => "123"})
- put "/users/john", {}, {"CONTENT_TYPE" => "application/json", :input => change_name}
+ login_as(username, "456")
+ change_name = {"username" => "john2", "password" => password}
+ put "/users/#{username}", {}, payload("application/json", change_name)
last_response.status.should == 400
- last_response.body.should == "{\"code\":20001,\"description\":\"The username is immutable\"}"
+ last_response.body.should ==
+ "{\"code\":20001,\"description\":\"The username is immutable\"}"
end
it "deletes user" do
- user_data = Yajl::Encoder.encode({"username" => "john", "password" => "123"})
- post "/users", {}, {"CONTENT_TYPE" => "application/json", :input => user_data}
+ post "/users", {}, payload("application/json", user_data)
- login_as("john", "123")
- delete "/users/john"
+ login_as(username, password)
+ delete "/users/#{username}"
last_response.status.should == 204
- user = Bosh::Director::Models::User[:username => "john"]
+ user = BD::Models::User[:username => username]
user.should be_nil
end
end
describe "property management" do
- def payload(params)
- {"CONTENT_TYPE" => "application/json", :input => Yajl::Encoder.encode(params)}
- end
+ it "REST API for creating, updating, getting and deleting " +
+ "deployment properties" do
- it "REST API for creating, updating, getting and deleting deployment properties" do
- deployment = Bosh::Director::Models::Deployment.make(:name => "mycloud")
+ deployment = BD::Models::Deployment.make(:name => "mycloud")
get "/deployments/mycloud/properties/foo"
last_response.status.should == 404
@@ -579,7 +642,8 @@ def payload(params)
get "/deployments/othercloud/properties/foo"
last_response.status.should == 404
- post "/deployments/mycloud/properties", {}, payload(:name => "foo", :value => "bar")
+ post "/deployments/mycloud/properties", {},
+ payload("application/json", {:name => "foo", :value => "bar"})
last_response.status.should == 204
get "/deployments/mycloud/properties/foo"
@@ -589,7 +653,8 @@ def payload(params)
get "/deployments/othercloud/properties/foo"
last_response.status.should == 404
- put "/deployments/mycloud/properties/foo", {}, payload(:value => "baz")
+ put "/deployments/mycloud/properties/foo", {},
+ payload("application/json", :value => "baz")
last_response.status.should == 204
get "/deployments/mycloud/properties/foo"
@@ -605,12 +670,8 @@ def payload(params)
describe "problem management" do
- def payload(params)
- {"CONTENT_TYPE" => "application/json", :input => Yajl::Encoder.encode(params)}
- end
-
it "exposes problem managent REST API" do
- deployment = Bosh::Director::Models::Deployment.make(:name => "mycloud")
+ deployment = BD::Models::Deployment.make(:name => "mycloud")
get "/deployments/mycloud/problems"
last_response.status.should == 200
@@ -619,13 +680,17 @@ def payload(params)
post "/deployments/mycloud/scans"
expect_redirect_to_queued_task(last_response)
- put "/deployments/mycloud/problems", payload(:solutions => {42 => "do_this", 43 => "do_that", 44 => nil})
+ put "/deployments/mycloud/problems",
+ payload("application/json",
+ :solutions => {42 => "do_this", 43 => "do_that", 44 => nil})
last_response.status.should == 404
- problem = Bosh::Director::Models::DeploymentProblem.
- create(:deployment_id => deployment.id, :resource_id => 2, :type => "test", :state => "open", :data => {})
+ problem = BD::Models::DeploymentProblem.
+ create(:deployment_id => deployment.id, :resource_id => 2,
+ :type => "test", :state => "open", :data => {})
- put "/deployments/mycloud/problems", {}, payload(:solution => "default")
+ put "/deployments/mycloud/problems", {},
+ payload("application/json", :solution => "default")
expect_redirect_to_queued_task(last_response)
end
end
View
3  spec/cli_spec.rb
@@ -323,6 +323,7 @@ def expect_output(cmd, expected_output)
+--------------+----------+
| bosh-release | 0.1-dev |
+--------------+----------+
+ (*) Currently deployed
Releases total: 1
OUT
@@ -485,4 +486,4 @@ def expect_output(cmd, expected_output)
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.