|
44 | 44 | expect(mounts.count).to eq mount_definitions.count
|
45 | 45 | end
|
46 | 46 |
|
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 |
49 | 49 | end
|
50 | 50 |
|
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 | + }) |
59 | 66 | end
|
60 |
| - end |
61 | 67 | end
|
62 | 68 | end
|
0 commit comments