xing/racktables_api — pull request #6 by MrMarvin (2014-11-19 16:53:12+00:00)
Title: adds and uses db dump from a fresh 0.20.8 install

We tried to use racktables_api with our racktables 0.20.8 install, however it seems that the database schema is not supported by current racktables_api. Running tests give a few failures:

```
Scenario: Adding a port # features/objects/querying.feature:224
Given I have POSTed this to "/object": # features/step_definitions/api.rb:6
"""
{
"name": "foo",
"type": "VM"
}
"""
When I PATCH this to "/object?name=foo": # features/step_definitions/api.rb:14
"""
{
"ports":
{
"_push":
{
"name": "eth0",
"type": "1000Base-T",
"l2address": "005056bc449b"
}
}
}
"""
Bad query: {"type"=>"1000Base-T"} (Logistician::HTTPError::Class)
./lib/logistician/sequel/repository.rb:290:in `create'
./lib/logistician/sequel/repository.rb:111:in `block (3 levels) in publish'
./lib/logistician/sequel/write.rb:149:in `call'
./lib/logistician/sequel/write.rb:149:in `block in apply_to!'
./lib/logistician/sequel/write.rb:147:in `each'
./lib/logistician/sequel/write.rb:147:in `apply_to!'
./lib/logistician/sequel/update.rb:39:in `block in do_foreign!'
./lib/logistician/sequel/update.rb:38:in `do_foreign!'
./lib/logistician/sequel/update.rb:21:in `do!'
./lib/logistician/repository/multi_resource.rb:104:in `patch'
./lib/logistician/resource.rb:49:in `call'
./lib/logistician/repository/shared.rb:61:in `block in call'
./lib/logistician/context.rb:54:in `use'
./lib/logistician/repository/shared.rb:57:in `call'
(eval):13:in `each'
./lib/logistician/context.rb:37:in `call'
./lib/logistician/context.rb:37:in `call'
./spec/helper/object_router.rb:55:in `mock_request'
./spec/helper/object_router.rb:65:in `/\AI PATCH this to "(.*)":/'
./features/support/api.rb:6:in `block in '
features/objects/querying.feature:232:in `When I PATCH this to "/object?name=foo":'
And I request "/object" # features/step_definitions/api.rb:2
Then the response should be like: # features/step_definitions/api.rb:30
"""
[
{
"name" : "foo",
"type" : "VM",
"ports" : [
{
"name": "eth0",
"type": "1000Base-T",
"l2address": "005056bc449b",
...
}
],
...
}
]
"""

Failing Scenarios:
cucumber features/objects/querying.feature:224 # Scenario: Adding a port

9 scenarios (1 failed, 8 passed)
31 steps (1 failed, 2 skipped, 28 passed)
```
```
Failures:

1) rack object api editing should be possible to add a port
Failure/Error: resp = mock_patch('/object/2', 'ports' => {'_push' => {'name' => 'foo', 'type' => '1000Base-T'} } )
Logistician::HTTPError::Class:
Bad query: {"type"=>"1000Base-T"}
# ./lib/logistician/sequel/repository.rb:290:in `create'
# ./lib/logistician/sequel/repository.rb:111:in `block (3 levels) in publish'
# ./lib/logistician/sequel/write.rb:149:in `call'
# ./lib/logistician/sequel/write.rb:149:in `block in apply_to!'
# ./lib/logistician/sequel/write.rb:147:in `each'
# ./lib/logistician/sequel/write.rb:147:in `apply_to!'
# ./lib/logistician/sequel/update.rb:39:in `block in do_foreign!'
# ./lib/logistician/sequel/update.rb:38:in `do_foreign!'
# ./lib/logistician/sequel/update.rb:21:in `do!'
# ./lib/logistician/repository/single_resource.rb:34:in `block in patch'
# ./lib/logistician/repository/single_resource.rb:32:in `patch'
# ./lib/logistician/resource.rb:49:in `call'
# ./lib/logistician/repository/shared.rb:61:in `block in call'
# ./lib/logistician/context.rb:54:in `use'
# ./lib/logistician/repository/shared.rb:57:in `call'
# (eval):7:in `each'
# ./lib/logistician/context.rb:37:in `call'
# ./lib/logistician/context.rb:37:in `call'
# ./spec/helper/object_router.rb:55:in `mock_request'
# ./spec/helper/object_router.rb:65:in `mock_patch'
# ./spec/api/rack_object_spec.rb:360:in `block (3 levels) in '
# ./spec/helper.rb:20:in `block (2 levels) in '

