<div dir="ltr"><div>Folks,</div><div><br></div><div>I have specific topic to discuss: how murano test-fixture will look like and how it can be run.</div><div><br></div><div>The idea is to implement a unit-testing framework, similar to regular frameworks for python or other languages, </div><div>which will allow to define test fixtures in MuranoPL.</div><div>A Test fixture is a regular muranoPL class definition, which methods are the test cases.</div><div>When such fixture is included into Murano application package the deployment of application may be tested  without running actual VM's.</div><div><br></div><div>Here is how the test fixture may look like:</div><div><br></div><div><font face="monospace, monospace">Namespaces:</font></div><div><font face="monospace, monospace">    =: io.murano.apps.foo.tests</font></div><div><font face="monospace, monospace">    sys: io.murano.system</font></div><div><font face="monospace, monospace">    pckg: io.murano.apps.foo</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Extends: io.murano.tests.TestFixture</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Name: FooTest</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">Methods:</font></div><div><font face="monospace, monospace">    initialize:</font></div><div><font face="monospace, monospace">        Body:</font></div><div><font face="monospace, monospace">            <i># Object model can be loaded from json file, or provided directly in murano-pl code as a yaml insertion.</i></font></div><div><font face="monospace, monospace"><i>            # - $.appJson: new(sys:Resources).json('foo-test-object-model.json')</i></font></div><div><font face="monospace, monospace">            - $.appJson:</font></div><div><font face="monospace, monospace">                - ?:</font></div><div><font face="monospace, monospace">                    type: io.murano.apps.foo.FooApp</font></div><div><font face="monospace, monospace">                  name: my-foo-obj</font></div><div><font face="monospace, monospace">                  instance:</font></div><div><font face="monospace, monospace">                      ?:</font></div><div><font face="monospace, monospace">                          type: io.murano.resources.Instance</font></div><div><font face="monospace, monospace">                      ...</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    setUp:</font></div><div><font face="monospace, monospace">        Body:</font></div><div><font face="monospace, monospace">            - $.env: $.createEnvironment($.appJson)   # creates an instance of std:Environment</font></div><div><font face="monospace, monospace">            - $.myApp: $.env.applications.where($.name='my-foo-obj').first()</font></div><div><font face="monospace, monospace">            <i># mock instance spawning</i></font></div><div><font face="monospace, monospace">            - mock($.myApp.instance, "deploy", "mockInstanceDeploy", $this)</font></div><div><font face="monospace, monospace">            - mock(res:Instance, deploy, "mockInstanceDeploy", $this)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    testFooApp:</font></div><div><font face="monospace, monospace">        Body:</font></div><div><font face="monospace, monospace">            - $.env.deploy()</font></div><div><font face="monospace, monospace">            - $.assertEqual(true, $.myApp.getAttr('deployed'))</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    mockInstanceDeploy:</font></div><div><font face="monospace, monospace">        Arguments:</font></div><div><font face="monospace, monospace">            - mockContext</font></div><div><font face="monospace, monospace">        Body:</font></div><div><font face="monospace, monospace">            - Return:</font></div><div><font face="monospace, monospace">               <i> # heat template</i></font></div><div><br></div><div><br></div><div><font face="monospace, monospace">io.murano.tests.TestFixture</font> - is a base class, that contains set of methods, needed in all the test-cases which inherit it, such as assertEqual and other similar assertions.</div><div>All it contains a $.createEnvironment method which may be called at the setUp phase (a method being run before each test case) to construct the object model to run the test against.</div><div><br></div><div>Test developer will be able to mock some of the functions or method which are out of the scope of the current test </div><div>(for example, interaction with other applications or classes from the standard murano library, such as instance.deploy etc).</div><div>The mock will allow to override the actual method execution and provide the expected output of the method.</div><div>The actual implementation of  mocking requires more thoughtful design,  so I'll create a separate spec for it.</div><div><br></div><div>What do you think about the overall idea and the test syntax proposed above?</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 3, 2015 at 5:15 PM, Ekaterina Chernova <span dir="ltr"><<a href="mailto:efedorova@mirantis.com" target="_blank">efedorova@mirantis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hi all!</div><div><br></div><div>I'd like to discuss first implementation thoughts about this [1] blueprint, that we want to implement in Liberty.</div><div>This feature is supposed to increase the speed of application development.</div><div><br></div><div>Now engine interacts with API to get input task and packages. </div><div><br></div><div>Items, planned to implement first would enable loading local task and new package, without API and Rabbit involved.</div><div><br></div><div>After that simple testing machinery will be added to MuranoPL: mock support and simple test-runner.</div><div><br></div><div>So user can test application methods as he wants by creating simple tests.</div><div>Deployment parameters, such as heat stack and murano execution plan outputs  <br></div><div>may be set as returned value in tests.</div><div><br></div><div>Finally, tests may be placed into a murano package for easier package verification and later modification.</div><div><br></div><div>I'm going to write specification soon. But before, we need to prepare list of functions, that are needed to </div><div>implement simple mocking machinery in MuranoPL.</div><div><br></div><div>Please, leave your thoughts here or directly in the blueprint.</div><div><br></div><div>Regards, Kate.</div><div><br></div><div><br></div><div>[1] - <a href="https://blueprints.launchpad.net/murano/+spec/simulated-execution-mode-murano-engine" target="_blank">https://blueprints.launchpad.net/murano/+spec/simulated-execution-mode-murano-engine</a></div></div>
</blockquote></div><br></div></div>