<div dir="ltr">Understood now.<div><br></div><div>It could be less confusing if we give a better variable name (without `_re`) or put some comments after removing `exrex` :-)</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 13, 2016 at 4:03 PM Rosensweig, Elisha (Nokia - IL) <<a href="mailto:elisha.rosensweig@nokia.com">elisha.rosensweig@nokia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple" class="gmail_msg">
<div class="m_-9114532130836719463WordSection1 gmail_msg">
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">Yes. We actually had to remove the regex generation support a few months ago, since the python package we were using – exrex – was not one that OpenStack supported.<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></span></p>
<p class="MsoNormal gmail_msg"><b class="gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"> Yujun Zhang [mailto:<a href="mailto:zhangyujun%2Bzte@gmail.com" class="gmail_msg" target="_blank">zhangyujun+zte@gmail.com</a>]
<br class="gmail_msg">
<b class="gmail_msg">Sent:</b> Tuesday, December 13, 2016 8:32 AM</span></p></div></div><div lang="EN-US" link="blue" vlink="purple" class="gmail_msg"><div class="m_-9114532130836719463WordSection1 gmail_msg"><p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"><br class="gmail_msg">
<b class="gmail_msg">To:</b> OpenStack Development Mailing List (not for usage questions) <<a href="mailto:openstack-dev@lists.openstack.org" class="gmail_msg" target="_blank">openstack-dev@lists.openstack.org</a>><br class="gmail_msg">
</span></p></div></div><div lang="EN-US" link="blue" vlink="purple" class="gmail_msg"><div class="m_-9114532130836719463WordSection1 gmail_msg"><p class="MsoNormal gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"><b class="gmail_msg">Subject:</b> Re: [openstack-dev] [vitrage] how to use mock driver<u class="gmail_msg"></u><u class="gmail_msg"></u></span></p></div></div><div lang="EN-US" link="blue" vlink="purple" class="gmail_msg"><div class="m_-9114532130836719463WordSection1 gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Elisha, thanks for the explanation. The difference is clear to me now.<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">If I understand it correctly, the regular expression in spec JSON is for information only. It is never compiled into a `re` object.<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">The actual values are generated in `static_info_parsers` from the `mapping`. The regular expression is neither used as a value template nor for value validation.<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Is that right?<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
<p class="MsoNormal gmail_msg"><u class="gmail_msg"></u> <u class="gmail_msg"></u></p>
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">On Mon, Dec 12, 2016 at 8:47 PM Rosensweig, Elisha (Nokia - IL) <<a href="mailto:elisha.rosensweig@nokia.com" class="gmail_msg" target="_blank">elisha.rosensweig@nokia.com</a>> wrote:<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in" class="gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">Hi,</span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<p class="MsoNormal gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"> </span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<p class="m_-9114532130836719463m5306597561535435383msolistparagraph gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:Symbol" class="gmail_msg">·</span></span><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:7.0pt" class="gmail_msg">        
</span></span><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">In Vitrage Datasources, we can have a different input format for snapshots and updates. Thus, we need a different JSON file for each.</span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<p class="m_-9114532130836719463m5306597561535435383msolistparagraph gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:Symbol" class="gmail_msg">·</span></span><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:7.0pt" class="gmail_msg">        
</span></span><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">Also, as part of the Mock feature, we need to support (for each resource) things that will be static, such as it’s name, and things that change over time, such
 as timestamps. We support this partially via different JSON files. In general, the dynamic file (marked with “D”)
<u class="gmail_msg">overwrites</u> the static one (marked with “S”).</span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<p class="m_-9114532130836719463m5306597561535435383msolistparagraph gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:Symbol" class="gmail_msg">·</span></span><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:7.0pt" class="gmail_msg">        
</span></span><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">In the code you can further inject specific fields you want to have for a specific test, in addition to the JSON files. See examples in test_scenario_evaluator.py.</span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<p class="MsoNormal gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"> </span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<p class="MsoNormal gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">Elisha</span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<p class="MsoNormal gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"> </span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<p class="MsoNormal gmail_msg"><span class="m_-9114532130836719463gmailmsg gmail_msg"><b class="gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">From:</span></b></span><span class="m_-9114532130836719463gmailmsg gmail_msg"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg">
 Yujun Zhang [mailto:<a href="mailto:zhangyujun%2Bzte@gmail.com" class="gmail_msg" target="_blank">zhangyujun+zte@gmail.com</a>]
</span></span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" class="gmail_msg"><br class="gmail_msg">
<span class="m_-9114532130836719463gmailmsg gmail_msg"><b class="gmail_msg">Sent:</b> Monday, December 12, 2016 8:23 AM</span><br class="gmail_msg">
<span class="m_-9114532130836719463gmailmsg gmail_msg"><b class="gmail_msg">To:</b> OpenStack Development Mailing List (not for usage questions) <<a href="mailto:openstack-dev@lists.openstack.org" class="gmail_msg" target="_blank">openstack-dev@lists.openstack.org</a>></span><br class="gmail_msg">
<span class="m_-9114532130836719463gmailmsg gmail_msg"><b class="gmail_msg">Subject:</b> [openstack-dev] [vitrage] how to use mock driver</span></span><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
<div class="gmail_msg">
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"> <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">Is there any documentation on how to use mock driver for unit testing?<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"> <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">It seems it generates fake events from json spec but what is the different between<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"> <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">- `xxx_snapshot_X.json` and `xxx_dynamic_X.json`<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg">- `xxx_S` and `xxx_D`<u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
<div class="gmail_msg">
<p class="MsoNormal gmail_msg"> <u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal gmail_msg">__________________________________________________________________________<br class="gmail_msg">
OpenStack Development Mailing List (not for usage questions)<br class="gmail_msg">
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" class="gmail_msg" target="_blank">
OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br class="gmail_msg">
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" class="gmail_msg" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><u class="gmail_msg"></u><u class="gmail_msg"></u></p>
</blockquote>
</div>
</div></div>

__________________________________________________________________________<br class="gmail_msg">
OpenStack Development Mailing List (not for usage questions)<br class="gmail_msg">
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" class="gmail_msg" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br class="gmail_msg">
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br class="gmail_msg">
</blockquote></div>