ruby-libvirt 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/NEWS.rst +229 -0
- data/README.rst +45 -0
- data/Rakefile +114 -93
- data/ext/libvirt/connect.c +1 -0
- data/ext/libvirt/domain.c +25 -26
- data/ext/libvirt/interface.c +2 -0
- data/ext/libvirt/network.c +2 -0
- data/ext/libvirt/nodedevice.c +1 -0
- data/ext/libvirt/nwfilter.c +2 -0
- data/ext/libvirt/secret.c +1 -0
- data/ext/libvirt/storage.c +4 -2
- data/ext/libvirt/stream.c +1 -0
- data/tests/test_conn.rb +140 -125
- data/tests/test_domain.rb +279 -270
- data/tests/test_interface.rb +7 -5
- data/tests/test_network.rb +1 -1
- data/tests/test_nwfilter.rb +31 -21
- data/tests/test_open.rb +202 -190
- data/tests/test_secret.rb +75 -57
- data/tests/test_storage.rb +103 -88
- data/tests/test_utils.rb +16 -6
- metadata +17 -12
- data/NEWS +0 -154
- data/README +0 -219
- data/ext/libvirt/extconf.h +0 -3
- /data/{README.rdoc → doc/main.rdoc} +0 -0
    
        data/tests/test_secret.rb
    CHANGED
    
    | @@ -9,103 +9,121 @@ require 'test_utils.rb' | |
| 9 9 |  | 
| 10 10 | 
             
            set_test_object("secret")
         | 
