<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <i>On 26.01.2015 18:05, Ruslan Kamaldinov wrote:</i>
    <blockquote type="cite"><i>I think it's still important to perform
        migration specific checks. We
        want to make sure that DB is in expected state after each
        specific
        migration.</i><br>
    </blockquote>
    Why? <br>
    <br>
    <div class="moz-cite-prefix">On 26.01.2015 18:05, Ruslan Kamaldinov
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAPW-O+G6PHaHLDZbX67O51AorEHzb+6eY2fM=oDr3Qc+k6=FSw@mail.gmail.com"
      type="cite">
      <pre wrap="">On Mon, Jan 26, 2015 at 3:03 PM, Andrew Pashkin <a class="moz-txt-link-rfc2396E" href="mailto:apashkin@mirantis.com"><apashkin@mirantis.com></a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">On 23.01.2015 23:39, Ruslan Kamaldinov wrote:

1. Use ModelsMigrationsSync from [2] in tests to make sure that SQLAlchemy
models are in sync with migrations. Usage example can be found at [3]

Seems like it is a great helper, as I understand it runs all migrations and
then compares DB state with models state and throws an error if they are out
of sync.
What I don't understand - why they still manually write checks for every
migration [1]? This is redundant, because ModelsMigrationsSync already does
the job testing that DB is in sync with models.

By the way in Heat project they do the same thing [2]. What am I missing?
</pre>
      </blockquote>
      <pre wrap="">
I think it's still important to perform migration specific checks. We
want to make sure that DB is in expected state after each specific
migration.

</pre>
      <blockquote type="cite">
        <pre wrap="">[1]
<a class="moz-txt-link-freetext" href="http://git.openstack.org/cgit/openstack/sahara/tree/sahara/tests/unit/db/migration/test_migrations.py#n402">http://git.openstack.org/cgit/openstack/sahara/tree/sahara/tests/unit/db/migration/test_migrations.py#n402</a>
[2]
<a class="moz-txt-link-freetext" href="https://github.com/openstack/heat/blob/7d4c4030c591ef5994db4327d66d353ad83c6ea8/heat/tests/db/test_migrations.py#L288">https://github.com/openstack/heat/blob/7d4c4030c591ef5994db4327d66d353ad83c6ea8/heat/tests/db/test_migrations.py#L288</a>
</pre>
      </blockquote>
      <pre wrap="">
</pre>
      <blockquote type="cite">
        <pre wrap="">2. Populate DB schema from SQLAlchemy models in unit-tests which require
access to DB

You mean - using these tools [3]?

[3]
<a class="moz-txt-link-freetext" href="http://docs.sqlalchemy.org/en/rel_0_9/core/metadata.html#creating-and-dropping-database-tables">http://docs.sqlalchemy.org/en/rel_0_9/core/metadata.html#creating-and-dropping-database-tables</a>
</pre>
      </blockquote>
      <pre wrap="">
Yes, this one. We still have this code in source tree:
<a class="moz-txt-link-freetext" href="http://git.openstack.org/cgit/stackforge/murano/tree/murano/db/models.py#n289">http://git.openstack.org/cgit/stackforge/murano/tree/murano/db/models.py#n289</a>

</pre>
      <blockquote type="cite">
        <pre wrap="">In what conditions 5) will fail? I see only these cases:
- If data migrations would be introduced and Murano would require some data
in DB to work correctly.
</pre>
      </blockquote>
      <pre wrap="">
Actually, we already do that. We populate initial set of categories:
<a class="moz-txt-link-freetext" href="http://git.openstack.org/cgit/stackforge/murano/tree/murano/db/migration/alembic_migrations/versions/001_inital_version.py#n40">http://git.openstack.org/cgit/stackforge/murano/tree/murano/db/migration/alembic_migrations/versions/001_inital_version.py#n40</a>

Would it affect anyone? I don't think so. You always can populate
these categories manually.

</pre>
      <blockquote type="cite">
        <pre wrap="">- If Murano would use some database-specific features (stored procedures
etc).
</pre>
      </blockquote>
      <pre wrap="">
That should never happen :)

</pre>
      <blockquote type="cite">
        <pre wrap="">There are good chances that these cases will never happen in reality, as I
understand, so I tend to agree.
</pre>
      </blockquote>
      <pre wrap="">
Agree

--
Ruslan

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: <a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev-request@lists.openstack.org?subject:unsubscribe">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a>
<a class="moz-txt-link-freetext" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
With kind regards, Andrew Pashkin.
cell phone - +7 (985) 898 57 59
Skype - waves_in_fluids
e-mail - <a class="moz-txt-link-abbreviated" href="mailto:apashkin@mirantis.com">apashkin@mirantis.com</a></pre>
  </body>
</html>