diff mbox series

[ovs-dev] tests ovsdb-server: Fix config-file same schema test.

Message ID 20240120094252.437163-1-frode.nordahl@canonical.com
State Accepted
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev] tests ovsdb-server: Fix config-file same schema test. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Frode Nordahl Jan. 20, 2024, 9:42 a.m. UTC
When a configuration file is used the ovsdb-server (re-)configures
databases in multiple passes.  First the configuration file is
read and a shash is populated, second the shash is iterated over
to remove/create databases.

The "ovsdb-server config-file - same schema" test currently relies
on a certain ordering of this shash, but we can't really rely on a
specific ordering as it would be environment specific.

The test currently fails on big endian systems such as s390x with:
-WARN|failed to open database 'db2': ovsdb error: ordinals: duplicate database name
+WARN|failed to open database 'db': ovsdb error: ordinals: duplicate database name

Normalize the logged database name so that the test can focus on
the fact that duplication is detected rather than in which order.

Fixes: 55140090e63a ("ovsdb-server: Allow user-provided config files.")
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
---
 tests/ovsdb-server.at | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Simon Horman Jan. 22, 2024, 11:37 a.m. UTC | #1
On Sat, Jan 20, 2024 at 09:42:52AM +0000, Frode Nordahl wrote:
> When a configuration file is used the ovsdb-server (re-)configures
> databases in multiple passes.  First the configuration file is
> read and a shash is populated, second the shash is iterated over
> to remove/create databases.
> 
> The "ovsdb-server config-file - same schema" test currently relies
> on a certain ordering of this shash, but we can't really rely on a
> specific ordering as it would be environment specific.
> 
> The test currently fails on big endian systems such as s390x with:
> -WARN|failed to open database 'db2': ovsdb error: ordinals: duplicate database name
> +WARN|failed to open database 'db': ovsdb error: ordinals: duplicate database name
> 
> Normalize the logged database name so that the test can focus on
> the fact that duplication is detected rather than in which order.
> 
> Fixes: 55140090e63a ("ovsdb-server: Allow user-provided config files.")
> Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>

Acked-by: Simon Horman <horms@ovn.org>
Ilya Maximets Jan. 22, 2024, 8:43 p.m. UTC | #2
On 1/22/24 12:37, Simon Horman wrote:
> On Sat, Jan 20, 2024 at 09:42:52AM +0000, Frode Nordahl wrote:
>> When a configuration file is used the ovsdb-server (re-)configures
>> databases in multiple passes.  First the configuration file is
>> read and a shash is populated, second the shash is iterated over
>> to remove/create databases.
>>
>> The "ovsdb-server config-file - same schema" test currently relies
>> on a certain ordering of this shash, but we can't really rely on a
>> specific ordering as it would be environment specific.
>>
>> The test currently fails on big endian systems such as s390x with:
>> -WARN|failed to open database 'db2': ovsdb error: ordinals: duplicate database name
>> +WARN|failed to open database 'db': ovsdb error: ordinals: duplicate database name
>>
>> Normalize the logged database name so that the test can focus on
>> the fact that duplication is detected rather than in which order.
>>
>> Fixes: 55140090e63a ("ovsdb-server: Allow user-provided config files.")
>> Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
> 
> Acked-by: Simon Horman <horms@ovn.org>
> 

Thanks, Frode and Simon!

Ideally we would add a new argument for the sed strings to the macro
and have a particular replacement logic in the test itself.  But since
the replacement is actually only needed for one test, seems fine as-is.

Applied.  Backported to 3.3 as well.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index c87ecc2e3..b8ccc4c8e 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -2870,7 +2870,9 @@  m4_define([TEST_CONFIG_FILE],
                 --config-file=config.json], [$3], [ignore], [stderr])
   m4_if([$4], [], [], [
     AT_CHECK([cat stderr | grep -v -E 'INFO|DBG' \
-        | grep -v 'failed to load configuration from' > warnings])
+        | grep -v 'failed to load configuration from' \
+        | sed -e "/duplicate database name/ s/'db'/'db2'/" \
+        > warnings])
     AT_CHECK([cat warnings], [0], [m4_if([$3], [0], [$4], [$4
 ovsdb-server: server configuration failed
 ])])])