Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip ECN config test on unsupported platform #8649

Conversation

bingwang-ms
Copy link
Collaborator

@bingwang-ms bingwang-ms commented Jun 16, 2023

Description of PR

Summary:
Fixes #8648
If is_valid_platform_and_version returns False, we will see below exception

**Description**

        try:
            if is_valid_platform_and_version(duthost, "WRED_PROFILE", "ECN tuning"):
                output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile)
                expect_op_success(duthost, output)
                ensure_application_of_updated_config(duthost, configdb_field, ",".join(values))
            else:
>               expect_op_failure(output)
E               UnboundLocalError: local variable 'output' referenced before assignment

It's because the output variable is not defined.
Actually, the test case should be skipped if the platform is unsupported.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

This PR is to skip ECN config test on unsupported platform.

How did you do it?

If is_valid_platform_and_version returns False, skip the test.

How did you verify/test it?

Verified on a SN4600 testbed

collected 4 items                                                                                                                                                                           

generic_config_updater/test_ecn_config_update.py::test_ecn_config_updates[replace-green_min_threshold] SKIPPED                                                                        [ 25%]
generic_config_updater/test_ecn_config_update.py::test_ecn_config_updates[replace-green_max_threshold] SKIPPED                                                                        [ 50%]
generic_config_updater/test_ecn_config_update.py::test_ecn_config_updates[replace-green_drop_probability] SKIPPED                                                                     [ 75%]
generic_config_updater/test_ecn_config_update.py::test_ecn_config_updates[replace-green_min_threshold,green_max_threshold,green_drop_probability] SKIPPED                             [100%]

Any platform specific information?

No.

Supported testbed topology if it's a new test case?

Not a new test case.

Documentation

@bingwang-ms
Copy link
Collaborator Author

Discussed with @isabelmsft , PR #8341 will be reverted from 202205 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GCU] Undefined variable in test_ecn_config_updates
3 participants