[ 
https://issues.apache.org/jira/browse/AMBARI-4339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Onischuk updated AMBARI-4339:
------------------------------------

    Description: 
Add a base unittest class for tests of components, which would encapsulate:
1. Any work with internals of resource_management framework
2. Dynamic pythonpaath modification
3. Dynamic scripts importing

And would have to simple functions:

{code}
   executeScript("1.3.4/services/HBASE/package/scripts/hbase_client.py",
                   classname = "HbaseClient",
                   command = "configure",
                   config_file="secured.json"
    ) # call script
    
    assertResourceCalled('Directory', '/etc/hbase/conf',
      owner = 'hbase',
      group = 'hadoop',
      recursive = True,
    ) # assert if resource was called with given params
{code}


  was:
As of now, we have no infrastructure for unit testing scripts inside stacks 
folder. Under infrastructure, I mean:
-  ambari-server pom changes (adding resorce management framework to the python 
path of ambari-server) 
-  changes of unittests.py. As a possible approach: It should recursively 
iterate over stacks folder, import script files from the stack and choose 
appropriate test files from some another location. File structure of tests 
folder may mimic file structure of stacks folder:
{code}
/ambari/ambari-server/src/test/python/stacks_test
├── 1.3.4
├── 2.0.8
│   ├── HBASE
│   └── HDFS
│       └── test_datanode.py
└── 2.1.1

{code}
 The issue is, that scripts at different 
stacks have same names, so we have to play around with manual imports and 
different folders containing different tests for different stacks. 


> Create infrastructure for running unit tests of service scripts
> ---------------------------------------------------------------
>
>                 Key: AMBARI-4339
>                 URL: https://issues.apache.org/jira/browse/AMBARI-4339
>             Project: Ambari
>          Issue Type: Bug
>            Reporter: Andrew Onischuk
>            Assignee: Andrew Onischuk
>             Fix For: 1.5.0
>
>         Attachments: AMBARI-4339.patch, AMBARI-4339_2.patch
>
>
> Add a base unittest class for tests of components, which would encapsulate:
> 1. Any work with internals of resource_management framework
> 2. Dynamic pythonpaath modification
> 3. Dynamic scripts importing
> And would have to simple functions:
> {code}
>    executeScript("1.3.4/services/HBASE/package/scripts/hbase_client.py",
>                    classname = "HbaseClient",
>                    command = "configure",
>                    config_file="secured.json"
>     ) # call script
>     
>     assertResourceCalled('Directory', '/etc/hbase/conf',
>       owner = 'hbase',
>       group = 'hadoop',
>       recursive = True,
>     ) # assert if resource was called with given params
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to