| 11 11 |  | 
| 12 | 
            -
            conn = Libvirt::open( | 
| 12 | 
            +
            conn = Libvirt::open(URI)
         | 
| 13 13 |  | 
| 14 14 | 
             
            # TESTGROUP: secret.uuid
         | 
| 15 | 
            -
             | 
| 15 | 
            +
            if !test_default_uri?
         | 
| 16 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 16 17 |  | 
| 17 | 
            -
            expect_too_many_args(newsecret, "uuid", 1)
         | 
| 18 | 
            +
              expect_too_many_args(newsecret, "uuid", 1)
         | 
| 18 19 |  | 
| 19 | 
            -
            expect_success(newsecret, "no args", "uuid") {|x| x == $SECRET_UUID}
         | 
| 20 | 
            +
              expect_success(newsecret, "no args", "uuid") {|x| x == $SECRET_UUID}
         | 
| 20 21 |  | 
| 21 | 
            -
            newsecret.undefine
         | 
| 22 | 
            +
              newsecret.undefine
         | 
| 23 | 
            +
            end
         | 
| 22 24 |  | 
| 23 25 | 
             
            # TESTGROUP: secret.usagetype
         | 
| 24 | 
            -
             | 
| 26 | 
            +
            if !test_default_uri?
         | 
| 27 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 25 28 |  | 
| 26 | 
            -
            expect_too_many_args(newsecret, "usagetype", 1)
         | 
| 29 | 
            +
              expect_too_many_args(newsecret, "usagetype", 1)
         | 
| 27 30 |  | 
| 28 | 
            -
            expect_success(newsecret, "no args", "usagetype") {|x| x == Libvirt::Secret::USAGE_TYPE_VOLUME}
         | 
| 31 | 
            +
              expect_success(newsecret, "no args", "usagetype") {|x| x == Libvirt::Secret::USAGE_TYPE_VOLUME}
         | 
| 29 32 |  | 
| 30 | 
            -
            newsecret.undefine
         | 
| 33 | 
            +
              newsecret.undefine
         | 
| 34 | 
            +
            end
         | 
| 31 35 |  | 
| 32 36 | 
             
            # TESTGROUP: secret.usageid
         | 
| 33 | 
            -
             | 
| 37 | 
            +
            if !test_default_uri?
         | 
| 38 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 34 39 |  | 
| 35 | 
            -
            expect_too_many_args(newsecret, "usageid", 1)
         | 
| 40 | 
            +
              expect_too_many_args(newsecret, "usageid", 1)
         | 
| 36 41 |  | 
| 37 | 
            -
            expect_success(newsecret, "no args", "usageid")
         | 
| 42 | 
            +
              expect_success(newsecret, "no args", "usageid")
         | 
| 38 43 |  | 
| 39 | 
            -
            newsecret.undefine
         | 
| 44 | 
            +
              newsecret.undefine
         | 
| 45 | 
            +
            end
         | 
| 40 46 |  | 
| 41 47 | 
             
            # TESTGROUP: secret.xml_desc
         | 
| 42 | 
            -
             | 
| 48 | 
            +
            if !test_default_uri?
         | 
| 49 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 43 50 |  | 
| 44 | 
            -
            expect_too_many_args(newsecret, "xml_desc", 1, 2)
         | 
| 45 | 
            -
            expect_invalid_arg_type(newsecret, "xml_desc", "foo")
         | 
| 51 | 
            +
              expect_too_many_args(newsecret, "xml_desc", 1, 2)
         | 
| 52 | 
            +
              expect_invalid_arg_type(newsecret, "xml_desc", "foo")
         | 
| 46 53 |  | 
| 47 | 
            -
            expect_success(newsecret, "no args", "xml_desc")
         | 
| 54 | 
            +
              expect_success(newsecret, "no args", "xml_desc")
         | 
| 48 55 |  | 
| 49 | 
            -
            newsecret.undefine
         | 
| 56 | 
            +
              newsecret.undefine
         | 
| 57 | 
            +
            end
         | 
| 50 58 |  | 
| 51 59 | 
             
            # TESTGROUP: secret.set_value
         | 
| 52 | 
            -
             | 
| 60 | 
            +
            if !test_default_uri?
         | 
| 61 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 53 62 |  | 
| 54 | 
            -
            expect_too_many_args(newsecret, "set_value", 1, 2, 3)
         | 
| 55 | 
            -
            expect_too_few_args(newsecret, "set_value")
         | 
| 56 | 
            -
            expect_invalid_arg_type(newsecret, "set_value", 1)
         | 
| 57 | 
            -
            expect_invalid_arg_type(newsecret, "set_value", "foo", "bar")
         | 
| 63 | 
            +
              expect_too_many_args(newsecret, "set_value", 1, 2, 3)
         | 
| 64 | 
            +
              expect_too_few_args(newsecret, "set_value")
         | 
| 65 | 
            +
              expect_invalid_arg_type(newsecret, "set_value", 1)
         | 
| 66 | 
            +
              expect_invalid_arg_type(newsecret, "set_value", "foo", "bar")
         | 
| 58 67 |  | 
| 59 | 
            -
            expect_success(newsecret, "value arg", "set_value", "foo")
         | 
| 68 | 
            +
              expect_success(newsecret, "value arg", "set_value", "foo")
         | 
| 60 69 |  | 
| 61 | 
            -
            newsecret.undefine
         | 
| 70 | 
            +
              newsecret.undefine
         | 
| 71 | 
            +
            end
         | 
| 62 72 |  | 
| 63 73 | 
             
            # TESTGROUP: secret.value=
         | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
            expect_invalid_arg_type(newsecret, "value=",  | 
| 70 | 
            -
            expect_invalid_arg_type(newsecret, "value=",  | 
| 71 | 
            -
            expect_invalid_arg_type(newsecret, "value=",  | 
| 72 | 
            -
            expect_invalid_arg_type(newsecret, "value=", [ | 
| 73 | 
            -
            expect_invalid_arg_type(newsecret, "value=", [ | 
| 74 | 
            -
            expect_invalid_arg_type(newsecret, "value=", [ | 
| 75 | 
            -
            expect_invalid_arg_type(newsecret, "value=", [ | 
| 76 | 
            -
            expect_invalid_arg_type(newsecret, "value=", ['foo',  | 
| 77 | 
            -
            expect_invalid_arg_type(newsecret, "value=", ['foo',  | 
| 78 | 
            -
            expect_invalid_arg_type(newsecret, "value=", ['foo',  | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 74 | 
            +
            if !test_default_uri?
         | 
| 75 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 76 | 
            +
             | 
| 77 | 
            +
              expect_too_many_args(newsecret, "value=", 1, 2)
         | 
| 78 | 
            +
              expect_too_few_args(newsecret, "value=")
         | 
| 79 | 
            +
              expect_invalid_arg_type(newsecret, "value=", {})
         | 
| 80 | 
            +
              expect_invalid_arg_type(newsecret, "value=", nil)
         | 
| 81 | 
            +
              expect_invalid_arg_type(newsecret, "value=", 1)
         | 
| 82 | 
            +
              expect_invalid_arg_type(newsecret, "value=", [1, 1])
         | 
| 83 | 
            +
              expect_invalid_arg_type(newsecret, "value=", [nil, 1])
         | 
| 84 | 
            +
              expect_invalid_arg_type(newsecret, "value=", [[], 1])
         | 
| 85 | 
            +
              expect_invalid_arg_type(newsecret, "value=", [{}, 1])
         | 
| 86 | 
            +
              expect_invalid_arg_type(newsecret, "value=", ['foo', nil])
         | 
| 87 | 
            +
              expect_invalid_arg_type(newsecret, "value=", ['foo', 'foo'])
         | 
| 88 | 
            +
              expect_invalid_arg_type(newsecret, "value=", ['foo', []])
         | 
| 89 | 
            +
              expect_invalid_arg_type(newsecret, "value=", ['foo', {}])
         | 
| 90 | 
            +
             | 
| 91 | 
            +
              expect_success(newsecret, "value arg", "value=", "foo")
         | 
| 92 | 
            +
             | 
| 93 | 
            +
              newsecret.undefine
         | 
| 94 | 
            +
            end
         | 
| 83 95 |  | 
| 84 96 | 
             
            # TESTGROUP: secret.get_value
         | 
| 85 | 
            -
             | 
| 86 | 
            -
            newsecret. | 
| 97 | 
            +
            if !test_default_uri?
         | 
| 98 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 99 | 
            +
              newsecret.set_value("foo")
         | 
| 87 100 |  | 
| 88 | 
            -
            expect_too_many_args(newsecret, "get_value", 1, 2)
         | 
| 89 | 
            -
            expect_invalid_arg_type(newsecret, "get_value", 'foo')
         | 
| 101 | 
            +
              expect_too_many_args(newsecret, "get_value", 1, 2)
         | 
| 102 | 
            +
              expect_invalid_arg_type(newsecret, "get_value", 'foo')
         | 
| 90 103 |  | 
| 91 | 
            -
            expect_success(newsecret, "no args", "get_value") {|x| x == 'foo'}
         | 
| 104 | 
            +
              expect_success(newsecret, "no args", "get_value") {|x| x == 'foo'}
         | 
| 92 105 |  | 
| 93 | 
            -
            newsecret.undefine
         | 
| 106 | 
            +
              newsecret.undefine
         | 
| 107 | 
            +
            end
         | 
| 94 108 |  | 
| 95 109 | 
             
            # TESTGROUP: secret.undefine
         | 
| 96 | 
            -
             | 
| 110 | 
            +
            if !test_default_uri?
         | 
| 111 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 97 112 |  | 
| 98 | 
            -
            expect_too_many_args(newsecret, "undefine", 1)
         | 
| 113 | 
            +
              expect_too_many_args(newsecret, "undefine", 1)
         | 
| 99 114 |  | 
| 100 | 
            -
            expect_success(newsecret, "no args", "undefine")
         | 
| 115 | 
            +
              expect_success(newsecret, "no args", "undefine")
         | 
| 116 | 
            +
            end
         | 
| 101 117 |  | 
| 102 118 | 
             
            # TESTGROUP: secret.free
         | 
| 103 | 
            -
             | 
| 104 | 
            -
            newsecret. | 
| 119 | 
            +
            if !test_default_uri?
         | 
| 120 | 
            +
              newsecret = conn.define_secret_xml($new_secret_xml)
         | 
| 121 | 
            +
              newsecret.undefine
         | 
| 105 122 |  | 
| 106 | 
            -
            expect_too_many_args(newsecret, "free", 1)
         | 
| 123 | 
            +
              expect_too_many_args(newsecret, "free", 1)
         | 
| 107 124 |  | 
| 108 | 
            -
            expect_success(newsecret, "no args", "free")
         | 
| 125 | 
            +
              expect_success(newsecret, "no args", "free")
         | 
| 126 | 
            +
            end
         | 
| 109 127 |  | 
| 110 128 | 
             
            # END TESTS
         | 
| 111 129 |  | 
    
        data/tests/test_storage.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ require 'test_utils.rb' | |
| 9 9 |  | 
| 10 10 | 
             
            set_test_object("storage_pool")
         | 
| 11 11 |  | 
| 12 | 
            -
            conn = Libvirt::open( | 
| 12 | 
            +
            conn = Libvirt::open(URI)
         | 
| 13 13 |  | 
| 14 14 | 
             
            begin
         | 
| 15 15 | 
             
              oldpool = conn.lookup_storage_pool_by_name("rb-libvirt-test")
         | 
| @@ -20,7 +20,9 @@ rescue | |
| 20 20 | 
             
            end
         | 
| 21 21 |  | 
| 22 22 | 
             
            # test setup
         | 
| 23 | 
            -
             | 
| 23 | 
            +
            if !test_default_uri?
         | 
| 24 | 
            +
              `rm -rf #{$POOL_PATH}; mkdir -p #{$POOL_PATH} ; echo $?`
         | 
| 25 | 
            +
            end
         | 
| 24 26 |  | 
| 25 27 | 
             
            new_storage_vol_xml = <<EOF
         | 
| 26 28 | 
             
            <volume>
         | 
| @@ -100,10 +102,15 @@ expect_invalid_arg_type(newpool, "delete", 'foo') | |
| 100 102 |  | 
| 101 103 | 
             
            expect_success(newpool, "no args", "delete")
         | 
| 102 104 |  | 
| 103 | 
            -
             | 
| 105 | 
            +
            if !test_default_uri?
         | 
| 106 | 
            +
              `mkdir -p /tmp/rb-libvirt-test`
         | 
| 107 | 
            +
            end
         | 
| 104 108 |  | 
| 105 109 | 
             
            newpool.undefine
         | 
| 106 | 
            -
             | 
| 110 | 
            +
             | 
| 111 | 
            +
            if !test_default_uri?
         | 
| 112 | 
            +
              `mkdir -p #{$POOL_PATH}`
         | 
| 113 | 
            +
            end
         | 
| 107 114 |  | 
| 108 115 | 
             
            # TESTGROUP: pool.refresh
         | 
| 109 116 | 
             
            newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
         | 
| @@ -320,7 +327,7 @@ newpool.undefine | |
| 320 327 |  | 
| 321 328 | 
             
            # TESTGROUP: pool.persistent?
         | 
| 322 329 | 
             
            newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
         | 
| 323 | 
            -
             | 
| 330 | 
            +
            test_sleep 1
         | 
| 324 331 |  | 
| 325 332 | 
             
            expect_too_many_args(newpool, "persistent?", 1)
         | 
| 326 333 |  | 
| @@ -336,7 +343,7 @@ newpool.undefine | |
| 336 343 |  | 
| 337 344 | 
             
            # TESTGROUP:
         | 
| 338 345 | 
             
            newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
         | 
| 339 | 
            -
             | 
| 346 | 
            +
            test_sleep 1
         | 
| 340 347 |  | 
| 341 348 | 
             
            expect_too_many_args(newpool, "list_all_volumes", 1, 2)
         | 
| 342 349 | 
             
            expect_invalid_arg_type(newpool, "list_all_volumes", 'foo')
         | 
| @@ -383,16 +390,18 @@ expect_success(newvol, "no args", "delete") | |
| 383 390 | 
             
            newpool.destroy
         | 
| 384 391 |  | 
| 385 392 | 
             
            # TESTGROUP: vol.wipe
         | 
| 386 | 
            -
             | 
| 387 | 
            -
             | 
| 393 | 
            +
            if !test_default_uri?
         | 
| 394 | 
            +
              newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
         | 
| 395 | 
            +
              newvol = newpool.create_volume_xml(new_storage_vol_xml)
         | 
| 388 396 |  | 
| 389 | 
            -
            expect_too_many_args(newvol, "wipe", 1, 2)
         | 
| 390 | 
            -
            expect_invalid_arg_type(newvol, "wipe", 'foo')
         | 
| 397 | 
            +
              expect_too_many_args(newvol, "wipe", 1, 2)
         | 
| 398 | 
            +
              expect_invalid_arg_type(newvol, "wipe", 'foo')
         | 
| 391 399 |  | 
| 392 | 
            -
            expect_success(newvol, "no args", "wipe")
         | 
| 400 | 
            +
              expect_success(newvol, "no args", "wipe")
         | 
| 393 401 |  | 
| 394 | 
            -
            newvol.delete
         | 
| 395 | 
            -
            newpool.destroy
         | 
| 402 | 
            +
              newvol.delete
         | 
| 403 | 
            +
              newpool.destroy
         | 
| 404 | 
            +
            end
         | 
| 396 405 |  | 
| 397 406 | 
             
            # TESTGROUP: vol.info
         | 
| 398 407 | 
             
            newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
         | 
| @@ -440,85 +449,91 @@ expect_success(newvol, "no args", "free") | |
| 440 449 | 
             
            newpool.destroy
         | 
| 441 450 |  | 
| 442 451 | 
             
            # TESTGROUP: vol.download
         | 
| 443 | 
            -
             | 
| 444 | 
            -
             | 
| 445 | 
            -
             | 
| 446 | 
            -
             | 
| 447 | 
            -
             | 
| 448 | 
            -
             | 
| 449 | 
            -
            expect_too_few_args(newvol, "download" | 
| 450 | 
            -
            expect_too_few_args(newvol, "download", 1 | 
| 451 | 
            -
             | 
| 452 | 
            -
            expect_invalid_arg_type(newvol, "download",  | 
| 453 | 
            -
            expect_invalid_arg_type(newvol, "download",  | 
| 454 | 
            -
            expect_invalid_arg_type(newvol, "download",  | 
| 455 | 
            -
            expect_invalid_arg_type(newvol, "download",  | 
| 456 | 
            -
            expect_invalid_arg_type(newvol, "download",  | 
| 457 | 
            -
            expect_invalid_arg_type(newvol, "download", stream,  | 
| 458 | 
            -
            expect_invalid_arg_type(newvol, "download", stream,  | 
| 459 | 
            -
            expect_invalid_arg_type(newvol, "download", stream,  | 
| 460 | 
            -
            expect_invalid_arg_type(newvol, "download", stream,  | 
| 461 | 
            -
            expect_invalid_arg_type(newvol, "download", stream, 1,  | 
| 462 | 
            -
            expect_invalid_arg_type(newvol, "download", stream, 1,  | 
| 463 | 
            -
            expect_invalid_arg_type(newvol, "download", stream, 1,  | 
| 464 | 
            -
            expect_invalid_arg_type(newvol, "download", stream, 1,  | 
| 465 | 
            -
            expect_invalid_arg_type(newvol, "download", stream, 1, 1,  | 
| 466 | 
            -
            expect_invalid_arg_type(newvol, "download", stream, 1, 1,  | 
| 467 | 
            -
             | 
| 468 | 
            -
             | 
| 469 | 
            -
             | 
| 470 | 
            -
             | 
| 471 | 
            -
             | 
| 452 | 
            +
            if !test_default_uri?
         | 
| 453 | 
            +
              newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
         | 
| 454 | 
            +
              newvol = newpool.create_volume_xml(new_storage_vol_xml)
         | 
| 455 | 
            +
              stream = conn.stream
         | 
| 456 | 
            +
             | 
| 457 | 
            +
              expect_too_many_args(newvol, "download", 1, 2, 3, 4, 5)
         | 
| 458 | 
            +
              expect_too_few_args(newvol, "download")
         | 
| 459 | 
            +
              expect_too_few_args(newvol, "download", 1)
         | 
| 460 | 
            +
              expect_too_few_args(newvol, "download", 1, 2)
         | 
| 461 | 
            +
              expect_invalid_arg_type(newvol, "download", nil, 1, 1)
         | 
| 462 | 
            +
              expect_invalid_arg_type(newvol, "download", 'foo', 1, 1)
         | 
| 463 | 
            +
              expect_invalid_arg_type(newvol, "download", 1, 1, 1)
         | 
| 464 | 
            +
              expect_invalid_arg_type(newvol, "download", [], 1, 1)
         | 
| 465 | 
            +
              expect_invalid_arg_type(newvol, "download", {}, 1, 1)
         | 
| 466 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, nil, 1)
         | 
| 467 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, 'foo', 1)
         | 
| 468 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, [], 1)
         | 
| 469 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, {}, 1)
         | 
| 470 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, 1, nil)
         | 
| 471 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, 1, 'foo')
         | 
| 472 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, 1, [])
         | 
| 473 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, 1, {})
         | 
| 474 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, 1, 1, 'foo')
         | 
| 475 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, 1, 1, [])
         | 
| 476 | 
            +
              expect_invalid_arg_type(newvol, "download", stream, 1, 1, {})
         | 
| 477 | 
            +
             | 
| 478 | 
            +
              expect_success(newvol, "stream, offset, and length args", "download", stream, 0, 10)
         | 
| 479 | 
            +
             | 
| 480 | 
            +
              newvol.delete
         | 
| 481 | 
            +
              newpool.destroy
         | 
| 482 | 
            +
            end
         | 
| 472 483 |  | 
| 473 484 | 
             
            # TESTGROUP: vol.upload
         | 
| 474 | 
            -
             | 
| 475 | 
            -
             | 
| 476 | 
            -
             | 
| 477 | 
            -
             | 
| 478 | 
            -
             | 
| 479 | 
            -
             | 
| 480 | 
            -
            expect_too_few_args(newvol, "upload" | 
| 481 | 
            -
            expect_too_few_args(newvol, "upload", 1 | 
| 482 | 
            -
             | 
| 483 | 
            -
            expect_invalid_arg_type(newvol, "upload",  | 
| 484 | 
            -
            expect_invalid_arg_type(newvol, "upload",  | 
| 485 | 
            -
            expect_invalid_arg_type(newvol, "upload",  | 
| 486 | 
            -
            expect_invalid_arg_type(newvol, "upload",  | 
| 487 | 
            -
            expect_invalid_arg_type(newvol, "upload",  | 
| 488 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream,  | 
| 489 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream,  | 
| 490 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream,  | 
| 491 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream,  | 
| 492 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream, 1,  | 
| 493 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream, 1,  | 
| 494 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream, 1,  | 
| 495 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream, 1,  | 
| 496 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream, 1, 1,  | 
| 497 | 
            -
            expect_invalid_arg_type(newvol, "upload", stream, 1, 1,  | 
| 498 | 
            -
             | 
| 499 | 
            -
             | 
| 500 | 
            -
             | 
| 501 | 
            -
             | 
| 502 | 
            -
             | 
| 485 | 
            +
            if !test_default_uri?
         | 
| 486 | 
            +
              newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
         | 
| 487 | 
            +
              newvol = newpool.create_volume_xml(new_storage_vol_xml)
         | 
| 488 | 
            +
              stream = conn.stream
         | 
| 489 | 
            +
             | 
| 490 | 
            +
              expect_too_many_args(newvol, "upload", 1, 2, 3, 4, 5)
         | 
| 491 | 
            +
              expect_too_few_args(newvol, "upload")
         | 
| 492 | 
            +
              expect_too_few_args(newvol, "upload", 1)
         | 
| 493 | 
            +
              expect_too_few_args(newvol, "upload", 1, 2)
         | 
| 494 | 
            +
              expect_invalid_arg_type(newvol, "upload", nil, 1, 1)
         | 
| 495 | 
            +
              expect_invalid_arg_type(newvol, "upload", 'foo', 1, 1)
         | 
| 496 | 
            +
              expect_invalid_arg_type(newvol, "upload", 1, 1, 1)
         | 
| 497 | 
            +
              expect_invalid_arg_type(newvol, "upload", [], 1, 1)
         | 
| 498 | 
            +
              expect_invalid_arg_type(newvol, "upload", {}, 1, 1)
         | 
| 499 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, nil, 1)
         | 
| 500 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, 'foo', 1)
         | 
| 501 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, [], 1)
         | 
| 502 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, {}, 1)
         | 
| 503 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, 1, nil)
         | 
| 504 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, 1, 'foo')
         | 
| 505 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, 1, [])
         | 
| 506 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, 1, {})
         | 
| 507 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, 1, 1, 'foo')
         | 
| 508 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, 1, 1, [])
         | 
| 509 | 
            +
              expect_invalid_arg_type(newvol, "upload", stream, 1, 1, {})
         | 
| 510 | 
            +
             | 
| 511 | 
            +
              expect_success(newvol, "stream, offset, and length args", "upload", stream, 0, 10)
         | 
| 512 | 
            +
             | 
| 513 | 
            +
              newvol.delete
         | 
| 514 | 
            +
              newpool.destroy
         | 
| 515 | 
            +
            end
         | 
| 503 516 |  | 
| 504 517 | 
             
            # TESTGROUP: vol.upload
         | 
| 505 | 
            -
             | 
| 506 | 
            -
             | 
| 507 | 
            -
             | 
| 508 | 
            -
             | 
| 509 | 
            -
             | 
| 510 | 
            -
             | 
| 511 | 
            -
            expect_invalid_arg_type(newvol, "wipe_pattern",  | 
| 512 | 
            -
            expect_invalid_arg_type(newvol, "wipe_pattern",  | 
| 513 | 
            -
            expect_invalid_arg_type(newvol, "wipe_pattern",  | 
| 514 | 
            -
            expect_invalid_arg_type(newvol, "wipe_pattern",  | 
| 515 | 
            -
            expect_invalid_arg_type(newvol, "wipe_pattern", 0,  | 
| 516 | 
            -
            expect_invalid_arg_type(newvol, "wipe_pattern", 0,  | 
| 517 | 
            -
             | 
| 518 | 
            -
             | 
| 519 | 
            -
             | 
| 520 | 
            -
             | 
| 521 | 
            -
             | 
| 518 | 
            +
            if !test_default_uri?
         | 
| 519 | 
            +
              newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
         | 
| 520 | 
            +
              newvol = newpool.create_volume_xml(new_storage_vol_xml)
         | 
| 521 | 
            +
             | 
| 522 | 
            +
              expect_too_many_args(newvol, "wipe_pattern", 1, 2, 3)
         | 
| 523 | 
            +
              expect_too_few_args(newvol, "wipe_pattern")
         | 
| 524 | 
            +
              expect_invalid_arg_type(newvol, "wipe_pattern", nil)
         | 
| 525 | 
            +
              expect_invalid_arg_type(newvol, "wipe_pattern", 'foo')
         | 
| 526 | 
            +
              expect_invalid_arg_type(newvol, "wipe_pattern", [])
         | 
| 527 | 
            +
              expect_invalid_arg_type(newvol, "wipe_pattern", {})
         | 
| 528 | 
            +
              expect_invalid_arg_type(newvol, "wipe_pattern", 0, 'foo')
         | 
| 529 | 
            +
              expect_invalid_arg_type(newvol, "wipe_pattern", 0, [])
         | 
| 530 | 
            +
              expect_invalid_arg_type(newvol, "wipe_pattern", 0, {})
         | 
| 531 | 
            +
             | 
| 532 | 
            +
              expect_success(newvol, "alg arg", "wipe_pattern", Libvirt::StorageVol::WIPE_ALG_ZERO)
         | 
| 533 | 
            +
             | 
| 534 | 
            +
              newvol.delete
         | 
| 535 | 
            +
              newpool.destroy
         | 
| 536 | 
            +
            end
         | 
| 522 537 |  | 
| 523 538 | 
             
            # END TESTS
         | 
| 524 539 |  | 
    
        data/tests/test_utils.rb
    CHANGED
    
    | @@ -2,7 +2,8 @@ $FAIL = 0 | |
| 2 2 | 
             
            $SUCCESS = 0
         | 
| 3 3 | 
             
            $SKIPPED = 0
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 5 | 
            +
            DEFAULT_URI = "test:///default"
         | 
| 6 | 
            +
            URI = ENV['RUBY_LIBVIRT_TEST_URI'] || DEFAULT_URI
         | 
| 6 7 |  | 
| 7 8 | 
             
            $GUEST_BASE = '/var/lib/libvirt/images/rb-libvirt-test'
         | 
| 8 9 | 
             
            $GUEST_DISK = $GUEST_BASE + '.qcow2'
         | 
| @@ -59,9 +60,6 @@ $new_dom_xml = <<EOF | |
| 59 60 | 
             
            </domain>
         | 
| 60 61 | 
             
            EOF
         | 
| 61 62 |  | 
| 62 | 
            -
            # qemu command-line that roughly corresponds to the above XML
         | 
| 63 | 
            -
            $qemu_cmd_line = "/usr/bin/qemu-kvm -S -M pc-0.13 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rb-libvirt-test -uuid #{$GUEST_UUID} -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/rb-libvirt-test.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot c -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5"
         | 
| 64 | 
            -
             | 
| 65 63 | 
             
            $NEW_INTERFACE_MAC = 'aa:bb:cc:dd:ee:ff'
         | 
| 66 64 | 
             
            $new_interface_xml = <<EOF
         | 
| 67 65 | 
             
            <interface type="ethernet" name="rb-libvirt-test">
         | 
| @@ -134,6 +132,16 @@ def set_test_object(obj) | |
| 134 132 | 
             
              $test_object = obj
         | 
| 135 133 | 
             
            end
         | 
| 136 134 |  | 
| 135 | 
            +
            def test_default_uri?()
         | 
| 136 | 
            +
              return URI == DEFAULT_URI
         | 
| 137 | 
            +
            end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
            def test_sleep(s)
         | 
| 140 | 
            +
              if !test_default_uri?
         | 
| 141 | 
            +
                sleep s
         | 
| 142 | 
            +
              end
         | 
| 143 | 
            +
            end
         | 
| 144 | 
            +
             | 
| 137 145 | 
             
            def expect_success(object, msg, func, *args)
         | 
| 138 146 | 
             
              begin
         | 
| 139 147 | 
             
                x = object.__send__(func, *args)
         | 
| @@ -246,8 +254,10 @@ def cleanup_test_domain(conn) | |
| 246 254 | 
             
                # in case we didn't undefine it, don't do anything
         | 
| 247 255 | 
             
              end
         | 
| 248 256 |  | 
| 249 | 
            -
               | 
| 250 | 
            -
             | 
| 257 | 
            +
              if URI != DEFAULT_URI
         | 
| 258 | 
            +
                `rm -f #{$GUEST_DISK}`
         | 
| 259 | 
            +
                `rm -f #{$GUEST_SAVE}`
         | 
| 260 | 
            +
              end
         | 
| 251 261 | 
             
            end
         | 
| 252 262 |  | 
| 253 263 | 
             
            def cleanup_test_network(conn)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,27 +1,30 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ruby-libvirt
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.8. | 
| 4 | 
            +
              version: 0.8.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 | 
            -
            - David Lutterkort | 
| 7 | 
            +
            - David Lutterkort
         | 
| 8 | 
            +
            - Chris Lalancette
         | 
| 8 9 | 
             
            autorequire:
         | 
| 9 10 | 
             
            bindir: bin
         | 
| 10 11 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 12 | 
            +
            date: 2024-05-13 00:00:00.000000000 Z
         | 
| 12 13 | 
             
            dependencies: []
         | 
| 13 | 
            -
            description:  | 
| 14 | 
            -
             | 
| 14 | 
            +
            description: |
         | 
| 15 | 
            +
              ruby-libvirt allows applications written in Ruby to use the
         | 
| 16 | 
            +
              libvirt API.
         | 
| 17 | 
            +
            email: devel@lists.libvirt.org
         | 
| 15 18 | 
             
            executables: []
         | 
| 16 19 | 
             
            extensions:
         | 
| 17 20 | 
             
            - ext/libvirt/extconf.rb
         | 
| 18 21 | 
             
            extra_rdoc_files: []
         | 
| 19 22 | 
             
            files:
         | 
| 20 23 | 
             
            - COPYING
         | 
| 21 | 
            -
            - NEWS
         | 
| 22 | 
            -
            - README
         | 
| 23 | 
            -
            - README.rdoc
         | 
| 24 | 
            +
            - NEWS.rst
         | 
| 25 | 
            +
            - README.rst
         | 
| 24 26 | 
             
            - Rakefile
         | 
| 27 | 
            +
            - doc/main.rdoc
         | 
| 25 28 | 
             
            - ext/libvirt/_libvirt.c
         | 
| 26 29 | 
             
            - ext/libvirt/common.c
         | 
| 27 30 | 
             
            - ext/libvirt/common.h
         | 
| @@ -29,7 +32,6 @@ files: | |
| 29 32 | 
             
            - ext/libvirt/connect.h
         | 
| 30 33 | 
             
            - ext/libvirt/domain.c
         | 
| 31 34 | 
             
            - ext/libvirt/domain.h
         | 
| 32 | 
            -
            - ext/libvirt/extconf.h
         | 
| 33 35 | 
             
            - ext/libvirt/extconf.rb
         | 
| 34 36 | 
             
            - ext/libvirt/interface.c
         | 
| 35 37 | 
             
            - ext/libvirt/interface.h
         | 
| @@ -60,7 +62,10 @@ files: | |
| 60 62 | 
             
            homepage: https://ruby.libvirt.org/
         | 
| 61 63 | 
             
            licenses:
         | 
| 62 64 | 
             
            - LGPL-2.1-or-later
         | 
| 63 | 
            -
            metadata: | 
| 65 | 
            +
            metadata:
         | 
| 66 | 
            +
              source_code_uri: https://gitlab.com/libvirt/libvirt-ruby
         | 
| 67 | 
            +
              bug_tracker_uri: https://gitlab.com/libvirt/libvirt-ruby/-/issues
         | 
| 68 | 
            +
              documentation_uri: https://ruby.libvirt.org/api/index.html
         | 
| 64 69 | 
             
            post_install_message:
         | 
| 65 70 | 
             
            rdoc_options: []
         | 
| 66 71 | 
             
            require_paths:
         | 
| @@ -76,8 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 76 81 | 
             
                - !ruby/object:Gem::Version
         | 
| 77 82 | 
             
                  version: '0'
         | 
| 78 83 | 
             
            requirements: []
         | 
| 79 | 
            -
            rubygems_version: 3.4. | 
| 84 | 
            +
            rubygems_version: 3.4.19
         | 
| 80 85 | 
             
            signing_key:
         | 
| 81 86 | 
             
            specification_version: 4
         | 
| 82 | 
            -
            summary: Ruby bindings for  | 
| 87 | 
            +
            summary: Ruby bindings for libvirt
         | 
| 83 88 | 
             
            test_files: []
         |