Skip to content

Commit

Permalink
[GCU] Moving PatchSorter unit-test to json file to make it easier to …
Browse files Browse the repository at this point in the history
…read/maintain (sonic-net#1977)

#### What I did
Moved PatchSorter unit-test to json file to make it easier to read/maintain

In the future this test json file can be used for adding nightly tests.

While testing I had to set `skip_exact_change_list_match=True` because different runs of the same input produce correct but different changes. It is better to always generate the same steps for easier debugging. Created issue: sonic-net#1976

#### How I did it
Copied to Json file the following:
- current_config i.e. current running config
- patch 
- expected change list

#### How to verify it
unit-tests
  • Loading branch information
ghooo authored Dec 21, 2021
1 parent 1a75870 commit 4f39f9f
Show file tree
Hide file tree
Showing 3 changed files with 2,934 additions and 177 deletions.
71 changes: 71 additions & 0 deletions tests/generic_config_updater/files/patch_sorter_test_failure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"EMPTYING_A_CONFIGDB_TABLE__FAILURE": {
"desc": "Emptying a configdb table fails because empty tables are not allowed in configdb. User should remove whole table instead e.g. remove /ACL_TABLE in this case.",
"current_config": {
"ACL_TABLE": {
"EVERFLOW": {
"policy_desc": "EVERFLOW",
"ports": [
"Ethernet0"
],
"stage": "ingress",
"type": "MIRROR"
}
},
"PORT": {
"Ethernet0": {
"alias": "Eth1",
"lanes": "65, 66, 67, 68",
"description": "Ethernet0 100G link",
"speed": "100000"
}
}
},
"patch": [
{"op": "remove", "path": "/ACL_TABLE/EVERFLOW"}
],
"expected_error_substrings": [
"There is no possible sorting"
]
},
"ADDING_AN_EMPTY_CONFIGDB_TABLE__FAILURE": {
"desc": "Adding an empty configdb table fail because empty tables are not allowed in configdb.",
"current_config": {},
"patch": [
{"op": "add", "path": "/VLAN", "value": {}}
],
"expected_error_substrings": [
"There is no possible sorting"
]
},
"EMPTYING_MULTIPLE_CONFIGDB_TABLE__FAILURE": {
"desc": "Emptying multiple configdb table fails because empty tables are not allowed in configdb. User should remove whole tables instead e.g. remove /PORT and /ACL_TABLE in this case.",
"current_config": {
"ACL_TABLE": {
"EVERFLOW": {
"policy_desc": "EVERFLOW",
"ports": [
"Ethernet0"
],
"stage": "ingress",
"type": "MIRROR"
}
},
"PORT": {
"Ethernet0": {
"alias": "Eth1",
"lanes": "65, 66, 67, 68",
"description": "Ethernet0 100G link",
"speed": "100000"
}
}
},
"patch": [
{"op": "remove", "path": "/ACL_TABLE/EVERFLOW"},
{"op": "remove", "path": "/PORT/Ethernet0"}
],
"expected_error_substrings": [
"There is no possible sorting"
]
}
}
Loading

0 comments on commit 4f39f9f

Please sign in to comment.