sonic-utilities icon indicating copy to clipboard operation
sonic-utilities copied to clipboard

[VOQ][saidump] Add saidump unit test scripts

Open JunhongMao opened this issue 1 year ago • 2 comments

Why I did it

https://github.com/sonic-net/sonic-utilities/pull/2972 added two below functions into scripts/generate_dump. get_route_table_size_by_asic_id_and_ipver save_saidump_by_route_size The unittest scripts need to be added according to the below comments: https://github.com/sonic-net/sonic-utilities/pull/2972#issuecomment-1811290241

Related PRs: https://github.com/sonic-net/sonic-utilities/pull/2972 https://github.com/sonic-net/sonic-buildimage/pull/16466 https://github.com/sonic-net/sonic-sairedis/pull/1288 https://github.com/sonic-net/sonic-sairedis/pull/1298

Work item tracking

Microsoft ADO (25892277):

How I did it

Add two scripts: tests/saidump_test.py tests/saidump_test.sh

To use below 6 test cases to verify the functionality of get_route_table_size_by_asic_id_and_ipver and save_saidump_by_route_size behave correctly.

saidump test list format: [ACIS number, ipv4 and ipv6 route table size, expected function save_cmd arguments]
saidump_test_list = [
    [1, 10000, "docker exec syncd saidump saidump"],
    [1, 12000, "docker exec syncd saidump saidump"],
    [1, 12001, "docker exec syncd saidump.sh saidump"],
    [1, 20000, "docker exec syncd saidump.sh saidump"],
    [2, 10000, "docker exec syncd0 saidump saidump0\ndocker exec syncd1 saidump saidump1"],
    [2, 12000, "docker exec syncd0 saidump saidump0\ndocker exec syncd1 saidump saidump1"],
    [2, 12001, "docker exec syncd0 saidump.sh saidump0\ndocker exec syncd1 saidump.sh saidump1"],
    [2, 20000, "docker exec syncd0 saidump.sh saidump0\ndocker exec syncd1 saidump.sh saidump1"]
]

How to verify it

During the compiling stage, run the below command to check if it's PASSED. jumao@1b1ffba5949a:/sonic/src/sonic-utilities$ time python3 setup.py test tests/saidump_test.py::test_saidump PASSED

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

JunhongMao avatar Dec 12 '23 22:12 JunhongMao

@judyjoseph , @mlok-nokia , please help to review this PR. Thanks.

JunhongMao avatar Dec 12 '23 22:12 JunhongMao

@judyjoseph , @mlok-nokia , please help to review this PR. Thanks.

JunhongMao avatar Jan 16 '24 21:01 JunhongMao