From f63ae9171f7b3e791a555f34a31001c6e961cb49 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Wed, 16 Oct 2024 19:19:13 +0200 Subject: [PATCH] [tests] Attempt to fix compatibility break from SAI headers (#3321) Error is show up when we move sai headers from v1.14 to v1.15 sonic-net/sonic-sairedis#1431 (comment) What I did Fix tests so they can pass during backward compatibility break --- tests/mock_tests/portsorch_ut.cpp | 1 + tests/mock_tests/switchorch_ut.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/mock_tests/portsorch_ut.cpp b/tests/mock_tests/portsorch_ut.cpp index 0f5d5929ab..999aba00ff 100644 --- a/tests/mock_tests/portsorch_ut.cpp +++ b/tests/mock_tests/portsorch_ut.cpp @@ -656,6 +656,7 @@ namespace portsorch_test mockReply->element[2] = (redisReply *)calloc(sizeof(redisReply), 1); mockReply->element[2]->type = REDIS_REPLY_STRING; sai_port_oper_status_notification_t port_oper_status; + memset(&port_oper_status, 0, sizeof(port_oper_status)); port_oper_status.port_state = oper_status; port_oper_status.port_id = port.m_port_id; std::string data = sai_serialize_port_oper_status_ntf(1, &port_oper_status); diff --git a/tests/mock_tests/switchorch_ut.cpp b/tests/mock_tests/switchorch_ut.cpp index b123207909..a1e8b218e4 100644 --- a/tests/mock_tests/switchorch_ut.cpp +++ b/tests/mock_tests/switchorch_ut.cpp @@ -292,7 +292,9 @@ namespace switchorch_test initSwitchOrch(); sai_timespec_t timestamp = {.tv_sec = 1701160447, .tv_nsec = 538710245}; - sai_switch_health_data_t data = {.data_type = SAI_HEALTH_DATA_TYPE_GENERAL}; + sai_switch_health_data_t data; + memset(&data, 0, sizeof(data)); + data.data_type = SAI_HEALTH_DATA_TYPE_GENERAL; vector data_from_sai({100, 101, 115, 99, 114, 105, 112, 116, 105, 245, 111, 110, 245, 10, 123, 125, 100, 100}); sai_u8_list_t description; description.list = data_from_sai.data();