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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c6f8ac82e7287b315c4983229aad826ffc6dc2616d7b94c0f1887c3f3fbfdd4
4
- data.tar.gz: 15e6f00245977ef5f27fa4c9fb09ee81e320534e2b2757ab6f812cb43f2d5e03
3
+ metadata.gz: 0b723b02e719da68e14ea28e557e7288ebf83e3f7770fe26b7a24c67b5edfa2a
4
+ data.tar.gz: 7fc550f1fa2ee2ef1803849c04ed561eeb8417ea34c7a9dec37a336d02223d90
5
5
  SHA512:
6
- metadata.gz: 813a82a35180d748b4d629b71e9ff9204a31a4482443e70e49830a1457ff545d7b7542ecfea6644991a864a5052f3cf3ef905276cfd171e0248b62327072d6f0
7
- data.tar.gz: ddbdb11f5bf6420395f772189ce8145f65120c01aee09a065702c735fae641f75a809875713dd6a525eaf0d1ecb53724d5fe5fe48fc246ca21d9268393f0235f
6
+ metadata.gz: 619b786dc4939d75e666676eace51b0b87623ee800333e9569bd3ccc31204773badc2d5bcb449e2e9852faec5dc1cce997fd7d83dae58c07bb2651f265769081
7
+ data.tar.gz: e260b90a3249fe4f5de2469e9777b0f6a6a3e8c21cb86989c8470ee575d17155b7505df325f792321f91d098549278cf368026ff6275dee369c56be26cfc904c
@@ -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 false if disk_type.nil?
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))
@@ -28,6 +28,6 @@ module Kitchen
28
28
  # release. Keep it on one line.
29
29
  #
30
30
  # @return [String] the gem version
31
- GCE_VERSION = "3.0.0"
31
+ GCE_VERSION = "3.0.1"
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Test Kitchen Team