sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
194 stars 711 forks source link

test_containers_autorestart[m64-zz-2-m64-zz-2|mux] failure #4829

Open yanjundeng opened 2 years ago

yanjundeng commented 2 years ago

Description If the feature's status is "always_disabled", the test_containers_autorestart script could fail on this feature. for example, /data/tests/metadata/m64-t1-lag.json: "features": { "lldp": "enabled", "pmon": "enabled", "sflow": "disabled", "database": "always_enabled", "radv": "enabled", "telemetry": "enabled", "snmp": "enabled", "mux": "always_disabled", "bgp": "enabled", "dhcp_relay": "enabled", "mgmt-framework": "enabled", "nat": "disabled", "teamd": "enabled", "syncd": "enabled", "swss": "enabled" }

Based on this json file, test_containers_autorestart will also try autorestart "mux" though its state is "always_disabled".

In the func "generate_dut_feature_container_list" of sonic-mgmt/tests/conftest.py, it tries to read the above json feature list and generate a container list and run autorestart based on it. Even if the feature's state is "always_disabled", the script still try to run autorestart for this feature.

Steps to reproduce the issue:

  1. run "autorestart/test_container_autorestart.py" with the mux feature in "always_disabled" state.

Describe the results you received: L0082 DEBUG | /data/tests/common/devices/multi_asic.py::_run_on_asics#97: [m64-zz-2] AnsibleModule::shell Result => {"stderr_lines": ["Error: No such object: mux"], "cmd": "docker inspect -f \{

{.State.Running\} } mux", "end": "2021-11-23 08:28:51.255533", "_ansible_no_log": false, "stdout": "", "changed": true, "failed": true, "delta": "0:00:00.066041", "stderr": "Error: No such object: mux", "rc": 1, "invocation": {"module_args": {"warn": true, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "docker inspect -f \{ {.State.Running}

} mux", "removes": null, "argv": null, "creates": null, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": [], "start": "2021-11-23 08:28:51.189492", "msg": "non-zero return code"}

23/11/2021 08:28:54 init.pytest_runtest_call L0039 ERROR | Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/_pytest/python.py", line 1464, in runtest

self.ihook.pytest_pyfunc_call(pyfuncitem=self)

File "/usr/local/lib/python2.7/dist-packages/pluggy/hooks.py", line 286, in call

return self._hookexec(self, self.get_hookimpls(), kwargs)

File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 93, in _hookexec

return self._inner_hookexec(hook, methods, kwargs)

File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 87, in

firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,

File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 208, in _multicall

return outcome.get_result()

File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 81, in get_result

_reraise(*ex)  # noqa

File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 187, in _multicall

res = hook_impl.function(*args)

File "/usr/local/lib/python2.7/dist-packages/_pytest/python.py", line 174, in pytest_pyfunc_call

testfunction(**testargs)

File "/data/tests/autorestart/test_container_autorestart.py", line 432, in test_containers_autorestart

run_test_on_single_container(duthost, container_name, tbinfo)

File "/data/tests/autorestart/test_container_autorestart.py", line 357, in run_test_on_single_container

is_running = is_container_running(duthost, container_name)

File "/data/tests/autorestart/test_container_autorestart.py", line 172, in is_container_running

result = duthost.shell("docker inspect -f

{{{

{.State.Running}} }} {}".format(container_name))

File "/data/tests/common/devices/multi_asic.py", line 97, in _run_on_asics

return getattr(self.sonichost, self.multi_asic_attr)(*module_args, **complex_args)

File "/data/tests/common/devices/base.py", line 89, in _run

raise RunAnsibleModuleFail("run module {} failed".format(self.module_name), res)

RunAnsibleModuleFail: run module shell failed, Ansible Results =>

{

"changed": true,

"cmd": "docker inspect -f \\\{

{.State.Running\} } mux",

"delta": "0:00:00.066041",

"end": "2021-11-23 08:28:51.255533",

"failed": true,

"invocation": {

    "module_args": {

        "_raw_params": "docker inspect -f \\\{

{.State.Running}

} mux",

        "_uses_shell": true,

        "argv": null,

        "chdir": null,

        "creates": null,

        "executable": null,

        "removes": null,

        "stdin": null,

        "stdin_add_newline": true,

        "strip_empty_ends": true,

        "warn": true

    }

},

"msg": "non-zero return code",

"rc": 1,

"start": "2021-11-23 08:28:51.189492",

"stderr": "Error: No such object: mux",

"stderr_lines": [

    "Error: No such object: mux"

],

"stdout": "",

"stdout_lines": []

}

Analysis in progress

Describe the results you expected: Should skip the feature which state is "always_disabled".

Additional information you deem important:

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```
yxieca commented 2 years ago

@yozhao101 please take a look

yozhao101 commented 2 years ago

@yxieca Acked. I will take a look and then update the status at here.

sachinv-msft commented 2 years ago

@yozhao101 any update on this issue?

sachinv-msft commented 2 years ago

@yozhao101 any updates on this one?

yozhao101 commented 2 years ago

@yanjundeng Can you share the SONiC image verion on your testbed please?

sachinv-msft commented 2 years ago

any updates on this issue @yozhao101 , this is affecting test pass %.

sachinv-msft commented 2 years ago

@yanjundeng getting back on the question raised. Can you share the SONiC image verion on your testbed please?

yanjundeng commented 2 years ago

The original test image is : "build_version": "azure_cisco_202012.14-dirty-20211120.142355"