[NCBC-174] Fix invalid tests in NUnit project. Created: 07/Dec/12  Updated: 11/Nov/13  Resolved: 11/Nov/13

Status: Resolved
Project: Couchbase .NET client library
Component/s: library
Affects Version/s: 1.2 Beta-2, 1.2 Beta-3, 1.2.0
Fix Version/s: 1.3.0

Type: Bug Priority: Major
Reporter: John Zablocki (Inactive) Assignee: Saakshi Manocha
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Dependency
Sub-Tasks:
Key
Summary
Type
Status
Assignee
NCBC-250 Fix the test : CouchbaseAuthenticated... Technical task Closed Saakshi Manocha  
NCBC-283 Fix failing tests for 2.1.1-763 Technical task Resolved Saakshi Manocha  
NCBC-296 Fix the test: When_Observing_A_Remove... Technical task In Progress Saakshi Manocha  

 Comments   
Comment by Saakshi Manocha [ 29/Jan/13 ]
I ran the .net unit tests against the latest code of couchbase-net-client and cluster version 2.0.0-1976
My cluster config comprise of the following nodes:
10.3.121.134
10.3.121.135
10.3.121.136
10.3.3.206

Some of the tests are failing, mostly are related to views. Please find the observations and their possible causes:

1. CouchbaseAuthenticatedViewTests\When_Bucket_Is_Authenticated_View_Returns_Results :

First the test was failing because there was no document getting created in "authenticated" bucket. Supposedly the code was creating the default client object in method CouchbaseClientFactory.CreateCouchbaseClient(), where the bucket name is default. So I changed it the initialization statement to :
_client = new CouchbaseClient("authenticated","secret");
Again running the test, now the documents are getting created for "authenticated" bucket but no views. Infact the test report is:
Couchbase.Tests.CouchbaseAuthenticatedViewTests.When_Bucket_Is_Authenticated_View_Returns_Results:
System.Net.WebException : The remote server returned an error: (404) Not Found.

2. DefaultConfigurationSettingsTests\When_Http_Timeout_Is_Not_Set_And_Using_App_Config_Default_Is_20_Seconds
and
DefaultConfigurationSettingsTests\When_Http_Timeout_Is_Not_Set_And_Using_Code_Config_Default_Is_20_Seconds:

Test fails with the error:
  Expected: 00:00:20
  But was: 00:01:00
Error reason:
In method Couchbase\Configuration\ServersElement.cs -> HttpRequestTimeout(), the following attribute is set:
[ConfigurationProperty("httpRequestTimeout", IsRequired = false, DefaultValue = "00:01:00"), PositiveTimeSpanValidator]
DefaultValue set is 00:01:00, in test we compare the result with 00:00:20, hence the failure.
The DefaultValue in attribute needs to be changed.

3. CouchbaseClusterBucketAdminTests\When_Getting_Cluster_Item_Count_Count_Matches_Interesting_Stats and When_Getting_Bucket_Item_Count_Count_Matches_Basic_Stats:
Error: System.Net.WebException : The remote server returned an error: (404) Not Found.
ErrorSource: This test would run find if we provide the username and password for the cluster. The Http response object returns an error because it is not able to connect to the clusterm possibly error in ConfigurationManager.GetSection(configSectionName) which does not return "couchbase" config section

4. CouchbaseClusterBucketAdminTests\When_Creating_New_Bucket_With_Ram_Quota_Less_Than_100_Argument_Exception_Is_Thrown:
The exception message text was incorrect
Expected message containing: Quota.RAM
 but was: RamQuotaMB must be at least 100
Solution is to change the expected message in test attribute

5. CouchbaseClientObserveTests\When_Storing_A_New_Key_With_Master_Persistence_That_Key_Is_In_View_When_Stale_Is_False:

6. CouchbaseClientObserveTests\When_Storing_A_New_Key_Observe_Will_Fail_When_Cluster_Has_Too_Few_Nodes_For_Replication:
This would run fine if we run on cluster with only one server node.

7. When_Persisting_Json_Id_Is_Not_Serializd_But_Is_Returned_In_View

