kitchen-google 3.0.0 → 3.0.1
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/lib/kitchen/driver/gce.rb +18 -6
- data/lib/kitchen/driver/gce_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b723b02e719da68e14ea28e557e7288ebf83e3f7770fe26b7a24c67b5edfa2a
|
|
4
|
+
data.tar.gz: 7fc550f1fa2ee2ef1803849c04ed561eeb8417ea34c7a9dec37a336d02223d90
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 619b786dc4939d75e666676eace51b0b87623ee800333e9569bd3ccc31204773badc2d5bcb449e2e9852faec5dc1cce997fd7d83dae58c07bb2651f265769081
|
|
7
|
+
data.tar.gz: e260b90a3249fe4f5de2469e9777b0f6a6a3e8c21cb86989c8470ee575d17155b7505df325f792321f91d098549278cf368026ff6275dee369c56be26cfc904c
|
data/lib/kitchen/driver/gce.rb
CHANGED
|
@@ -125,11 +125,17 @@ module Kitchen
|
|
|
125
125
|
|
|
126
126
|
# Configuration applied to every disk before the user's own settings.
|
|
127
127
|
#
|
|
128
|
+
# Deliberately sets no `disk_type`. GCE derives an omitted disk type from
|
|
129
|
+
# the instance's machine series -- pd-standard on first- and
|
|
130
|
+
# second-generation series such as N1 and N2, pd-balanced on C3, C3D and
|
|
131
|
+
# M3, and hyperdisk-balanced on C4, N4 and newer -- so leaving it unset is
|
|
132
|
+
# the only default that is compatible with every machine type. Naming one
|
|
133
|
+
# here would fail outright on the families that no longer accept it.
|
|
134
|
+
#
|
|
128
135
|
# @return [Hash] the per-disk defaults
|
|
129
136
|
DISK_DEFAULT_CONFIG = {
|
|
130
137
|
autodelete_disk: true,
|
|
131
138
|
disk_size: 10,
|
|
132
|
-
disk_type: "pd-standard",
|
|
133
139
|
}.freeze
|
|
134
140
|
|
|
135
141
|
# Human-readable driver name shown in Test Kitchen output.
|
|
@@ -269,9 +275,12 @@ module Kitchen
|
|
|
269
275
|
boot: true,
|
|
270
276
|
autodelete_disk: config.fetch(:autodelete_disk, DISK_DEFAULT_CONFIG[:autodelete_disk]),
|
|
271
277
|
disk_size: config.fetch(:disk_size, DISK_DEFAULT_CONFIG[:disk_size]),
|
|
272
|
-
disk_type: config.fetch(:disk_type, DISK_DEFAULT_CONFIG[:disk_type]),
|
|
273
278
|
}
|
|
274
279
|
|
|
280
|
+
# Carry the key only when the user set it, so that an unset type stays
|
|
281
|
+
# absent rather than becoming an explicit nil. See DISK_DEFAULT_CONFIG.
|
|
282
|
+
disk_config[:disk_type] = config[:disk_type] if config[:disk_type]
|
|
283
|
+
|
|
275
284
|
raise "Disk type #{disk_config[:disk_type]} is not valid" unless valid_disk_type?(disk_config[:disk_type])
|
|
276
285
|
|
|
277
286
|
disk_config
|
|
@@ -525,10 +534,13 @@ module Kitchen
|
|
|
525
534
|
|
|
526
535
|
# Whether a disk type exists in the target zone.
|
|
527
536
|
#
|
|
537
|
+
# An unset type is valid: the driver sends no `diskType` at all and GCE
|
|
538
|
+
# substitutes the default for the instance's machine series.
|
|
539
|
+
#
|
|
528
540
|
# @param disk_type [String, nil] the disk type to check
|
|
529
|
-
# @return [Boolean] true if the disk type is valid
|
|
541
|
+
# @return [Boolean] true if the disk type is valid or unset
|
|
530
542
|
def valid_disk_type?(disk_type)
|
|
531
|
-
return
|
|
543
|
+
return true if disk_type.nil?
|
|
532
544
|
|
|
533
545
|
check_api_call { connection.get_disk_type(project, zone, disk_type) }
|
|
534
546
|
end
|
|
@@ -753,7 +765,7 @@ module Kitchen
|
|
|
753
765
|
disk.boot = true if disk_config[:boot]
|
|
754
766
|
disk.auto_delete = disk_config[:autodelete_disk]
|
|
755
767
|
params.disk_size_gb = disk_config[:disk_size]
|
|
756
|
-
params.disk_type = disk_type_url_for(disk_config[:disk_type])
|
|
768
|
+
params.disk_type = disk_type_url_for(disk_config[:disk_type]) if disk_config[:disk_type]
|
|
757
769
|
|
|
758
770
|
if local_ssd?(disk_config)
|
|
759
771
|
info("Creating a #{LOCAL_SSD_SIZE_GB} GB local ssd as scratch disk (https://cloud.google.com/compute/docs/disks/#localssds).")
|
|
@@ -781,7 +793,7 @@ module Kitchen
|
|
|
781
793
|
disk = Google::Apis::ComputeV1::Disk.new
|
|
782
794
|
disk.name = unique_disk_name
|
|
783
795
|
disk.size_gb = disk_config[:disk_size]
|
|
784
|
-
disk.type = disk_type_url_for(disk_config[:disk_type])
|
|
796
|
+
disk.type = disk_type_url_for(disk_config[:disk_type]) if disk_config[:disk_type]
|
|
785
797
|
|
|
786
798
|
info("Creating a #{disk_config[:disk_size]} GB disk named #{unique_disk_name}...")
|
|
787
799
|
wait_for_operation(connection.insert_disk(project, zone, disk))
|