kitchen-vra 3.3.4 → 3.4.0

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: fafa7c0d38316e0caed88baf634bd75e30f096bfe9798edcd1a9e3d7a5c994ff
4
- data.tar.gz: 7a50b7b1e4189297c2b739f4ea5eac816550b0097129709e2e99d4f53c1d870e
3
+ metadata.gz: c3ad4a4ab887a646b1856e8329bfa319f85c85adf5ab1d55785ed443e31ea623
4
+ data.tar.gz: b178306e4e6e20e88f27d1274913a6bf7c2be4ba9871fda69b8373938550783f
5
5
  SHA512:
6
- metadata.gz: ad976260af42bb96af58b18b9cd3837f5eda92c0b98b8e86d29676e76862cb1d9c3d4c3dbd604fb09018415622a53f4796d1f79673b357215023dff53854076b
7
- data.tar.gz: 0b9fb222821945220304a7d04bffea5b80f98adbf156d43aef3b09aa2d5f75e43619eae90793146984a11e99e07d1f9b9425752aa783f647351d6dca6f0426b1
6
+ metadata.gz: 4e2cbf243619ad72b38384a2520e7ccc68646e16c472e1356e088f00058ebf707e86aa558470dd75fb17b13a0742448ea1c822b73e1e38482340e1296b9a0686
7
+ data.tar.gz: 1a85f3b0bb3cbd9fa872a057225e0ab9494940830bbb68833b81968fc197b2e883bf32163022dbe83cb8eba5abce8212ba9467e8e5dd62c8462185a4236d92b6
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "3.3.4"
2
+ ".": "3.4.0"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -10,6 +10,19 @@
10
10
  * Docs: rewrite README for new users and split contributor docs ([#80](https://github.com/test-kitchen/kitchen-vra/pull/80)) ([d9ebc45](https://github.com/test-kitchen/kitchen-vra/commit/d9ebc45))
11
11
  * Standardize renovate config and remove dependabot ([#81](https://github.com/test-kitchen/kitchen-vra/pull/81)) ([be552bd](https://github.com/test-kitchen/kitchen-vra/commit/be552bd))
12
12
 
13
+ ## [3.4.0](https://github.com/test-kitchen/kitchen-vra/compare/v3.3.4...v3.4.0) (2026-08-24)
14
+
15
+
16
+ ### Features
17
+
18
+ * implement the driver status hook ([#88](https://github.com/test-kitchen/kitchen-vra/issues/88)) ([933e254](https://github.com/test-kitchen/kitchen-vra/commit/933e25445d1a231490ef977cbbfd9644aa16022d))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * constrain the test-kitchen dependency ([#86](https://github.com/test-kitchen/kitchen-vra/issues/86)) ([ac5f32d](https://github.com/test-kitchen/kitchen-vra/commit/ac5f32d1dd5eb132c91a3fda58ee41f778148245))
24
+ * drop the unused rack runtime dependency ([#89](https://github.com/test-kitchen/kitchen-vra/issues/89)) ([b68f1fd](https://github.com/test-kitchen/kitchen-vra/commit/b68f1fdd4dfc6d1a0c37320f8b099b5d0ca19c8a))
25
+
13
26
  ## [3.3.4](https://github.com/test-kitchen/kitchen-vra/compare/v3.3.3...v3.3.4) (2026-08-23)
14
27
 
15
28
 
data/Gemfile CHANGED
@@ -10,10 +10,6 @@ group :test do
10
10
  gem "webmock"
11
11
  end
12
12
 
13
- group :debug do
14
- gem "pry"
15
- end
16
-
17
13
  group :docs do
18
14
  gem "yard"
19
15
  end
data/kitchen-vra.gemspec CHANGED
@@ -20,9 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = ">= 3.1"
22
22
 
23
- spec.add_dependency "test-kitchen"
23
+ spec.add_dependency "test-kitchen", ">= 3.0", "< 5"
24
24
  spec.add_dependency "vmware-vra", "~> 3.0", ">= 3.2.0" # 3.0 required for vRA 8.x
25
25
  spec.add_dependency "highline"
26
- spec.add_dependency "rack", ">= 1.6", "< 4.0"
27
26
  spec.add_dependency "ffi-yajl", ">= 2.2.3", "< 3.1.0"
28
27
  end
@@ -25,6 +25,7 @@ require "base64" unless defined?(Base64)
25
25
  require "digest" unless defined?(Digest)
26
26
  require "fileutils" unless defined?(FileUtils)
27
27
  require "vra"
28
+ require "time" unless defined?(Time.now.iso8601)
28
29
  require_relative "vra_version"
29
30
 
30
31
  module Kitchen
@@ -46,6 +47,11 @@ module Kitchen
46
47
  kitchen_driver_api_version 2
47
48
  plugin_version Kitchen::Driver::VRA_VERSION
48
49
 
50
+ # Deployment statuses vRA reports for a deployment that is up.
51
+ #
52
+ # @return [Array<String>]
53
+ LIVE_STATUSES = %w{CREATE_SUCCESSFUL}.freeze
54
+
49
55
  # Location of the credential cache, relative to the working directory.
50
56
  CREDENTIALS_CACHE_FILE = ".kitchen/cached_vra"
51
57
 
@@ -314,6 +320,41 @@ module Kitchen
314
320
  end
315
321
  end
316
322
 
323
+ # Reports what vRA currently thinks of the deployment.
324
+ #
325
+ # @param state [Hash] instance state naming the deployment
326
+ # @return [Hash] a Test Kitchen status hash, or the base implementation's
327
+ # answer when there is no deployment or vRA does not know it
328
+ def status(state)
329
+ return super unless state[:deployment_id]
330
+
331
+ deployment = lookup_deployment(state[:deployment_id])
332
+ return super unless deployment
333
+
334
+ deployment_status = deployment.status.to_s
335
+ {
336
+ live: LIVE_STATUSES.include?(deployment_status),
337
+ state: deployment_status,
338
+ source: "driver",
339
+ resource_id: state[:deployment_id],
340
+ message: "vRA reports the deployment as #{deployment_status}",
341
+ checked_at: Time.now.utc.iso8601,
342
+ }
343
+ end
344
+
345
+ # Looks a deployment up without turning an unreachable vRA into a
346
+ # failure. A deployment that has already been destroyed answers with
347
+ # NotFound, which is a real answer rather than an error.
348
+ #
349
+ # @param deployment_id [String] the vRA deployment ID
350
+ # @return [Vra::Deployment, nil] the deployment, or nil when vRA does not
351
+ # know it or cannot be reached
352
+ def lookup_deployment(deployment_id)
353
+ vra_client.deployments.by_id(deployment_id)
354
+ rescue ::StandardError
355
+ nil
356
+ end
357
+
317
358
  # Destroys the vRA deployment, if one exists.
318
359
  #
319
360
  # A deployment that vRA no longer knows about, or that offers no destroy
@@ -23,6 +23,6 @@ module Kitchen
23
23
  # Test Kitchen's driver plugins.
24
24
  module Driver
25
25
  # The version of the kitchen-vra gem.
26
- VRA_VERSION = "3.3.4"
26
+ VRA_VERSION = "3.4.0"
27
27
  end
28
28
  end
data/spec/vra_spec.rb CHANGED
@@ -330,6 +330,64 @@ describe Kitchen::Driver::Vra do
330
330
  end
331
331
  end
332
332
 
333
+ describe "#status" do
334
+ let(:deployments) { double("deployments") }
335
+ let(:vra_client) { double("vra_client", deployments: deployments) }
336
+
337
+ before { allow(driver).to receive(:vra_client).and_return(vra_client) }
338
+
339
+ it "reports an unknown status when state names no deployment" do
340
+ expect(driver.status({})).to include(live: nil, state: "unknown")
341
+ end
342
+
343
+ it "reports an unknown status when vRA has never heard of the deployment" do
344
+ allow(deployments).to receive(:by_id).with("gone")
345
+ .and_raise(Vra::Exception::NotFound.new("nope"))
346
+
347
+ expect(driver.status(deployment_id: "gone")).to include(state: "unknown")
348
+ end
349
+
350
+ it "reports a successfully created deployment as live" do
351
+ allow(deployments).to receive(:by_id).with("dep-1")
352
+ .and_return(double(status: "CREATE_SUCCESSFUL"))
353
+
354
+ expect(driver.status(deployment_id: "dep-1")).to include(
355
+ live: true, state: "CREATE_SUCCESSFUL", source: "driver",
356
+ resource_id: "dep-1"
357
+ )
358
+ end
359
+
360
+ it "stamps when the check happened" do
361
+ allow(deployments).to receive(:by_id)
362
+ .and_return(double(status: "CREATE_SUCCESSFUL"))
363
+
364
+ expect(driver.status(deployment_id: "dep-1")[:checked_at])
365
+ .to match(/\A\d{4}-\d{2}-\d{2}T/)
366
+ end
367
+
368
+ it "reports a deployment still building as not live" do
369
+ allow(deployments).to receive(:by_id)
370
+ .and_return(double(status: "CREATE_INPROGRESS"))
371
+
372
+ expect(driver.status(deployment_id: "dep-1"))
373
+ .to include(live: false, state: "CREATE_INPROGRESS")
374
+ end
375
+
376
+ it "names a failed deployment rather than reporting a bare false" do
377
+ allow(deployments).to receive(:by_id)
378
+ .and_return(double(status: "CREATE_FAILED"))
379
+
380
+ expect(driver.status(deployment_id: "dep-1"))
381
+ .to include(live: false, state: "CREATE_FAILED")
382
+ end
383
+
384
+ it "reports an unknown status when vRA cannot be reached" do
385
+ allow(deployments).to receive(:by_id).and_raise(StandardError.new("boom"))
386
+
387
+ expect(driver.status(deployment_id: "dep-1")).to include(state: "unknown")
388
+ end
389
+ end
390
+
333
391
  describe "#destroy" do
334
392
  let(:deployment_id) { "8c1a833a-5844-4100-b58c-9cab3543c958" }
335
393
  let(:state) { { deployment_id: deployment_id } }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-vra
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.4
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Community Tools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-23 00:00:00.000000000 Z
11
+ date: 2026-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '3.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: '3.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: vmware-vra
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -58,26 +64,6 @@ dependencies:
58
64
  - - ">="
59
65
  - !ruby/object:Gem::Version
60
66
  version: '0'
61
- - !ruby/object:Gem::Dependency
62
- name: rack
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '1.6'
68
- - - "<"
69
- - !ruby/object:Gem::Version
70
- version: '4.0'
71
- type: :runtime
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: '1.6'
78
- - - "<"
79
- - !ruby/object:Gem::Version
80
- version: '4.0'
81
67
  - !ruby/object:Gem::Dependency
82
68
  name: ffi-yajl
83
69
  requirement: !ruby/object:Gem::Requirement