ruby-libvirt 0.4.0 → 0.5.0

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.
@@ -7,15 +7,7 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
- def find_valid_iface(conn)
11
- conn.list_interfaces.each do |ifname|
12
- iface = conn.lookup_interface_by_name(ifname)
13
- if iface.mac == "00:00:00:00:00:00"
14
- next
15
- end
16
- return iface
17
- end
18
- end
10
+ set_test_object("interface")
19
11
 
20
12
  conn = Libvirt::open("qemu:///system")
21
13
 
@@ -83,7 +75,7 @@ testiface = find_valid_iface(conn)
83
75
  if not testiface.nil?
84
76
  expect_too_many_args(testiface, "mac", 1)
85
77
 
86
- expect_success(testiface, "no args", "mac") {|x| x == testiface.mac}
78
+ expect_success(testiface, "no args", "mac")
87
79
  end
88
80
 
89
81
  # TESTGROUP: iface.xml_desc
@@ -101,6 +93,8 @@ expect_too_many_args(newiface, "free", 1)
101
93
 
102
94
  expect_success(newiface, "no args", "free")
103
95
 
96
+ # END TESTS
97
+
104
98
  conn.close
105
99
 
106
100
  finish_tests
@@ -7,16 +7,11 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
+ set_test_object("network")
11
+
10
12
  conn = Libvirt::open("qemu:///system")
11
13
 
12
- # initial cleanup for previous run
13
- begin
14
- oldnet = conn.lookup_network_by_name("ruby-libvirt-tester")
15
- oldnet.destroy
16
- oldnet.undefine
17
- rescue
18
- # in case we didn't find it, don't do anything
19
- end
14
+ cleanup_test_network(conn)
20
15
 
21
16
  # TESTGROUP: net.undefine
22
17
  newnet = conn.define_network_xml($new_net_xml)
@@ -37,6 +32,19 @@ expect_fail(newnet, Libvirt::Error, "on already running network", "create")
37
32
  newnet.destroy
38
33
  newnet.undefine
39
34
 
35
+ # TESTGROUP: net.update
36
+ newnet = conn.create_network_xml($new_net_xml)
37
+
38
+ expect_too_few_args(newnet, "update", 1)
39
+
40
+ command = Libvirt::Network::NETWORK_UPDATE_COMMAND_ADD_LAST
41
+ section = Libvirt::Network::NETWORK_SECTION_IP_DHCP_HOST
42
+ flags = Libvirt::Network::NETWORK_UPDATE_AFFECT_CURRENT
43
+ expect_success(newnet, "dhcp ip", "update",
44
+ command, section, -1, $new_network_dhcp_ip, flags)
45
+
46
+ newnet.destroy
47
+
40
48
  # TESTGROUP: net.destroy
41
49
  newnet = conn.create_network_xml($new_net_xml)
42
50
 
@@ -104,16 +112,16 @@ expect_invalid_arg_type(newnet, "autostart=", 1234)
104
112
 
105
113
  expect_success(newnet, "boolean arg", "autostart=", true)
106
114
  if not newnet.autostart?
107
- puts_fail "net.autostart= did not set autostart to true"
115
+ puts_fail "network.autostart= did not set autostart to true"
108
116
  else
109
- puts_ok "net.autostart= set autostart to true"
117
+ puts_ok "network.autostart= set autostart to true"
110
118
  end
111
119
 
112
120
  expect_success(newnet, "boolean arg", "autostart=", false)
113
121
  if newnet.autostart?
114
- puts_fail "net.autostart= did not set autostart to false"
122
+ puts_fail "network.autostart= did not set autostart to false"
115
123
  else
116
- puts_ok "net.autostart= set autostart to false"
124
+ puts_ok "network.autostart= set autostart to false"
117
125
  end
118
126
 
119
127
  newnet.undefine
@@ -160,6 +168,7 @@ expect_success(newnet, "no args", "persistent?") {|x| x == true}
160
168
 
161
169
  newnet.undefine
162
170
 
171
+ # END TESTS
163
172
 
164
173
  conn.close
165
174
 
@@ -7,6 +7,8 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
+ set_test_object("nodedevice")
11
+
10
12
  conn = Libvirt::open("qemu:///system")
11
13
 
12
14
  # TESTGROUP: nodedevice.name
