Skip to content

Commit

Permalink
test process BUGFIX ignore order of the elements
Browse files Browse the repository at this point in the history
System ordered lists do not need to preserve the order of the elements.
  • Loading branch information
Humblesaw committed Apr 9, 2024
1 parent 4035100 commit 6db279b
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/test_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ test_oper_crash_set2(int rp, int wp)
sr_session_ctx_t *sess;
sr_data_t *data;
char *str1;
const char *str2;
const char *str2, *str3;
int ret;

/* wait for the other process */
Expand Down Expand Up @@ -527,7 +527,24 @@ test_oper_crash_set2(int rp, int wp)
" </interface>\n"
"</interfaces-state>\n";

sr_assert_string_equal(str1, str2);
str3 =
"<interfaces-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\""
" xmlns:or=\"urn:ietf:params:xml:ns:yang:ietf-origin\" or:origin=\"or:unknown\">\n"
" <interface>\n"
" <name>eth1</name>\n"
" <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
" <speed>1024</speed>\n"
" </interface>\n"
" <interface>\n"
" <name>eth0</name>\n"
" <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
" <speed>512</speed>\n"
" </interface>\n"
"</interfaces-state>\n";

/* order of the operational state data might not be deterministic (e.g. system ordered lists)
across all datastore plugins, so check for both possibilities */
sr_assert_true(!strcmp(str1, str2) || !strcmp(str1, str3));
free(str1);

sr_disconnect(conn);
Expand Down

0 comments on commit 6db279b

Please sign in to comment.