Skip to content
  • Markus Armbruster's avatar
    83273e84
    tests/drive_del-test: Fix harmless JSON interpolation bug · 83273e84
    Markus Armbruster authored
    
    
    test_after_failed_device_add() does this:
    
        response = qmp("{'execute': 'device_add',"
                       " 'arguments': {"
                       "   'driver': 'virtio-blk-%s',"
                       "   'drive': 'drive0'"
                       "}}", qvirtio_get_dev_type());
    
    Wrong.  An interpolation specification must be a JSON token, it
    doesn't work within JSON string tokens.  The code above doesn't use
    the value of qvirtio_get_dev_type(), and sends arguments
    
        {"driver": "virtio-blk-%s", "drive": "drive0"}}
    
    The command fails because there is no driver named "virtio-blk-%".
    Harmless, since the test wants the command to fail.  Screwed up in
    commit 2f84a92e.
    
    Fix the obvious way.  The command now fails because the drive is
    empty, like it did before commit 2f84a92e.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20180823164025.12553-55-armbru@redhat.com>
    83273e84
    tests/drive_del-test: Fix harmless JSON interpolation bug
    Markus Armbruster authored
    
    
    test_after_failed_device_add() does this:
    
        response = qmp("{'execute': 'device_add',"
                       " 'arguments': {"
                       "   'driver': 'virtio-blk-%s',"
                       "   'drive': 'drive0'"
                       "}}", qvirtio_get_dev_type());
    
    Wrong.  An interpolation specification must be a JSON token, it
    doesn't work within JSON string tokens.  The code above doesn't use
    the value of qvirtio_get_dev_type(), and sends arguments
    
        {"driver": "virtio-blk-%s", "drive": "drive0"}}
    
    The command fails because there is no driver named "virtio-blk-%".
    Harmless, since the test wants the command to fail.  Screwed up in
    commit 2f84a92e.
    
    Fix the obvious way.  The command now fails because the drive is
    empty, like it did before commit 2f84a92e.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20180823164025.12553-55-armbru@redhat.com>
Loading