All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Asleson <tasleson@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - lvmdbustest: Only inject 1 missing key error
Date: Fri, 10 Mar 2023 18:52:31 +0000 (GMT)	[thread overview]
Message-ID: <20230310185231.017713858C60@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9714f3ec4f3d4526a33781baf706c24930b6f26c
Commit:        9714f3ec4f3d4526a33781baf706c24930b6f26c
Parent:        2359023009db40112f4220899f0983684d897765
Author:        Tony Asleson <tasleson@redhat.com>
AuthorDate:    Thu Mar 9 11:25:58 2023 -0600
Committer:     Tony Asleson <tasleson@redhat.com>
CommitterDate: Fri Mar 10 12:51:53 2023 -0600

lvmdbustest: Only inject 1 missing key error

Previously we were injecting a missing key in the lv, vg, and pv.
Given the order of processing in lvmdbusd, this prevented us from
exercising all the error paths.  Change to returning just 1 instead.
---
 test/dbus/lvm_error_inject.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/dbus/lvm_error_inject.py b/test/dbus/lvm_error_inject.py
index d87286740..98520845c 100755
--- a/test/dbus/lvm_error_inject.py
+++ b/test/dbus/lvm_error_inject.py
@@ -79,6 +79,7 @@ def write_some(q, stream, remaining=False, binary=False):
 def del_random_key(src_dict):
     keys = list(src_dict.keys())
     pick = random.randint(0, len(keys) - 1)
+    debug("%s will be deleted" % keys[pick])
     del src_dict[keys[pick]]
 
 
@@ -87,16 +88,19 @@ def inject_key_error(output_json):
     for r in output_json['report']:
         if 'lv' in r:
             for i in r['lv']:
+                debug("deleting a lv key")
                 del_random_key(i)
-                break
+                return
         if 'vg' in r:
             for i in r["vg"]:
+                debug("deleting a vg key")
                 del_random_key(i)
-                break
+                return
         elif 'pv' in r:
             for i in r["pv"]:
+                debug("deleting a pv key")
                 del_random_key(i)
-                break
+                return
 
 
 def inject_exit_error(output_json, val):


                 reply	other threads:[~2023-03-10 18:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230310185231.017713858C60@sourceware.org \
    --to=tasleson@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.