Skip to content

Commit 89d3ad6

Browse files
committed
test: port 20-no-timeout from python to elixir
1 parent 94e5842 commit 89d3ad6

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

test/elixir/test/config/suite.elixir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,5 +734,8 @@
734734
],
735735
"IgnoreDesignDocsForAllDocsIndexTests": [
736736
"should not return design docs"
737+
],
738+
"LongRunningMangoTest": [
739+
"query does not time out"
737740
]
738741
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
2+
# use this file except in compliance with the License. You may obtain a copy of
3+
# the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations under
11+
# the License.
12+
13+
defmodule LongRunningMangoTest do
14+
use CouchTestCase
15+
16+
@db_name "no-timeout"
17+
18+
setup do
19+
MangoDatabase.recreate(@db_name)
20+
21+
0..100_000
22+
|> Enum.reduce([], fn i, docs ->
23+
docs = [%{"_id" => "#{i}", "another" => "field"} | docs]
24+
25+
if rem(i, 20_000) == 0 do
26+
MangoDatabase.save_docs(@db_name, docs)
27+
[]
28+
else
29+
docs
30+
end
31+
end)
32+
end
33+
34+
test "query does not time out" do
35+
selector = %{"_id" => %{"$gt" => 0}, "another" => "wrong"}
36+
{:ok, docs} = MangoDatabase.find(@db_name, selector)
37+
assert docs == []
38+
end
39+
end

0 commit comments

Comments
 (0)