mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-27 02:18:41 -05:00
(WIP) notes for next steps
This commit is contained in:
parent
def1a4e596
commit
b1cdc4fbe4
1 changed files with 17 additions and 4 deletions
|
|
@ -56,18 +56,24 @@ describe Vmpooler::API::V1 do
|
||||||
create_vm('testhost')
|
create_vm('testhost')
|
||||||
put "#{prefix}/vm/testhost", '{"tags":{"tested_by":"rspec"}}'
|
put "#{prefix}/vm/testhost", '{"tags":{"tested_by":"rspec"}}'
|
||||||
expect_json(ok = true, http = 200)
|
expect_json(ok = true, http = 200)
|
||||||
|
|
||||||
|
# TODO: test for tag presence
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'skips empty tags' do
|
it 'skips empty tags' do
|
||||||
create_vm('testhost')
|
create_vm('testhost')
|
||||||
put "#{prefix}/vm/testhost", '{"tags":{"tested_by":""}}'
|
put "#{prefix}/vm/testhost", '{"tags":{"tested_by":""}}'
|
||||||
expect_json(ok = true, http = 200)
|
expect_json(ok = true, http = 200)
|
||||||
|
|
||||||
|
# TODO: test for tag presence
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not set tags if request body format is invalid' do
|
it 'does not set tags if request body format is invalid' do
|
||||||
create_vm('testhost')
|
create_vm('testhost')
|
||||||
put "#{prefix}/vm/testhost", '{"tags":{"tested"}}'
|
put "#{prefix}/vm/testhost", '{"tags":{"tested"}}'
|
||||||
expect_json(ok = false, http = 400)
|
expect_json(ok = false, http = 400)
|
||||||
|
|
||||||
|
# TODO: ensure that tags were not set
|
||||||
end
|
end
|
||||||
|
|
||||||
context '(allowed_tags configured)' do
|
context '(allowed_tags configured)' do
|
||||||
|
|
@ -80,6 +86,8 @@ describe Vmpooler::API::V1 do
|
||||||
put "#{prefix}/vm/testhost", '{"tags":{"created_by":"rspec","tested_by":"rspec"}}'
|
put "#{prefix}/vm/testhost", '{"tags":{"created_by":"rspec","tested_by":"rspec"}}'
|
||||||
|
|
||||||
expect_json(ok = false, http = 400)
|
expect_json(ok = false, http = 400)
|
||||||
|
|
||||||
|
# TODO: ensure that tag was not set
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -89,19 +97,24 @@ describe Vmpooler::API::V1 do
|
||||||
# } }
|
# } }
|
||||||
#
|
#
|
||||||
# it 'correctly filters tags' do
|
# it 'correctly filters tags' do
|
||||||
# expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com")
|
# app.settings.set :config, { :config => { tagfilter: { 'url' => '(.*)\/' } } }
|
||||||
#
|
#
|
||||||
# put "#{prefix}/vm/testhost", '{"tags":{"url":"foo.com/something.html"}}'
|
# put "#{prefix}/vm/testhost", '{"tags":{"url":"foo.com/something.html"}}'
|
||||||
#
|
|
||||||
# expect_json(ok = true, http = 200)
|
# expect_json(ok = true, http = 200)
|
||||||
|
#
|
||||||
|
# # expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com")
|
||||||
|
#
|
||||||
|
# # TODO: ensure that filtered tags were set
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# it 'doesn\'t eat tags not matching filter' do
|
# it 'doesn\'t eat tags not matching filter' do
|
||||||
# expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com")
|
# app.settings.set :config, { :config => { tagfilter: { 'url' => '(.*)\/' } } }
|
||||||
#
|
#
|
||||||
# put "#{prefix}/vm/testhost", '{"tags":{"url":"foo.com"}}'
|
# put "#{prefix}/vm/testhost", '{"tags":{"url":"foo.com"}}'
|
||||||
#
|
|
||||||
# expect_json(ok = true, http = 200)
|
# expect_json(ok = true, http = 200)
|
||||||
|
#
|
||||||
|
# # expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com")
|
||||||
|
# # TODO: ensure that filtered tags were set
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue