public void TestGetStatsWithScale() { _collection.Drop(); _collection.Insert(new BsonDocument("x", 1)); // ensure collection is not empty var stats1 = _collection.GetStats(); var args = new GetStatsArgs { Scale = 2 }; var stats2 = _collection.GetStats(args); Assert.AreEqual(stats1.DataSize / 2, stats2.DataSize); }
public void TestGetStatsWithMaxTime() { if (_primary.Supports(FeatureId.MaxTime)) { using (var failpoint = new FailPoint(FailPointName.MaxTimeAlwaysTimeout, _server, _primary)) { if (failpoint.IsSupported()) { _collection.Drop(); _collection.Insert(new BsonDocument("x", 1)); // ensure collection is not empty failpoint.SetAlwaysOn(); var args = new GetStatsArgs { MaxTime = TimeSpan.FromMilliseconds(1) }; Assert.Throws<ExecutionTimeoutException>(() => _collection.GetStats(args)); } } } }