@@ -43,7 +45,13 @@ expect_success(testnode, "no args", "xml_desc")
43
45
  # TESTGROUP: nodedevice.detach
44
46
  testnode = conn.lookup_nodedevice_by_name(conn.list_nodedevices[0])
45
47
 
46
- expect_too_many_args(testnode, "detach", 1)
48
+ expect_too_many_args(testnode, "detach", 1, 2, 3)
49
+ expect_invalid_arg_type(testnode, "detach", 1)
50
+ expect_invalid_arg_type(testnode, "detach", [])
51
+ expect_invalid_arg_type(testnode, "detach", {})
52
+ expect_invalid_arg_type(testnode, "detach", nil, 'foo')
53
+ expect_invalid_arg_type(testnode, "detach", nil, [])
54
+ expect_invalid_arg_type(testnode, "detach", nil, {})
47
55
 
48
56
  #expect_success(testnode, "no args", "detach")
49
57
 
@@ -75,6 +83,8 @@ expect_too_many_args(testnode, "free", 1)
75
83
 
76
84
  expect_success(testnode, "no args", "free")
77
85
 
86
+ # END TESTS
87
+
78
88
  conn.close
79
89
 
80
90
  finish_tests
@@ -7,6 +7,8 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
+ set_test_object("nwfilter")
11
+
10
12
  conn = Libvirt::open("qemu:///system")
11
13
 
12
14
  # TESTGROUP: nwfilter.undefine
@@ -51,6 +53,8 @@ expect_too_many_args(newnw, "free", 1)
51
53
 
52
54
  expect_success(newnw, "no args", "free")
53
55
 
56
+ # END TESTS
57
+
54
58
  conn.close
55
59
 
56
60
  finish_tests
data/tests/test_open.rb CHANGED
@@ -7,6 +7,8 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
+ set_test_object("Libvirt")
11
+
10
12
  def expect_connect_error(func, args)
11
13
  expect_fail(Libvirt, Libvirt::ConnectionError, "invalid driver", func, *args)
12
14
  end
@@ -59,6 +61,36 @@ conn.close
59
61
  conn = expect_success(Libvirt, "uri, full cred, and user args", "open_auth", "qemu:///system", [Libvirt::CRED_AUTHNAME, Libvirt::CRED_PASSPHRASE], "hello") {|x| x.class == Libvirt::Connect }
60
62
  conn.close
61
63
 
64
+ # equivalent to expect_invalid_arg_type
65
+ begin
66
+ conn = Libvirt::open_auth("qemu:///system", {}) do |cred|
67
+ end
68
+ rescue TypeError => e
69
+ puts_ok "#{$test_object}.open_auth invalid arg type threw #{TypeError.to_s}"
70
+ else
71
+ puts_fail "#{$test_object}.open_auth invalid arg type expected to throw #{TypeError.to_s}, but threw nothing"
72
+ end
73
+
74
+ # equivalent to expect_invalid_arg_type
75
+ begin
76
+ conn = Libvirt::open_auth("qemu:///system", 1) do |cred|
77
+ end
78
+ rescue TypeError => e
79
+ puts_ok "#{$test_object}.open_auth invalid arg type threw #{TypeError.to_s}"
80
+ else
81
+ puts_fail "#{$test_object}.open_auth invalid arg type expected to throw #{TypeError.to_s}, but threw nothing"
82
+ end
83
+
84
+ # equivalent to expect_invalid_arg_type
85
+ begin
86
+ conn = Libvirt::open_auth("qemu:///system", 'foo') do |cred|
87
+ end
88
+ rescue TypeError => e
89
+ puts_ok "#{$test_object}.open_auth invalid arg type threw #{TypeError.to_s}"
90
+ else
91
+ puts_fail "#{$test_object}.open_auth invalid arg type expected to throw #{TypeError.to_s}, but threw nothing"
92
+ end
93
+
62
94
  # equivalent to "expect_success"
63
95
  begin
64
96
  conn = Libvirt::open_auth("qemu:///system", [Libvirt::CRED_AUTHNAME, Libvirt::CRED_PASSPHRASE], "hello") do |cred|
@@ -80,12 +112,25 @@ begin
80
112
  res
81
113
  end
82
114
 
