Skip to content

Commit

Permalink
Merge pull request #2834 from VOLTTRON/releases/8.1.2
Browse files Browse the repository at this point in the history
Release of hotfix version 8.1.2 of VOLTTRON
  • Loading branch information
craig8 authored Dec 2, 2021
2 parents 97514d8 + c97e1b0 commit 4284fc6
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def __getattr__(cls, name):
author = 'The VOLTTRON Community'

# The short X.Y version
version = '8.1.1'
version = '8.1.2'
# The full version, including alpha/beta/rc tags
release = '8.1.1'
release = '8.1.2'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion volttron/platform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from urllib.parse import urlparse

from ..utils.frozendict import FrozenDict
__version__ = '8.1.1'
__version__ = '8.1.2'

_log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion volttron/platform/dbutils/mysqlfuncts.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def get_topic_meta_map(self):
_log.debug("loading metadata from db")
topic_meta_map = dict()
for id, meta in rows:
topic_meta_map[id] = jsonapi.loads(meta)
topic_meta_map[id] = jsonapi.loads(meta) if meta else None
return topic_meta_map

def get_topic_map(self):
Expand Down
2 changes: 1 addition & 1 deletion volttron/platform/dbutils/postgresqlfuncts.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def get_topic_meta_map(self):
'SELECT topic_id, metadata '
'FROM {}').format(Identifier(self.meta_table))
rows = self.select(query)
meta_map = {tid: jsonapi.loads(meta) for tid, meta in rows}
meta_map = {tid: jsonapi.loads(meta) if meta else None for tid, meta in rows}
return meta_map

def get_agg_topics(self):
Expand Down
2 changes: 1 addition & 1 deletion volttron/platform/dbutils/redshiftfuncts.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def get_topic_meta_map(self):
'SELECT topic_id, metadata '
'FROM {}').format(Identifier(self.meta_table))
rows = self.select(query)
meta_map = {tid: jsonapi.loads(meta) for tid, meta in rows}
meta_map = {tid: jsonapi.loads(meta) if meta else None for tid, meta in rows}
return meta_map

def get_agg_topics(self):
Expand Down
2 changes: 1 addition & 1 deletion volttron/platform/dbutils/sqlitefuncts.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def get_topic_meta_map(self):
_log.debug("loading metadata from db")
topic_meta_map = dict()
for id, meta in rows:
topic_meta_map[id] = jsonapi.loads(meta)
topic_meta_map[id] = jsonapi.loads(meta) if meta else None
return topic_meta_map

def get_agg_topics(self):
Expand Down
17 changes: 17 additions & 0 deletions volttrontesting/platform/dbutils/test_mysqlfuncts.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,23 @@ def test_get_topic_map_should_succeed(get_container_func):
assert actual == expected


def test_get_topic_meta_map_should_succeed(get_container_func):
container, sqlfuncts, connection_port, historian_version = get_container_func
if historian_version == "<4.0.0":
pytest.skip("method applied only to version >=4.0.0")
else:
query = """
INSERT INTO topics (topic_name)
VALUES ('football');
INSERT INTO topics (topic_name, metadata)
VALUES ('baseball', '{"metadata":"value"}');
"""
seed_database(container, query)
expected = {1: None, 2: {"metadata": "value"}}
actual = sqlfuncts.get_topic_meta_map()
assert actual == expected


# fails for image:mysql:8.0.25 historian schema version >=4.0.0
def test_get_agg_topic_map_should_return_dict(get_container_func):
container, sqlfuncts, connection_port, historian_version = get_container_func
Expand Down
16 changes: 16 additions & 0 deletions volttrontesting/platform/dbutils/test_postgresql_timescaledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,22 @@ def test_get_topic_map_should_return_maps(get_container_func):
assert actual == expected


def test_get_topic_meta_map_should_return_maps(get_container_func):
container, sqlfuncts, connection_port, historian_version = get_container_func
if historian_version == "<4.0.0":
pytest.skip("method applied only to version >=4.0.0")
else:
query = """
INSERT INTO topics (topic_name)
VALUES ('football');
INSERT INTO topics (topic_name, metadata)
VALUES ('baseball', '{"meta":"value"}');
"""
seed_database(container, query)
expected = {1: None, 2: {"meta": "value"}}
actual = sqlfuncts.get_topic_meta_map()
assert actual == expected

def test_get_agg_topics_should_return_list(get_container_func):
container, postgresqlfuncts, port_on_host, historian_version = get_container_func
topic = "some_agg_topic"
Expand Down
17 changes: 17 additions & 0 deletions volttrontesting/platform/dbutils/test_postgresqlfuncts.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,23 @@ def test_get_topic_map_should_return_maps(get_container_func):
assert actual == expected


def test_get_topic_meta_map_should_return_maps(get_container_func):
container, sqlfuncts, connection_port, historian_version = get_container_func
if historian_version == "<4.0.0":
pytest.skip("method applied only to version >=4.0.0")
else:
query = """
INSERT INTO topics (topic_name)
VALUES ('football');
INSERT INTO topics (topic_name, metadata)
VALUES ('baseball', '{"meta":"value"}');
"""
seed_database(container, query)
expected = {1: None, 2: {"meta": "value"}}
actual = sqlfuncts.get_topic_meta_map()
assert actual == expected


def test_get_agg_topics_should_return_list(get_container_func):
container, sqlfuncts, connection_port, historian_version = get_container_func

Expand Down
16 changes: 16 additions & 0 deletions volttrontesting/platform/dbutils/test_sqlitefuncts.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,22 @@ def test_get_topic_map(get_sqlitefuncts):
assert actual_topic_map == expected_topic_map


@pytest.mark.sqlitefuncts
@pytest.mark.dbutils
def test_get_topic_meta_map(get_sqlitefuncts):
sqlitefuncts, historian_version = get_sqlitefuncts
if historian_version == "<4.0.0":
pytest.skip("method applied only to version >=4.0.0")
else:
query = "INSERT INTO topics (topic_name) values ('football');" \
"INSERT INTO topics (topic_name, metadata) values ('netball', '{\"meta\":\"value\"}');"
query_db(query)
expected_topic_map = {1: None, 2: {"meta": "value"}}

actual_topic_meta_map = sqlitefuncts.get_topic_meta_map()

assert actual_topic_meta_map == expected_topic_map

@pytest.mark.sqlitefuncts
@pytest.mark.dbutils
def test_get_agg_topics(get_sqlitefuncts):
Expand Down

0 comments on commit 4284fc6

Please sign in to comment.