DESCRIPTION

CBQE:3685- Create a structure to encapsulate bucket creation params.
I changed cluster.py's create bucket commands to accept a dict. I also added a method inside cluster.py that takes in bucket parameters and returns a dict that contains those parameters. This dict is then passed to the create bucket commands which then passes those to the CreateBucketTask. Inside CreateBucketTask the dictionary is unpacked and the parameters are sent to the rest_client.create_bucket command. The rest of the changes are everywhere that the cluster create bucket commands are used. The conf file I changed was to fix the spelling of structure, I also fixed the affected tests method header to spell structure correctly. Finally I modified BaseTestCase to create dicts and then send them to the cluster create calls, essentially just modified BaseTestCase to work with the above changes.

UPDATE:in addition to the above changes I have refactored BaseTestCase to createa dictionary of default parameters for cluster to use.The dictionary contains keys to signify which type of bucket it is the default for.
	ex. self.base_params['sasl'] contains the sasl default params.
 I have also modified cluster's create bucket method headers again to take in a name parameter. Standard and memcached bucket creators also take in a port parameter.

Change-Id: I8afc1753e3519b5692811c7a9c160530dc25c447


COMMENTS

author: Hugo Blankenship
date: 2016-12-08 22:58:31.378000000

Patch Set 6: Well-Formed-1

Branch restricted. PLEASE READ this URL: 

http://server.jenkins.couchbase.com/job/restricted-branch-check/31546/artifact/restricted.html : FAILURE

-------------------------------------
author: Nico George
date: 2016-12-09 20:57:18.245000000

Patch Set 6: Code-Review-1

(13 comments)

Line:592, pytests/security/auditcli.py -> both from_bucket and to_bucket can be set as if else option 
bucket_param code is same almost

Line:58, pytests/basetestcase.py -> use {} in stead of dict()

Line:271, pytests/basetestcase.py -> having a field with type of bucket in self.base_params will be easy.

Line:450, pytests/basetestcase.py -> Duplicate code . Keep it in one place

Line:20, lib/couchbase_helper/cluster.py -> For parameters use **args and kwargs

Line:43, lib/couchbase_helper/cluster.py -> use {} instead of dict()

Line:58, lib/couchbase_helper/cluster.py -> It will be better to merge all bucket creation into same function.

Line:2017, pytests/clitest/couchbase_clitest.py -> In every where you need to all two methods same time. create_bucket_params and create_default_bucket .   If all calls redirect to cluster.py , we do not need create_params every where we call the create_default_bucket.

Line:53, pytests/transfer/recoverBraylon Arnoldsetransfer.py -> all three bucket creation are same, having uniform function for bucket_create  is more efficient

Line:1148, pytests/xdcr/xdcrnewbasetests.py -> These tests are not inherited from basetestcase. Create_ssl_buckets and Create_default_buckets are part of basetestcase. Can we remove all these code duplication as part of this change ? It will be easier.

Line:600, pytests/security/rbacclitests.py -> use if else for bucket options. rest are same

Line:1654, pytests/fts/fts_base.py -> This is also not inheriting the base class.

Line:207, lib/tasks/task.py -> If if you are writing to whole bucket_params dictionary , why can't we make a dynamic variable. Like using getattr. if new parameters are added to bucket always need to change every places. These parameters are used in rest.create.bucket only Once.  Can we make change in rest.create.bucket API itself to do. This way removing all wrapping unwrapping

-------------------------------------
author: Nico George
date: 2016-12-09 23:08:40.212000000

Patch Set 6:

(1 comment)

Line:20, lib/couchbase_helper/cluster.py -> following the design pattern
Client should always call the abstraction (interface) and not the exact implementation.
Future changes should not impact the existing system.
Change always what is changing.

-------------------------------------
