Skip to content

Commit

Permalink
Extend permission verification
Browse files Browse the repository at this point in the history
  • Loading branch information
dann1 committed Oct 13, 2023
1 parent dc08cf7 commit 5829fe6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
5 changes: 1 addition & 4 deletions tests/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@
:endpoint => endpoint
}

RSpec.configure do |c|
c.add_setting :rspec
c.before { @conf = rspec_conf }
end
RSpec.configure {|c| c.before { @conf = rspec_conf } }

############################################################################
# Run tests
Expand Down
8 changes: 7 additions & 1 deletion tests/lib/auth.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
RSpec.shared_context 'auth' do
it 'permission denied on Create' do
it 'permission denied on Create service_template' do
response = @conf[:client][:engine].create(random_faas_minimal)
expect([403, 422].include?(response.code)).to be(true)
end

it 'permission denied on Create vm_template' do
specification = JSON.load_file('templates/sr_faas_denyVMTemplate.json')
response = @conf[:client][:engine].create(specification)
expect([403, 422].include?(response.code)).to be(true)
end

it "Creating #{SR} for auth tests requring an existing #{SR}" do
@conf[:auth] = {}
@conf[:auth][:sr_template] = JSON.load_file('templates/sr_faas_minimal.json')
Expand Down
14 changes: 9 additions & 5 deletions tests/lib/crud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@
runtime = JSON.parse(response.body)
pp runtime

# TODO: Check flow service for failed states like 7 => FAILED_DEPLOYING
next unless runtime['SERVERLESS_RUNTIME']['FAAS']['STATE'] == 'ACTIVE'

verify_sr_spec(@conf[:specification], runtime)
break
case runtime['SERVERLESS_RUNTIME']['FAAS']['STATE']
when 'ACTIVE'
verify_sr_spec(@conf[:specification], runtime)
break
when 'FAILED'
raise 'FaaS VM failed to deploy'
else
next
end
end
end

Expand Down
9 changes: 9 additions & 0 deletions tests/templates/sr_faas_denyVMTemplate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"SERVERLESS_RUNTIME": {
"FAAS": {
"FLAVOUR": "DenyVMTemplate"
},
"SCHEDULING": {},
"DEVICE_INFO": {}
}
}

0 comments on commit 5829fe6

Please sign in to comment.