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

Add GCU empty input test to verify functional usage and valid configDB #5459

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions tests/generic_config_updater/test_empty_input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import logging
import pytest

from tests.generic_config_updater.gu_utils import apply_patch, expect_op_success
from tests.generic_config_updater.gu_utils import generate_tmpfile, delete_tmpfile
from tests.generic_config_updater.gu_utils import create_checkpoint, delete_checkpoint, rollback_or_reload

logger = logging.getLogger(__name__)

@pytest.fixture(autouse=True)
def setup_env(duthosts, rand_one_dut_hostname):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup_env

Seems that you are assume there is some pre-condition before you run this test case.

Suggest make the pre-condition of invalid configDB explicit. So it will always be tested in a reproducible fashion.

"""
Setup/teardown fixture for empty input=

Args:
duthosts: list of DUTs.
rand_selected_dut: The fixture returns a randomly selected DuT.
"""
duthost = duthosts[rand_one_dut_hostname]
create_checkpoint(duthost)

yield

try:
logger.info("Rolled back to original checkpoint")
rollback_or_reload(duthost)

finally:
delete_checkpoint(duthost)

def test_tc1_empty_input(duthost):
json_patch = []

tmpfile = generate_tmpfile(duthost)
logger.info("tmpfile {}".format(tmpfile))

try:
output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile)
expect_op_success(duthost, output)
finally:
delete_tmpfile(duthost, tmpfile)
1 change: 1 addition & 0 deletions tests/kvmtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ test_t0() {
container_checker/test_container_checker.py \
process_monitoring/test_critical_process_monitoring.py \
system_health/test_system_status.py \
generic_config_updater/test_empty_input.py \
generic_config_updater/test_aaa.py \
generic_config_updater/test_bgpl.py \
generic_config_updater/test_bgp_prefix.py \
Expand Down