add test for statement timeout error in arcgis connector

pull/13518/head
Alberto Romeu 7 years ago
parent 452ccee8f3
commit 672bb5b37b

@ -0,0 +1,105 @@
{
"objectIdFieldName": "OBJECTID",
"objectIds": [
2133,
2134,
2137,
2138,
2141,
2142,
2143,
2144,
2145,
2146,
2147,
2148,
2149,
2150,
2151,
2152,
2153,
2154,
2155,
2156,
2157,
2158,
2159,
2160,
2161,
2163,
2164,
2165,
2166,
2167,
2168,
2169,
2170,
2171,
2172,
2173,
2174,
2175,
2176,
2177,
2178,
2179,
2180,
2182,
2183,
2184,
2185,
2186,
2187,
2188,
2189,
2191,
2192,
2194,
2195,
2196,
2197,
2198,
2199,
2200,
2201,
2202,
2203,
2205,
2206,
2207,
2208,
2209,
2210,
2213,
2215,
2217,
2218,
2219,
2220,
2221,
2222,
2223,
2224,
2225,
2226,
2227,
2228,
2230,
2231,
2232,
2233,
2234,
2235,
2236,
2237,
2238,
2239,
2240,
2241,
2242,
2243,
2244,
2245,
2246
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -455,18 +455,17 @@ describe DataImport do
end
describe 'arcgis connector' do
# before :each do
# CartoDB::Importer2::QueryBatcher.any_instance
# .stubs(:execute_update)
# .and_raise(Sequel::DatabaseError)
# .new('canceling statement due to statement timeout')
# end
# after :each do
# CartoDB::Importer2::QueryBatcher.unstub(:execute_update)
# end
it 'should run fallback for streamed connectors when Ogr2Ogr ERROR' do
before :each do
CartoDB::Importer2::QueryBatcher.any_instance
.stubs(:execute_update)
.raises(Sequel::DatabaseError, 'canceling statement due to statement timeout')
end
after :each do
CartoDB::Importer2::QueryBatcher.unstub(:execute_update)
end
it 'should raise statement timeout error when the query batcher raise that exception' do
# Metadata of a layer
Typhoeus.stub(/\/arcgis\/rest\/services\/Planning\/EPI_Primary_Planning_Layers\/MapServer\/2\?f=json/) do
body = File.read(File.join(File.dirname(__FILE__), "../fixtures/arcgis_metadata.json"))
@ -488,15 +487,8 @@ describe DataImport do
end
Typhoeus.stub(/\/arcgis\/rest\/(.*)query$/) do |response|
if response.options[:body][:objectIds].to_i == 2133
# First item fetch of a layer
body = File.read(File.join(File.dirname(__FILE__), "../fixtures/arcgis_response_valid.json"))
body = ::JSON.parse(body)
else
# Remaining items fetch of a layer, will not use :objectIds
body = File.read(File.join(File.dirname(__FILE__), "../fixtures/arcgis_response_invalid.json"))
body = ::JSON.parse(body)
end
body = File.read(File.join(File.dirname(__FILE__), "../fixtures/arcgis_response_valid.json"))
body = ::JSON.parse(body)
Typhoeus::Response.new(
code: 200,
@ -512,7 +504,7 @@ describe DataImport do
)
data_import.run_import!
data_import.state.should eq 'failure'
data_import.error_code.should eq 2001
data_import.error_code.should eq 6667
end
end

Loading…
Cancel
Save