Skip to content

Commit

Permalink
Merge pull request #1882 from eeff/main
Browse files Browse the repository at this point in the history
fix(core): persist group when adding gtags
  • Loading branch information
fengzeroz authored Mar 7, 2024
2 parents 142f31b + 79fca4b commit 74b45c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/adapter/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,8 @@ int neu_adapter_add_gtags(neu_adapter_t *adapter, neu_req_add_gtag_t *cmd,
neu_adapter_driver_add_group((neu_adapter_driver_t *) adapter,
cmd->groups[group_index].group,
cmd->groups[group_index].interval);
adapter_storage_add_group(adapter->name, cmd->groups[group_index].group,
cmd->groups[group_index].interval);
for (int tag_index = 0; tag_index < cmd->groups[group_index].n_tag;
tag_index++) {
int add_tag_result = neu_adapter_driver_add_tag(
Expand Down
5 changes: 4 additions & 1 deletion tests/ft/tag/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestLog:
@description(given="multiple non-existing groups and multiple correct tags",
when="adding",
then="successfully added")
def test_adding_correct_gtags_nonexisting_groups(self):
def test_adding_correct_gtags_nonexisting_groups(self, class_setup_and_teardown):
response = api.add_node(node='modbus-tcp-tag-test', plugin=PLUGIN_MODBUS_TCP)
assert 200 == response.status_code
assert 0 == response.json()['error']
Expand Down Expand Up @@ -63,6 +63,9 @@ def test_adding_correct_gtags_nonexisting_groups(self):
assert 200 == response.status_code
assert NEU_ERR_SUCCESS == response.json()['error']

# check data persisted
class_setup_and_teardown.restart()

response = api.get_group()
assert 200 == response.status_code
assert 'group_1' == response.json()['groups'][0]['group']
Expand Down

0 comments on commit 74b45c9

Please sign in to comment.