83
- puts_ok "open_auth uri, creds, userdata, auth block succeeded"
115
+ puts_ok "Libvirt.open_auth uri, creds, userdata, auth block succeeded"
84
116
  conn.close
85
117
  rescue NoMethodError
86
- puts_skipped "open_auth does not exist"
118
+ puts_skipped "Libvirt.open_auth does not exist"
87
119
  rescue => e
88
- puts_fail "open_auth uri, creds, userdata, auth block expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
120
+ puts_fail "Libvirt.open_auth uri, creds, userdata, auth block expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
121
+ end
122
+
123
+ # equivalent to "expect_success"
124
+ begin
125
+ conn = Libvirt::open_auth("qemu:///system") do |cred|
126
+ end
127
+
128
+ puts_ok "Libvirt.open_auth uri, succeeded"
129
+ conn.close
130
+ rescue NoMethodError
131
+ puts_skipped "Libvirt.open_auth does not exist"
132
+ rescue => e
133
+ puts_fail "Libvirt.open_auth uri expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
89
134
  end
90
135
 
91
136
  # equivalent to "expect_success"
@@ -109,12 +154,12 @@ begin
109
154
  res
110
155
  end
111
156
 
112
- puts_ok "open_auth uri, creds, userdata, R/O flag, auth block succeeded"
157
+ puts_ok "Libvirt.open_auth uri, creds, userdata, R/O flag, auth block succeeded"
113
158
  conn.close
114
159
  rescue NoMethodError
115
- puts_skipped "open_auth does not exist"
160
+ puts_skipped "Libvirt.open_auth does not exist"
116
161
  rescue => e
117
- puts_fail "open_auth uri, creds, userdata, R/O flag, auth block expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
162
+ puts_fail "Libvirt.open_auth uri, creds, userdata, R/O flag, auth block expected to succeed, threw #{e.class.to_s}: #{e.to_s}"
118
163
  end
119
164
 
120
165
  # TESTGROUP: Libvirt::event_invoke_handle_callback
@@ -125,6 +170,9 @@ expect_too_few_args(Libvirt, "event_invoke_handle_callback")
125
170
  expect_too_few_args(Libvirt, "event_invoke_handle_callback", 1)
126
171
  expect_too_few_args(Libvirt, "event_invoke_handle_callback", 1, 2)
127
172
  expect_too_few_args(Libvirt, "event_invoke_handle_callback", 1, 2, 3)
173
+ expect_invalid_arg_type(Libvirt, "event_invoke_handle_callback", "hello", 1, 1, 1)
174
+ expect_invalid_arg_type(Libvirt, "event_invoke_handle_callback", "hello", 1, 1, [])
175
+ expect_invalid_arg_type(Libvirt, "event_invoke_handle_callback", "hello", 1, 1, nil)
128
176
  # this is a bit bizarre; I am constructing a bogus hash to pass as the 4th
129
177
  # parameter to event_invoke_handle_callback. In a real situation, I would
130
178
  # have been given this hash from libvirt earlier, and just pass it on. I
@@ -145,6 +193,9 @@ conn = Libvirt::open("qemu:///system")
145
193
  expect_too_many_args(Libvirt, "event_invoke_timeout_callback", 1, 2, 3)
146
194
  expect_too_few_args(Libvirt, "event_invoke_timeout_callback")
147
195
  expect_too_few_args(Libvirt, "event_invoke_timeout_callback", 1)
196
+ expect_invalid_arg_type(Libvirt, "event_invoke_timeout_callback", "hello", 1)
197
+ expect_invalid_arg_type(Libvirt, "event_invoke_timeout_callback", "hello", [])
198
+ expect_invalid_arg_type(Libvirt, "event_invoke_timeout_callback", "hello", nil)
148
199
  # this is a bit bizarre; I am constructing a bogus hash to pass as the 4th
149
200
  # parameter to event_invoke_handle_callback. In a real situation, I would
150
201
  # have been given this hash from libvirt earlier, and just pass it on. I
