Re: [openstack-dev] [vitrage] how to use mock driver
Understood now. It could be less confusing if we give a better variable name (without `_re`) or put some comments after removing `exrex` :-) On Tue, Dec 13, 2016 at 4:03 PM Rosensweig, Elisha (Nokia - IL) < elisha.rosensw...@nokia.com> wrote: > 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. > > > > *From:* Yujun Zhang [mailto:zhangyujun+...@gmail.com] > *Sent:* Tuesday, December 13, 2016 8:32 AM > > > *To:* OpenStack Development Mailing List (not for usage questions) < > openstack-dev@lists.openstack.org> > > *Subject:* Re: [openstack-dev] [vitrage] how to use mock driver > > > > Elisha, thanks for the explanation. The difference is clear to me now. > > > > If I understand it correctly, the regular expression in spec JSON is for > information only. It is never compiled into a `re` object. > > > > 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. > > > > Is that right? > > > > On Mon, Dec 12, 2016 at 8:47 PM Rosensweig, Elisha (Nokia - IL) < > elisha.rosensw...@nokia.com> wrote: > > Hi, > > > > · In Vitrage Datasources, we can have a different input format > for snapshots and updates. Thus, we need a different JSON file for each. > > · 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”) > *overwrites* the static one (marked with “S”). > > · 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. > > > > Elisha > > > > *From:* Yujun Zhang [mailto:zhangyujun+...@gmail.com] > *Sent:* Monday, December 12, 2016 8:23 AM > *To:* OpenStack Development Mailing List (not for usage questions) < > openstack-dev@lists.openstack.org> > *Subject:* [openstack-dev] [vitrage] how to use mock driver > > > > Is there any documentation on how to use mock driver for unit testing? > > > > It seems it generates fake events from json spec but what is the different > between > > > > - `xxx_snapshot_X.json` and `xxx_dynamic_X.json` > > - `xxx_S` and `xxx_D` > > > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [vitrage] how to use mock driver
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. From: Yujun Zhang [mailto:zhangyujun+...@gmail.com] Sent: Tuesday, December 13, 2016 8:32 AM To: OpenStack Development Mailing List (not for usage questions) Subject: Re: [openstack-dev] [vitrage] how to use mock driver Elisha, thanks for the explanation. The difference is clear to me now. If I understand it correctly, the regular expression in spec JSON is for information only. It is never compiled into a `re` object. 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. Is that right? On Mon, Dec 12, 2016 at 8:47 PM Rosensweig, Elisha (Nokia - IL) mailto:elisha.rosensw...@nokia.com>> wrote: Hi, • In Vitrage Datasources, we can have a different input format for snapshots and updates. Thus, we need a different JSON file for each. • 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”) overwrites the static one (marked with “S”). • 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. Elisha From: Yujun Zhang [mailto:zhangyujun+...@gmail.com<mailto:zhangyujun%2b...@gmail.com>] Sent: Monday, December 12, 2016 8:23 AM To: OpenStack Development Mailing List (not for usage questions) mailto:openstack-dev@lists.openstack.org>> Subject: [openstack-dev] [vitrage] how to use mock driver Is there any documentation on how to use mock driver for unit testing? It seems it generates fake events from json spec but what is the different between - `xxx_snapshot_X.json` and `xxx_dynamic_X.json` - `xxx_S` and `xxx_D` __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe<http://openstack-dev-requ...@lists.openstack.org?subject:unsubscribe> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [vitrage] how to use mock driver
Elisha, thanks for the explanation. The difference is clear to me now. If I understand it correctly, the regular expression in spec JSON is for information only. It is never compiled into a `re` object. 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. Is that right? On Mon, Dec 12, 2016 at 8:47 PM Rosensweig, Elisha (Nokia - IL) < elisha.rosensw...@nokia.com> wrote: > Hi, > > > > · In Vitrage Datasources, we can have a different input format > for snapshots and updates. Thus, we need a different JSON file for each. > > · 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”) > *overwrites* the static one (marked with “S”). > > · 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. > > > > Elisha > > > > *From:* Yujun Zhang [mailto:zhangyujun+...@gmail.com] > *Sent:* Monday, December 12, 2016 8:23 AM > *To:* OpenStack Development Mailing List (not for usage questions) < > openstack-dev@lists.openstack.org> > *Subject:* [openstack-dev] [vitrage] how to use mock driver > > > > Is there any documentation on how to use mock driver for unit testing? > > > > It seems it generates fake events from json spec but what is the different > between > > > > - `xxx_snapshot_X.json` and `xxx_dynamic_X.json` > > - `xxx_S` and `xxx_D` > > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [vitrage] how to use mock driver
Hi, · In Vitrage Datasources, we can have a different input format for snapshots and updates. Thus, we need a different JSON file for each. · 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”) overwrites the static one (marked with “S”). · 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. Elisha From: Yujun Zhang [mailto:zhangyujun+...@gmail.com] Sent: Monday, December 12, 2016 8:23 AM To: OpenStack Development Mailing List (not for usage questions) Subject: [openstack-dev] [vitrage] how to use mock driver Is there any documentation on how to use mock driver for unit testing? It seems it generates fake events from json spec but what is the different between - `xxx_snapshot_X.json` and `xxx_dynamic_X.json` - `xxx_S` and `xxx_D` __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
[openstack-dev] [vitrage] how to use mock driver
Is there any documentation on how to use mock driver for unit testing? It seems it generates fake events from json spec but what is the different between - `xxx_snapshot_X.json` and `xxx_dynamic_X.json` - `xxx_S` and `xxx_D` __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev