Skip to content

Commit

Permalink
UT change: for db_migrator test do not check for RESTAPI cert values (s…
Browse files Browse the repository at this point in the history
…onic-net#2919)

What I did
MSFT ADO: 24598790

Why:
RESTAPI table has certs generated from minigraph parser.
The values in RESTAPI table (cert and key names) are dependent on how they are hardcoded in minigraph parser.
Current solution works on public repo, but breaks the internal build (different naming).

What:
Do not match values for RESTAPI attributes. The test still ensures that missing table and keys are migrated.

How I did it
How to verify it
  • Loading branch information
vaibhavhd authored and pdhruv-marvell committed Aug 23, 2023
1 parent b1fdc49 commit c636dd4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"allow_insecure": "false"
},
"RESTAPI|certs": {
"server_key": "/etc/sonic/credentials/restapiserver.key",
"ca_crt": "/etc/sonic/credentials/restapica.crt",
"server_crt": "/etc/sonic/credentials/restapiserver.crt",
"server_key": "/etc/sonic/credentials/restapi.key",
"ca_crt": "/etc/sonic/credentials/restapi.crt",
"server_crt": "/etc/sonic/credentials/restapi.crt",
"client_crt_cname": "client.restapi.sonic"
},
"TELEMETRY|gnmi": {
Expand Down
8 changes: 7 additions & 1 deletion tests/db_migrator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,13 @@ def test_warm_upgrade_to_2_0_2(self):
for table in new_tables:
resulting_table = dbmgtr.configDB.get_table(table)
expected_table = expected_db.cfgdb.get_table(table)
diff = DeepDiff(resulting_table, expected_table, ignore_order=True)
if table == "RESTAPI":
# for RESTAPI - just make sure if the new fields are added, and ignore values match
# values are ignored as minigraph parser is expected to generate different
# results for cert names based on the project specific config.
diff = set(resulting_table.get("certs").keys()) != set(expected_table.get("certs").keys())
else:
diff = DeepDiff(resulting_table, expected_table, ignore_order=True)
assert not diff

target_routing_mode_result = dbmgtr.configDB.get_table("DEVICE_METADATA")['localhost']['docker_routing_config_mode']
Expand Down

0 comments on commit c636dd4

Please sign in to comment.