diff --git a/include/neuron/define.h b/include/neuron/define.h index 74df208f..c07ba413 100644 --- a/include/neuron/define.h +++ b/include/neuron/define.h @@ -31,7 +31,7 @@ #define NEU_GET_VERSION_FIX(V) ((0x000000ff & V)) #define NEU_VERSION(MAJOR, MINOR, FIX) ((MAJOR << 16) | (MINOR << 8) | FIX) -#define NEU_TAG_NAME_LEN 64 +#define NEU_TAG_NAME_LEN 128 #define NEU_TAG_ADDRESS_LEN 128 #define NEU_TAG_DESCRIPTION_LEN 128 #define NEU_GROUP_MAX_PER_NODE 512 diff --git a/tests/ft/tag/test_tag.py b/tests/ft/tag/test_tag.py index 2add729a..41fc6172 100644 --- a/tests/ft/tag/test_tag.py +++ b/tests/ft/tag/test_tag.py @@ -457,4 +457,30 @@ class TestLog: ) assert 409 == response.status_code - assert NEU_ERR_TAG_NAME_CONFLICT == response.json()['error'] \ No newline at end of file + assert NEU_ERR_TAG_NAME_CONFLICT == response.json()['error'] + + @description(given="tag name length exceeds 128", when="adding", then="add failed") + def test_adding_tag_name_exceeds_128(self): + response = api.add_gtags( + node='modbus-tcp-tag-test', + groups=[{"group": "group","interval": 3000, + "tags": [{ + "name": "Lt7Pa5Q0tKJN2gL3WiYJLnaFzqBq5q5xyJ1vYHxyf2j0IZR7y3RBYxXGQBHwV7dEzD7lIcF1yX9aR3vH8leYxXxHUILk2eVqQBlaQLaROZt9yZ9xQNxKkfy5mySHb79", + "address": "1!400001", + "attribute": 3, + "type": 3, + "decimal": 0.01}]}]) + assert 200 == response.status_code + assert NEU_ERR_SUCCESS == response.json()['error'] + + response = api.add_gtags( + node='modbus-tcp-tag-test', + groups=[{"group": "group","interval": 3000, + "tags": [{ + "name": "Lt7Pa5Q0tKJN2gL3WiYJLnaFzqBq5q5xyJ1vYHxyf2j0IZR7y3RBYxXGQBHwV7dEzD7lIcF1yX9aR3vH8leYxXxHUILk2eVqQBlaQLaROZt9yZ9xQNxKkfy5mySHb79Y8", + "address": "1!400001", + "attribute": 3, + "type": 3, + "decimal": 0.01}]}]) + assert 400 == response.status_code + assert NEU_ERR_TAG_NAME_TOO_LONG == response.json()['error'] \ No newline at end of file