8. When_Setting_Design_Document_Name_Transformer_To_Dev_Views_Are_Prefixed_With_Dev

9. When_Setting_Design_Document_Name_Transformer_To_Prod_Views_Are_Not_Prefixed
Comment by Saakshi Manocha [ 29/Jan/13 ]
Also, many a times 'Operation time out' errors occur while running the test. I'm running test over VPN, is there any performance issue?
This happens generally with GenericView and SpatialView tests.
Although these tests run fine if debugged separately
Comment by Saakshi Manocha [ 05/Feb/13 ]
Following test failures have been fixed: (http://review.couchbase.org/#/c/24394/)
Refer SDKQE-182 to track status.

1. DefaultConfigurationSettingsTests\When_Http_Timeout_Is_Not_Set_And_Using_App_Config_Default_Is_20_Seconds
  and
2. DefaultConfigurationSettingsTests\When_Http_Timeout_Is_Not_Set_And_Using_Code_Config_Default_Is_20_Seconds:
Test fails with the error:
  Expected: 00:00:20
  But was: 00:01:00
Fix provided: Recommended http time out is 1 minute so change the test and verify that the test is now passing after this change.
 Change request uploaded in Gerrit and pending for code review.

3. CouchbaseClusterBucketAdminTests\When_Creating_New_Bucket_With_Ram_Quota_Less_Than_100_Argument_Exception_Is_Thrown:
  The exception message text was incorrect
Expected message containing: Quota.RAM
 but was: RamQuotaMB must be at least 100
Fix provided : change the expected message in test attribute and verify that the test is now passing after this change.
 Change request uploaded in Gerrit and pending for code review.
  
4. DocHelperTests:
Failure: Expected: String containing ""_id":"8675309""
But was: "{"id":"8675309", "message" : "Test" }"\
Fix provided is: remove the unnecessary underscore from id and test will pass. Change request uploaded in Gerrit and pending for code review.
Comment by Saakshi Manocha [ 04/Mar/13 ]
Few more issues corrected:
(a) http://review.couchbase.org/#/c/24977/
NCBC-234: Return CAS value with ExecuteGetJson

(b) http://review.couchbase.org/#/c/24978/
NCBC-236: Fix view param JSON serialization tests
Comment by Saakshi Manocha [ 04/Mar/13 ]
More tests added :
http://review.couchbase.org/#/c/24980/

1. CouchbaseAuthenticatedViewTests ->
(a) Added new test :
When_Bucket_Is_Authenticated_And_Bad_Credentials_Are_Provided_Exception_Is_Thrown

2. CouchbaseClientGetTests ->
(a) Added new tests:
When_Getting_Multiple_Non_Existent_Keys_Result_Is_Not_Successful
and When_Getting_A_Zero_Length_Key_No_Exception_Is_Thrown_And_Success_Is_False
(b) Renamed
When_Getting_Multiple_Keys_Result_Is_Successful -> When_Getting_Multiple_Existent_Keys_Result_Is_Successful

3. CouchbaseClientObserveTests ->
(a) Added new tests:
When_Storing_A_New_Key_Observe_Will_Succeed_With_Zero_Persistence_And_Zero_Replication
and
When_Storing_A_New_Key_Observe_Will_Pass_With_Replication_More_Than_Available_Nodes
and
When_Storing_A_New_Key_Observe_Will_Fail_With_Persistence_More_Than_Available_Nodes

4. CouchbaseClientCasTests ->
(a) Added new tests:
When_Replacing_Item_With_Valid_Cas_Result_Is_Successful
Comment by Saakshi Manocha [ 08/Jul/13 ]
Solved problem with CouchbaseClientViewNameTransformerTests (8 and 9 points mentioned in description).
Refer here: http://review.couchbase.org/#/c/27312/1
It was using the wrong bucket name.
Changes tracjed in SDKQE-333
Comment by Saakshi Manocha [ 11/Nov/13 ]
closing this ticket and we can work on individual tickets to address invalid tests
Generated at Tue Sep 23 20:15:14 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.