mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
f342d269ce
To save time, we hoped to use an existing server to read the interface JSON and it did a naive selection of the first server. Server's that are deleted have two relevant characteristics. 1) They no longer have interfaces and 2) they are reported in the output in their deleted state for an hour after being removed. Since the test was not filtering for active servers, subsequent runs could pick up a deleted server and fail to find the identifier for it's missing first interface. This simplifies matters by creating a new server for the test.
33 lines
936 B
Ruby
33 lines
936 B
Ruby
Shindo.tests('Fog::Compute[:brightbox] | interface requests', ['brightbox']) do
|
|
|
|
@test_service = Fog::Compute[:brightbox]
|
|
|
|
tests('success') do
|
|
|
|
unless Fog.mocking?
|
|
@test_server = Brightbox::Compute::TestSupport.get_test_server
|
|
@interface_id = @test_server.interfaces.first["id"]
|
|
|
|
tests("#get_interface('#{@interface_id}')") do
|
|
pending if Fog.mocking?
|
|
result = @test_service.get_interface(@interface_id)
|
|
data_matches_schema(Brightbox::Compute::Formats::Full::INTERFACE, {:allow_extra_keys => true}) { result }
|
|
end
|
|
|
|
@test_server.destroy
|
|
end
|
|
end
|
|
|
|
tests('failure') do
|
|
|
|
tests("#get_interface('int-00000')").raises(Excon::Errors::NotFound) do
|
|
pending if Fog.mocking?
|
|
@test_service.get_interface('int-00000')
|
|
end
|
|
|
|
tests("#get_interface()").raises(ArgumentError) do
|
|
pending if Fog.mocking?
|
|
@test_service.get_interface()
|
|
end
|
|
end
|
|
end
|