[CSHARP-394] Possible bug found via unit tests Created: 16/Feb/12  Updated: 02/Apr/15  Resolved: 18/Feb/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.4
Fix Version/s: 1.4

Type: Bug Priority: Minor - P4
Reporter: Robert Poskevich Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: driver, query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mono 2.10.8, Mongo 1.8.2



 Description   

In running the unit tests under CSharpDriver-2010, I encountered 1 failure at DriverOnlineTests => Linq => SelectQueryTests => TestWhereTripleAnd.

The test involves the query provided below. It fails asserting that the result count is 2, because the result count of this query for me is 0. The issue seems to be with the redundancy of using $gte on the same field. If I remove either "c.X >= 0" or "c.X >= 1", the query properly returns 2 results. Additionally, if I add "!c.B", the query properly returns 2 results, and so there does not seem to be an issue with Triple And in and of itself.

var query = from c in _collection.AsQueryable<C>()
where c.X >= 0 && c.X >= 1 && c.Y == 11
select c;

I tried searching for this. My apologies if this issue is redundant or already solved.



 Comments   
Comment by Robert Stam [ 19/Feb/12 ]

I don't believe the TestBitmap failure can be explained by line endings. It seems to be something weird (possibly even a bug) in how Mono save a Bitmap to a binary stream.

Comment by Robert Poskevich [ 19/Feb/12 ]

Can the discrepancy in line endings account for the failure I am seeing at the following line in the afore-mentioned unit test?

Assert.IsTrue(GetBytes(bitmap).SequenceEqual(GetBytes(r.B)));

I did notice a few unit tests failed because of this line ending issue. The message of the thrown Exception did not match the "Expected Message." This was no big deal for me and was easily remedied. I'm not sure that this is the issue I reported though.

Comment by Robert Stam [ 18/Feb/12 ]

The unit tests were failing only because Mac OS X has a different line ending convention. I've modified the unit tests to only check the first line of the error message.

I'm closing this issue. See CSHARP-398 which was created for the TestBitmap unit test (which passes on Windows both in Mono and .NET).

Comment by Robert Poskevich [ 16/Feb/12 ]

In that case, then, there is one other issue. A unit test also fails at DriverOnlineTests => Jira => CSharp355Tests => TestBitmap.

It fails on the last line (copied below), where all values in the byte arrays are identical up unto the last couple of indexes (specifically, there are two 0 values in "r.B" which are 255 in "bitmap").

Assert.IsTrue(GetBytes(bitmap).SequenceEqual(GetBytes(r.B)));

Thanks and happy hunting.

Comment by Robert Stam [ 16/Feb/12 ]

Thanks for reporting this. This is a very recently added unit test and I hadn't run it on Mono yet. Every now and then Mono does something weird different from .NET and I have to find a workaround.

Generated at Wed Feb 07 21:36:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.