@@ -194,4 +245,6 @@ expect_success(Libvirt, "unregister all callbacks", "event_register_impl", nil,
194
245
  expect_success(Libvirt, "all Proc callbacks", "event_register_impl", virEventAddHandleProc, virEventUpdateHandleProc, virEventRemoveHandleProc, virEventAddTimerProc, virEventUpdateTimerProc, virEventRemoveTimerProc)
195
246
  expect_success(Libvirt, "unregister all callbacks", "event_register_impl")
196
247
 
248
+ # END TESTS
249
+
197
250
  finish_tests
data/tests/test_secret.rb CHANGED
@@ -7,6 +7,8 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
+ set_test_object("secret")
11
+
10
12
  conn = Libvirt::open("qemu:///system")
11
13
 
12
14
  # TESTGROUP: secret.uuid
@@ -58,6 +60,27 @@ expect_success(newsecret, "value arg", "set_value", "foo")
58
60
 
59
61
  newsecret.undefine
60
62
 
63
+ # TESTGROUP: secret.value=
64
+ newsecret = conn.define_secret_xml($new_secret_xml)
65
+
66
+ expect_too_many_args(newsecret, "value=", 1, 2)
67
+ expect_too_few_args(newsecret, "value=")
68
+ expect_invalid_arg_type(newsecret, "value=", {})
69
+ expect_invalid_arg_type(newsecret, "value=", nil)
70
+ expect_invalid_arg_type(newsecret, "value=", 1)
71
+ expect_invalid_arg_type(newsecret, "value=", [1, 1])
72
+ expect_invalid_arg_type(newsecret, "value=", [nil, 1])
73
+ expect_invalid_arg_type(newsecret, "value=", [[], 1])
74
+ expect_invalid_arg_type(newsecret, "value=", [{}, 1])
75
+ expect_invalid_arg_type(newsecret, "value=", ['foo', nil])
76
+ expect_invalid_arg_type(newsecret, "value=", ['foo', 'foo'])
77
+ expect_invalid_arg_type(newsecret, "value=", ['foo', []])
78
+ expect_invalid_arg_type(newsecret, "value=", ['foo', {}])
79
+
80
+ expect_success(newsecret, "value arg", "value=", "foo")
81
+
82
+ newsecret.undefine
83
+
61
84
  # TESTGROUP: secret.get_value
62
85
  newsecret = conn.define_secret_xml($new_secret_xml)
63
86
  newsecret.set_value("foo")
@@ -84,6 +107,8 @@ expect_too_many_args(newsecret, "free", 1)
84
107
 
85
108
  expect_success(newsecret, "no args", "free")
86
109
 
110
+ # END TESTS
111
+
87
112
  conn.close
88
113
 
89
114
  finish_tests
@@ -7,6 +7,8 @@ $: << File.dirname(__FILE__)
7
7
  require 'libvirt'
8
8
  require 'test_utils.rb'
9
9
 
10
+ set_test_object("storage_pool")
11
+
10
12
  conn = Libvirt::open("qemu:///system")
11
13
 
12
14
  begin
@@ -18,7 +20,7 @@ rescue
18
20
  end
19
21
 
20
22
  # test setup
21
- `rm -rf #{$POOL_PATH}; mkdir #{$POOL_PATH} ; echo $?`
23
+ `rm -rf #{$POOL_PATH}; mkdir -p #{$POOL_PATH} ; echo $?`
22
24
 
23
25
  new_storage_vol_xml = <<EOF
24
26
  <volume>
@@ -98,9 +100,10 @@ expect_invalid_arg_type(newpool, "delete", 'foo')
98
100
 
99
101
  expect_success(newpool, "no args", "delete")
100
102
 
101
- `mkdir /tmp/ruby-libvirt-tester`
103
+ `mkdir -p /tmp/ruby-libvirt-tester`
102
104
 
103
105
  newpool.undefine
106
+ `mkdir -p #{$POOL_PATH}`
104
107
 
105
108
  # TESTGROUP: pool.refresh
106
109
  newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
@@ -172,16 +175,16 @@ expect_invalid_arg_type(newpool, "autostart=", 1234)
172
175
 
173
176
  expect_success(newpool, "no args", "autostart=", true)
174
177
  if not newpool.autostart?
175
- puts_fail "pool.autostart= did not set autostart to true"
178
+ puts_fail "storage_pool.autostart= did not set autostart to true"
176
179
  else
177
- puts_ok "pool.autostart= set autostart to true"
180
+ puts_ok "storage_pool.autostart= set autostart to true"
178
181
  end
179
182
 
180
183
  expect_success(newpool, "no args", "autostart=", false)
181
184
  if newpool.autostart?
182
- puts_fail "pool.autostart= did not set autostart to false"
185
+ puts_fail "storage_pool.autostart= did not set autostart to false"
183
186
  else
184
- puts_ok "pool.autostart= set autostart to false"
187
+ puts_ok "storage_pool.autostart= set autostart to false"
185
188
  end
186
189
 
187
190
  newpool.undefine
@@ -200,8 +203,11 @@ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
200
203
 
201
204
  expect_too_many_args(newpool, "list_volumes", 1)
202
205
 
206
+ expect_success(newpool, "no args", "list_volumes")
207
+ newvol = newpool.create_volume_xml(new_storage_vol_xml)
203
208
  expect_success(newpool, "no args", "list_volumes")
204
209
 
210
+ newvol.delete
205
211
  newpool.destroy
206
212
 
207
213
  # TESTGROUP: pool.free
@@ -256,28 +262,6 @@ expect_success(newpool, "name arg", "lookup_volume_by_path", newvol.path)
256
262
  newvol.delete
257
263
  newpool.destroy
258
264
 
259
- # TESTGROUP: vol.name
260
- newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
261
- newvol = newpool.create_volume_xml(new_storage_vol_xml)
262
-
263
- expect_too_many_args(newvol, "name", 1)
264
-
265
- expect_success(newvol, "no args", "name")
266
-
267
- newvol.delete
268
- newpool.destroy
269
-
270
- # TESTGROUP: vol.key
271
- newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
272
- newvol = newpool.create_volume_xml(new_storage_vol_xml)
273
-
274
- expect_too_many_args(newvol, "key", 1)
275
-
276
- expect_success(newvol, "no args", "key")
277
-
278
- newvol.delete
279
- newpool.destroy
280
-
281
265
  # TESTGROUP: pool.create_volume_xml
282
266
  newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
283
267
 
@@ -350,6 +334,43 @@ expect_success(newpool, "no args", "persistent?") {|x| x == true}
350
334
 
351
335
  newpool.undefine
352
336
 
337
+ # TESTGROUP:
338
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
339
+ sleep 1
340
+
341
+ expect_too_many_args(newpool, "list_all_volumes", 1, 2)
342
+ expect_invalid_arg_type(newpool, "list_all_volumes", 'foo')
343
+ expect_invalid_arg_type(newpool, "list_all_volumes", [])
344
+ expect_invalid_arg_type(newpool, "list_all_volumes", {})
345
+
346
+ expect_success(newpool, "no args", "list_all_volumes")
347
+
348
+ newpool.destroy
349
+
350
+ set_test_object("storage_volume")
351
+
352
+ # TESTGROUP: vol.name
353
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
354
+ newvol = newpool.create_volume_xml(new_storage_vol_xml)
355
+
356
+ expect_too_many_args(newvol, "name", 1)
357
+
358
+ expect_success(newvol, "no args", "name")
359
+
360
+ newvol.delete
361
+ newpool.destroy
362
+
363
+ # TESTGROUP: vol.key
364
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
365
+ newvol = newpool.create_volume_xml(new_storage_vol_xml)
366
+
367
+ expect_too_many_args(newvol, "key", 1)
368
+
369
+ expect_success(newvol, "no args", "key")
370
+
371
+ newvol.delete
372
+ newpool.destroy
373
+
353
374
  # TESTGROUP: vol.delete
354
375
  newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
355
376
  newvol = newpool.create_volume_xml(new_storage_vol_xml)
@@ -418,6 +439,89 @@ expect_success(newvol, "no args", "free")
418
439
 
419
440
  newpool.destroy
420
441
 
442
+ # TESTGROUP: vol.download
443
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
444
+ newvol = newpool.create_volume_xml(new_storage_vol_xml)
445
+ stream = conn.stream
446
+
447
+ expect_too_many_args(newvol, "download", 1, 2, 3, 4, 5)
448
+ expect_too_few_args(newvol, "download")
449
+ expect_too_few_args(newvol, "download", 1)
450
+ expect_too_few_args(newvol, "download", 1, 2)
451
+ expect_invalid_arg_type(newvol, "download", nil, 1, 1)
452
+ expect_invalid_arg_type(newvol, "download", 'foo', 1, 1)
453
+ expect_invalid_arg_type(newvol, "download", 1, 1, 1)
454
+ expect_invalid_arg_type(newvol, "download", [], 1, 1)
455
+ expect_invalid_arg_type(newvol, "download", {}, 1, 1)
456
+ expect_invalid_arg_type(newvol, "download", stream, nil, 1)
457
+ expect_invalid_arg_type(newvol, "download", stream, 'foo', 1)
458
+ expect_invalid_arg_type(newvol, "download", stream, [], 1)
459
+ expect_invalid_arg_type(newvol, "download", stream, {}, 1)
460
+ expect_invalid_arg_type(newvol, "download", stream, 1, nil)
461
+ expect_invalid_arg_type(newvol, "download", stream, 1, 'foo')
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, 1, 'foo')
465
+ expect_invalid_arg_type(newvol, "download", stream, 1, 1, [])
466
+ expect_invalid_arg_type(newvol, "download", stream, 1, 1, {})
467
+
468
+ expect_success(newvol, "stream, offset, and length args", "download", stream, 0, 10)
469
+
470
+ newvol.delete
471
+ newpool.destroy
472
+
473
+ # TESTGROUP: vol.upload
474
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
475
+ newvol = newpool.create_volume_xml(new_storage_vol_xml)
476
+ stream = conn.stream
477
+
478
+ expect_too_many_args(newvol, "upload", 1, 2, 3, 4, 5)
479
+ expect_too_few_args(newvol, "upload")
480
+ expect_too_few_args(newvol, "upload", 1)
481
+ expect_too_few_args(newvol, "upload", 1, 2)
482
+ expect_invalid_arg_type(newvol, "upload", nil, 1, 1)
483
+ expect_invalid_arg_type(newvol, "upload", 'foo', 1, 1)
484
+ expect_invalid_arg_type(newvol, "upload", 1, 1, 1)
485
+ expect_invalid_arg_type(newvol, "upload", [], 1, 1)
486
+ expect_invalid_arg_type(newvol, "upload", {}, 1, 1)
487
+ expect_invalid_arg_type(newvol, "upload", stream, nil, 1)
488
+ expect_invalid_arg_type(newvol, "upload", stream, 'foo', 1)
489
+ expect_invalid_arg_type(newvol, "upload", stream, [], 1)
490
+ expect_invalid_arg_type(newvol, "upload", stream, {}, 1)
491
+ expect_invalid_arg_type(newvol, "upload", stream, 1, nil)
492
+ expect_invalid_arg_type(newvol, "upload", stream, 1, 'foo')
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, 1, 'foo')
496
+ expect_invalid_arg_type(newvol, "upload", stream, 1, 1, [])
497
+ expect_invalid_arg_type(newvol, "upload", stream, 1, 1, {})
498
+
499
+ expect_success(newvol, "stream, offset, and length args", "upload", stream, 0, 10)
500
+
501
+ newvol.delete
502
+ newpool.destroy
503
+
504
+ # TESTGROUP: vol.upload
505
+ newpool = conn.create_storage_pool_xml($new_storage_pool_xml)
506
+ newvol = newpool.create_volume_xml(new_storage_vol_xml)
507
+
508
+ expect_too_many_args(newvol, "wipe_pattern", 1, 2, 3)
509
+ expect_too_few_args(newvol, "wipe_pattern")
510
+ expect_invalid_arg_type(newvol, "wipe_pattern", nil)
511
+ expect_invalid_arg_type(newvol, "wipe_pattern", 'foo')
512
+ expect_invalid_arg_type(newvol, "wipe_pattern", [])
513
+ expect_invalid_arg_type(newvol, "wipe_pattern", {})
514
+ expect_invalid_arg_type(newvol, "wipe_pattern", 0, 'foo')
515
+ expect_invalid_arg_type(newvol, "wipe_pattern", 0, [])
516
+ expect_invalid_arg_type(newvol, "wipe_pattern", 0, {})
517
+
518
+ expect_success(newvol, "alg arg", "wipe_pattern", Libvirt::StorageVol::WIPE_ALG_ZERO)
519
+
520
+ newvol.delete
521
+ newpool.destroy
522
+
523
+ # END TESTS
524
+
421
525
  conn.close
422
526
 
423
527
  finish_tests