Skip to content

Commit 88f4e66

Browse files
committed
[wip] fix bind mount test
1 parent 72cd7b0 commit 88f4e66

File tree

1 file changed

+17
-11
lines changed
  • test/integration/instance_with_config_file/controls

1 file changed

+17
-11
lines changed

test/integration/instance_with_config_file/controls/docker.rb

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,25 @@
4444
expect(mounts.count).to eq mount_definitions.count
4545
end
4646

47-
it "should have the right number of bound disk mounts" do
48-
expect(mounts.select { |m| m.Type == "bind" }.count).to eq mount_definitions.count
47+
it "should have the right number of bind mounts" do
48+
expect(mounts.select { |m| m.Type == "bind" }.count).to eq host_path_volume_definitions.count
4949
end
5050

51-
it "should have the right number of hostPath disks on the right mount points" do
52-
expect(mounts).to eq "something amazing, who knows?"
53-
fs = mounts.select { |m| m.Source.match(/config/) }
54-
expect(fs.count).to eq host_path_volume_definitions.count
55-
host_path_volume_definitions.each_with_index do |vd, i|
56-
mount_definition = mount_definitions.select { |md| md["name"] == vd["name"] }.first
57-
expect(fs[i].Destination).to eq mount_definition["mountPath"]
58-
expect(fs[i].RW).to eq !mount_definition["readOnly"]
51+
it "should have the right number of hostPath volumes on the right mount points" do
52+
mounts.each do |mount|
53+
# mount destinations have to be unique, so use it to lookup the mount definition
54+
mount_def = mount_definitions.select { |md| md["mountPath"] == mount.Destination }.first
55+
# use the mount definition name to lookup the volume by name
56+
volume_def = host_path_volume_definitions.select { |vd| vd["name"] == mount_def["name"] }.first
57+
58+
expect(mount).to eq({
59+
"Destination" => mount_def["mountPath"],
60+
"Mode" => mount_def["readOnly"] ? "ro" : "rw",
61+
"Propagation" => "rprivate",
62+
"RW" => !mount_def["readOnly"],
63+
"Source" => volume_definition["hostPath"]["path"],
64+
"Type" => "bind",
65+
})
5966
end
60-
end
6167
end
6268
end

0 commit comments

Comments
 (0)