M1: doc-level free list, sessions, and a spec runner that no longer overstates #1
@@ -3157,13 +3157,13 @@ fn run_for_code(ctx: *Context, name: []const u8, value: bson.Value, extra: []con
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn doc_count(ctx: *Context, coll: []const u8) !i64 {
|
fn doc_count(ctx: *Context, coll: []const u8) !i32 {
|
||||||
var reply = wire.Reply.init(testing.allocator);
|
var reply = wire.Reply.init(testing.allocator);
|
||||||
defer reply.deinit();
|
defer reply.deinit();
|
||||||
var msg = try parse_fake_msg("count", .{ .string = coll }, &.{});
|
var msg = try parse_fake_msg("count", .{ .string = coll }, &.{});
|
||||||
defer msg.deinit();
|
defer msg.deinit();
|
||||||
try dispatch(ctx, &msg, &reply);
|
try dispatch(ctx, &msg, &reply);
|
||||||
return bson.get_pair(reply.pairs.items, "n").?.int64;
|
return bson.get_pair(reply.pairs.items, "n").?.int32;
|
||||||
}
|
}
|
||||||
|
|
||||||
test "a well-formed session id changes nothing and is not echoed" {
|
test "a well-formed session id changes nothing and is not echoed" {
|
||||||
@@ -3191,7 +3191,7 @@ test "a well-formed session id changes nothing and is not echoed" {
|
|||||||
// mongod answers a well-formed lsid with exactly `{ok: 1}` and no echo,
|
// mongod answers a well-formed lsid with exactly `{ok: 1}` and no echo,
|
||||||
// measured; a driver reads only `$clusterTime` and `operationTime` back.
|
// measured; a driver reads only `$clusterTime` and `operationTime` back.
|
||||||
try testing.expect(bson.get_pair(reply.pairs.items, "lsid") == null);
|
try testing.expect(bson.get_pair(reply.pairs.items, "lsid") == null);
|
||||||
try testing.expectEqual(@as(i64, 1), try doc_count(&ctx, "sess"));
|
try testing.expectEqual(@as(i32, 1), try doc_count(&ctx, "sess"));
|
||||||
}
|
}
|
||||||
|
|
||||||
test "a malformed session id is refused without leaking a lock" {
|
test "a malformed session id is refused without leaking a lock" {
|
||||||
@@ -3271,7 +3271,7 @@ test "a transactional write is refused rather than applied" {
|
|||||||
.{ .key = "startTransaction", .value = .{ .bool = true } },
|
.{ .key = "startTransaction", .value = .{ .bool = true } },
|
||||||
.{ .key = "autocommit", .value = .{ .bool = false } },
|
.{ .key = "autocommit", .value = .{ .bool = false } },
|
||||||
})).?);
|
})).?);
|
||||||
try testing.expectEqual(@as(i64, 0), try doc_count(&ctx, "txn"));
|
try testing.expectEqual(@as(i32, 0), try doc_count(&ctx, "txn"));
|
||||||
|
|
||||||
// The order the checks fire in is mongod's, measured: a missing session id
|
// The order the checks fire in is mongod's, measured: a missing session id
|
||||||
// is reported before the standalone refusal, and a bad type before both.
|
// is reported before the standalone refusal, and a bad type before both.
|
||||||
@@ -3289,7 +3289,7 @@ test "a transactional write is refused rather than applied" {
|
|||||||
.{ .key = "lsid", .value = lsid },
|
.{ .key = "lsid", .value = lsid },
|
||||||
.{ .key = "startTransaction", .value = .{ .bool = true } },
|
.{ .key = "startTransaction", .value = .{ .bool = true } },
|
||||||
})).?);
|
})).?);
|
||||||
try testing.expectEqual(@as(i64, 0), try doc_count(&ctx, "txn"));
|
try testing.expectEqual(@as(i32, 0), try doc_count(&ctx, "txn"));
|
||||||
}
|
}
|
||||||
|
|
||||||
test "endSessions judges the array it is handed" {
|
test "endSessions judges the array it is handed" {
|
||||||
|
|||||||
Reference in New Issue
Block a user