Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 185273c

Browse files
committed
Move IndexView maxTimeMS tests from indexview.t to max_time_ms.t
1 parent 9cd88ab commit 185273c

File tree

2 files changed

+252
-279
lines changed

2 files changed

+252
-279
lines changed

t/indexview.t

Lines changed: 0 additions & 279 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ my $valid_collation = { locale => "en_US", strength => 2 };
4242
my $valid_collation_alternate = { locale => "fr_CA" };
4343
my $invalid_collation = { locale => "en_US", blah => 5 };
4444

45-
my $param = eval {
46-
$conn->get_database('admin')
47-
->run_command( [ getParameter => 1, enableTestCommands => 1 ] );
48-
};
49-
5045
my ($iv);
5146

5247
# XXX work around SERVER-18062; create collection to initialize DB for
@@ -114,79 +109,6 @@ subtest "create_many" => sub {
114109
}
115110
};
116111

117-
subtest "create_many w/ maxTimeMS" => sub {
118-
plan skip_all => "\$ENV{FAILPOINT_TESTING} is false"
119-
unless $ENV{FAILPOINT_TESTING};
120-
121-
plan skip_all => "maxTimeMS not available before 3.6"
122-
unless $server_version >= v3.6.0;
123-
124-
plan skip_all => "enableTestCommands is off"
125-
unless $param && $param->{enableTestCommands};
126-
127-
plan skip_all => "fail points not supported via mongos"
128-
if $server_type eq 'Mongos';
129-
130-
plan skip_all => "not safe to run fail points before Test::Harness 3.31"
131-
if version->parse($ENV{HARNESS_VERSION}) < version->parse(3.31);
132-
133-
$coll->drop;
134-
135-
is(
136-
exception {
137-
$admin->run_command([
138-
configureFailPoint => 'maxTimeAlwaysTimeOut',
139-
mode => 'alwaysOn',
140-
]);
141-
},
142-
undef,
143-
'max time failpoint on',
144-
);
145-
146-
like(
147-
exception {
148-
$iv->create_many(
149-
{ keys => [ x => 1 ] }, { keys => [ y => -1 ] },
150-
{ maxTimeMS => 10 },
151-
);
152-
},
153-
qr/exceeded time limit/,
154-
'timeout for index creation',
155-
);
156-
157-
is(
158-
exception {
159-
$iv->create_many(
160-
{ keys => [ x => 1 ] }, { keys => [ y => -1 ] },
161-
);
162-
},
163-
undef,
164-
'no timeout without max time',
165-
);
166-
167-
is(
168-
exception {
169-
$admin->run_command([
170-
configureFailPoint => 'maxTimeAlwaysTimeOut',
171-
mode => 'off',
172-
]);
173-
},
174-
undef,
175-
'max time failpoint off',
176-
);
177-
178-
is(
179-
exception {
180-
$iv->create_many(
181-
{ keys => [ x => 1 ] }, { keys => [ y => -1 ] },
182-
{ maxTimeMS => 5000 },
183-
);
184-
},
185-
undef,
186-
'no timeout for index creation',
187-
);
188-
};
189-
190112
subtest "list indexes" => sub {
191113
$coll->drop;
192114
$coll->insert_one( {} );
@@ -267,71 +189,6 @@ subtest "create_one" => sub {
267189
}
268190
};
269191

270-
subtest "create_one w/ maxTimeMS" => sub {
271-
plan skip_all => "\$ENV{FAILPOINT_TESTING} is false"
272-
unless $ENV{FAILPOINT_TESTING};
273-
274-
plan skip_all => "maxTimeMS not available before 3.6"
275-
unless $server_version >= v3.6.0;
276-
277-
plan skip_all => "enableTestCommands is off"
278-
unless $param && $param->{enableTestCommands};
279-
280-
plan skip_all => "fail points not supported via mongos"
281-
if $server_type eq 'Mongos';
282-
283-
plan skip_all => "not safe to run fail points before Test::Harness 3.31"
284-
if version->parse($ENV{HARNESS_VERSION}) < version->parse(3.31);
285-
286-
$coll->drop;
287-
288-
is(
289-
exception {
290-
$admin->run_command([
291-
configureFailPoint => 'maxTimeAlwaysTimeOut',
292-
mode => 'alwaysOn',
293-
]);
294-
},
295-
undef,
296-
'max time failpoint on',
297-
);
298-
299-
is(
300-
exception {
301-
$iv->create_one([ x => 1 ]);
302-
},
303-
undef,
304-
'no timeout without max time',
305-
);
306-
307-
like(
308-
exception {
309-
$iv->create_one([ x => 1 ], { maxTimeMS => 10 });
310-
},
311-
qr/exceeded time limit/,
312-
'timeout for index creation',
313-
);
314-
315-
is(
316-
exception {
317-
$admin->run_command([
318-
configureFailPoint => 'maxTimeAlwaysTimeOut',
319-
mode => 'off',
320-
]);
321-
},
322-
undef,
323-
'max time failpoint off',
324-
);
325-
326-
is(
327-
exception {
328-
$iv->create_one([ x => 1 ], { maxTimeMS => 5000 });
329-
},
330-
undef,
331-
'no timeout for index creation',
332-
);
333-
};
334-
335192
subtest "drop_one" => sub {
336193
$coll->drop;
337194
ok( my $name = $iv->create_one( [ x => 1 ] ), "created index on x" );
@@ -368,74 +225,6 @@ subtest "drop_one" => sub {
368225
);
369226
};
370227

