Skip to content

Commit 5a68b15

Browse files
committed
Add an integration test for snapshots
1 parent 22b84ec commit 5a68b15

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/integration/compute/core_compute/test_disks.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,25 @@ def test_get_as_configs
2929
:type => "PERSISTENT" }
3030
assert_equal(example_with_params, config_with_params)
3131
end
32+
33+
def test_create_snapshot
34+
disk = @factory.create
35+
disk.wait_for { ready? }
36+
37+
snapshot = disk.create_snapshot("fog-test-snapshot")
38+
39+
assert(snapshot.is_a?(Fog::Compute::Google::Snapshot),
40+
"Resulting snapshot should be a snapshot object.")
41+
42+
assert_raises(ArgumentError) { snapshot.set_labels(["bar", "test"]) }
43+
44+
snapshot.set_labels(foo: "bar", fog: "test")
45+
46+
assert_equal(snapshot.labels[:foo], "bar")
47+
assert_equal(snapshot.labels[:fog], "test")
48+
49+
# Clean up the snapshot
50+
operation = snapshot.destroy
51+
operation.wait_for { ready? }
52+
end
3253
end

0 commit comments

Comments
 (0)