2) rack object api editing should be possible to add mulitple ports
Failure/Error: resp = mock_patch('/object/2', 'ports' => {'_push' => [ {'name' => 'foo', 'type' => '1000Base-T'}, {'name' => 'bar', 'type' => '1000Base-T'} ] } )
Logistician::HTTPError::Class:
Bad query: {"type"=>"1000Base-T"}
# ./lib/logistician/sequel/repository.rb:290:in `create'
# ./lib/logistician/sequel/repository.rb:105:in `block (4 levels) in publish'
# ./lib/logistician/sequel/repository.rb:105:in `each'
# ./lib/logistician/sequel/repository.rb:105:in `block (3 levels) in publish'
# ./lib/logistician/sequel/write.rb:149:in `call'
# ./lib/logistician/sequel/write.rb:149:in `block in apply_to!'
# ./lib/logistician/sequel/write.rb:147:in `each'
# ./lib/logistician/sequel/write.rb:147:in `apply_to!'
# ./lib/logistician/sequel/update.rb:39:in `block in do_foreign!'
# ./lib/logistician/sequel/update.rb:38:in `do_foreign!'
# ./lib/logistician/sequel/update.rb:21:in `do!'
# ./lib/logistician/repository/single_resource.rb:34:in `block in patch'
# ./lib/logistician/repository/single_resource.rb:32:in `patch'
# ./lib/logistician/resource.rb:49:in `call'
# ./lib/logistician/repository/shared.rb:61:in `block in call'
# ./lib/logistician/context.rb:54:in `use'
# ./lib/logistician/repository/shared.rb:57:in `call'
# (eval):7:in `each'
# ./lib/logistician/context.rb:37:in `call'
# ./lib/logistician/context.rb:37:in `call'
# ./spec/helper/object_router.rb:55:in `mock_request'
# ./spec/helper/object_router.rb:65:in `mock_patch'
# ./spec/api/rack_object_spec.rb:372:in `block (3 levels) in '
# ./spec/helper.rb:20:in `block (2 levels) in '

3) rack object api editing should be possible to remove a port
Failure/Error: mock_patch('/object/2', 'ports' => {'_push' => [ {'name' => 'foo', 'type' => '1000Base-T'}, {'name' => 'bar', 'type' => '1000Base-T'} ] } )
Logistician::HTTPError::Class:
Bad query: {"type"=>"1000Base-T"}
# ./lib/logistician/sequel/repository.rb:290:in `create'
# ./lib/logistician/sequel/repository.rb:105:in `block (4 levels) in publish'
# ./lib/logistician/sequel/repository.rb:105:in `each'
# ./lib/logistician/sequel/repository.rb:105:in `block (3 levels) in publish'
# ./lib/logistician/sequel/write.rb:149:in `call'
# ./lib/logistician/sequel/write.rb:149:in `block in apply_to!'
# ./lib/logistician/sequel/write.rb:147:in `each'
# ./lib/logistician/sequel/write.rb:147:in `apply_to!'
# ./lib/logistician/sequel/update.rb:39:in `block in do_foreign!'
# ./lib/logistician/sequel/update.rb:38:in `do_foreign!'
# ./lib/logistician/sequel/update.rb:21:in `do!'
# ./lib/logistician/repository/single_resource.rb:34:in `block in patch'
# ./lib/logistician/repository/single_resource.rb:32:in `patch'
# ./lib/logistician/resource.rb:49:in `call'
# ./lib/logistician/repository/shared.rb:61:in `block in call'
# ./lib/logistician/context.rb:54:in `use'
# ./lib/logistician/repository/shared.rb:57:in `call'
# (eval):7:in `each'
# ./lib/logistician/context.rb:37:in `call'
# ./lib/logistician/context.rb:37:in `call'
# ./spec/helper/object_router.rb:55:in `mock_request'
# ./spec/helper/object_router.rb:65:in `mock_patch'
# ./spec/api/rack_object_spec.rb:383:in `block (3 levels) in '
# ./spec/helper.rb:20:in `block (2 levels) in '

Finished in 3.35 seconds
40 examples, 3 failures, 3 pending
```