371-
subtest "drop_one w/ maxTimeMS" => sub {
372-
plan skip_all => "\$ENV{FAILPOINT_TESTING} is false"
373-
unless $ENV{FAILPOINT_TESTING};
374-
375-
plan skip_all => "maxTimeMS not available before 3.6"
376-
unless $server_version >= v3.6.0;
377-
378-
plan skip_all => "enableTestCommands is off"
379-
unless $param && $param->{enableTestCommands};
380-
381-
plan skip_all => "fail points not supported via mongos"
382-
if $server_type eq 'Mongos';
383-
384-
plan skip_all => "not safe to run fail points before Test::Harness 3.31"
385-
if version->parse($ENV{HARNESS_VERSION}) < version->parse(3.31);
386-
387-
$coll->drop;
388-
389-
is(
390-
exception {
391-
$admin->run_command([
392-
configureFailPoint => 'maxTimeAlwaysTimeOut',
393-
mode => 'alwaysOn',
394-
]);
395-
},
396-
undef,
397-
'max time failpoint on',
398-
);
399-
400-
is(
401-
exception {
402-
my $name = $iv->create_one([ x => 1 ]);
403-
$iv->drop_one($name);
404-
},
405-
undef,
406-
'no timeout without max time',
407-
);
408-
409-
like(
410-
exception {
411-
my $name = $iv->create_one([ x => 1 ]);
412-
$iv->drop_one($name, { maxTimeMS => 10 });
413-
},
414-
qr/exceeded time limit/,
415-
'timeout for index drop',
416-
);
417-
418-
is(
419-
exception {
420-
$admin->run_command([
421-
configureFailPoint => 'maxTimeAlwaysTimeOut',
422-
mode => 'off',
423-
]);
424-
},
425-
undef,
426-
'max time failpoint off',
427-
);
428-
429-
is(
430-
exception {
431-
my $name = $iv->create_one([ x => 1 ]);
432-
$iv->drop_one($name, { maxTimeMS => 5000 });
433-
},
434-
undef,
435-
'no timeout for index drop',
436-
);
437-
};
438-
439228
subtest "drop_all" => sub {
440229
$coll->drop;
441230
$iv->create_many( map { { keys => $_ } }[ x => 1 ], [ y => 1 ], [ z => 1 ] );
@@ -452,74 +241,6 @@ subtest "drop_all" => sub {
452241

453242
};
454243

455-
subtest "drop_all w/ maxTimeMS" => sub {
456-
plan skip_all => "\$ENV{FAILPOINT_TESTING} is false"
457-
unless $ENV{FAILPOINT_TESTING};
458-
459-
plan skip_all => "maxTimeMS not available before 3.6"
460-
unless $server_version >= v3.6.0;
461-
462-
plan skip_all => "enableTestCommands is off"
463-
unless $param && $param->{enableTestCommands};
464-
465-
plan skip_all => "fail points not supported via mongos"
466-
if $server_type eq 'Mongos';
467-
468-
plan skip_all => "not safe to run fail points before Test::Harness 3.31"
469-
if version->parse($ENV{HARNESS_VERSION}) < version->parse(3.31);
470-
471-
$coll->drop;
472-
473-
is(
474-
exception {
475-
$admin->run_command([
476-
configureFailPoint => 'maxTimeAlwaysTimeOut',
477-
mode => 'alwaysOn',
478-
]);
479-
},
480-
undef,
481-
'max time failpoint on',
482-
);
483-
484-
is(
485-
exception {
486-
$iv->create_many( map { { keys => $_ } }[ x => 1 ], [ y => 1 ], [ z => 1 ] );
487-
$iv->drop_all();
488-
},
489-
undef,
490-
'no timeout without max time',
491-
);
492-
493-
like(
494-
exception {
495-
$iv->create_many( map { { keys => $_ } }[ x => 1 ], [ y => 1 ], [ z => 1 ] );
496-
$iv->drop_all({ maxTimeMS => 10 });
497-
},
498-
qr/exceeded time limit/,
499-
'timeout for index drop',
500-
);
501-
502-
is(
503-
exception {
504-
$admin->run_command([
505-
configureFailPoint => 'maxTimeAlwaysTimeOut',
506-
mode => 'off',
507-
]);
508-
},
509-
undef,
510-
'max time failpoint off',
511-
);
512-
513-
is(
514-
exception {
515-
$iv->create_many( map { { keys => $_ } }[ x => 1 ], [ y => 1 ], [ z => 1 ] );
516-
$iv->drop_all({ maxTimeMS => 5000 });
517-
},
518-
undef,
519-
'no timeout for index drop',
520-
);
521-
};
522-
523244
subtest 'handling duplicates' => sub {
524245
$coll->drop;
525246
my $doc = { foo => 1, bar => 1, baz => 1, boo => 1 };

0 commit comments

Comments
 (0)