undo the removal of persistency tables

Change-Id: I9fa1fd7a2edc4a475ec63f7cecc9d8bc980b2f32
This commit is contained in:
Idan Hefetz 2018-02-11 14:45:19 +00:00
parent 8f8c8eec1d
commit a22833206a
4 changed files with 10 additions and 14 deletions

View File

@ -73,6 +73,9 @@ changes_interval = 5
[datasources]
snapshots_interval = 120
[persistency]
enable_persistency=true
EOF
)"

View File

@ -27,11 +27,10 @@ class CollectorNotifier(object):
self.oslo_notifier = None
try:
topics = [conf.datasources.notification_topic_collector]
# TODO(idan_hefetz): persistency is in development
# if conf.persistency.enable_persistency:
# topics.append(conf.persistency.persistor_topic)
# else:
# LOG.warning("Not persisting events")
if conf.persistency.enable_persistency:
topics.append(conf.persistency.persistor_topic)
else:
LOG.warning("Not persisting events")
self.oslo_notifier = oslo_messaging.Notifier(
get_transport(conf),

View File

@ -79,13 +79,12 @@ class Connection(base.Connection):
def upgrade(self, nocreate=False):
engine = self._engine_facade.get_engine()
engine.connect()
models.Base.metadata.drop_all(
engine, tables=[models.Event.__table__,
models.GraphSnapshot.__table__])
models.Base.metadata.create_all(
engine, tables=[models.ActiveAction.__table__,
models.Template.__table__,
models.Webhooks.__table__])
models.Webhooks.__table__,
models.Event.__table__,
models.GraphSnapshot.__table__])
# TODO(idan_hefetz) upgrade logic is missing
def disconnect(self):

View File

@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import time
import unittest
from oslo_config import cfg
from oslo_db.options import database_opts
@ -43,7 +42,6 @@ class TestGraphPersistor(TestFunctionalBase):
cls.load_datasources(cls.conf)
cls.graph_persistor = GraphPersistor(cls.conf)
@unittest.skip("persistency is disabled in queens")
def test_persist_graph(self):
g = GraphGenerator().create_graph()
current_time = utcnow()
@ -53,7 +51,6 @@ class TestGraphPersistor(TestFunctionalBase):
self.assert_graph_equal(g, graph_snapshot)
self.graph_persistor.delete_graph_snapshots(utcnow())
@unittest.skip("persistency is disabled in queens")
def test_persist_two_graphs(self):
g1 = GraphGenerator().create_graph()
current_time1 = utcnow()
@ -71,7 +68,6 @@ class TestGraphPersistor(TestFunctionalBase):
self.assert_graph_equal(g2, graph_snapshot2)
self.graph_persistor.delete_graph_snapshots(utcnow())
@unittest.skip("persistency is disabled in queens")
def test_load_last_graph_snapshot_until_timestamp(self):
g1 = GraphGenerator().create_graph()
self.graph_persistor.last_event_timestamp = utcnow()
@ -89,7 +85,6 @@ class TestGraphPersistor(TestFunctionalBase):
self.assert_graph_equal(g1, graph_snapshot)
self.graph_persistor.delete_graph_snapshots(utcnow())
@unittest.skip("persistency is disabled in queens")
def test_delete_graph_snapshots(self):
g = GraphGenerator().create_graph()
self.graph_persistor.last_event_timestamp = utcnow()