kitchen-vra 3.3.3 → 3.3.4

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.
@@ -18,8 +18,11 @@
18
18
  # limitations under the License.
19
19
  #
20
20
 
21
+ # Test Kitchen's top-level namespace.
21
22
  module Kitchen
23
+ # Test Kitchen's driver plugins.
22
24
  module Driver
23
- VRA_VERSION = "3.3.3"
25
+ # The version of the kitchen-vra gem.
26
+ VRA_VERSION = "3.3.4"
24
27
  end
25
28
  end
data/renovate.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
  "extends": [
4
- "config:recommended"
4
+ "config:recommended",
5
+ ":disableDependencyDashboard",
6
+ "schedule:automergeEarlyMondays"
5
7
  ]
6
8
  }
data/spec/vra_spec.rb CHANGED
@@ -19,6 +19,8 @@
19
19
  #
20
20
 
21
21
  require "spec_helper"
22
+ require "tmpdir"
23
+ require "fileutils"
22
24
  require "kitchen/driver/vra"
23
25
  require "kitchen/provisioner/dummy"
24
26
  require "kitchen/transport/dummy"
@@ -447,7 +449,7 @@ describe Kitchen::Driver::Vra do
447
449
  }
448
450
  end
449
451
 
450
- it "sets extra parmeters" do
452
+ it "sets extra parameters" do
451
453
  expect(catalog_request).to receive(:set_parameters).with("key1", { type: "string", value: "value1" })
452
454
  expect(catalog_request).to receive(:set_parameters).with("key2", { type: "integer", value: 123 })
453
455
  driver.catalog_request
@@ -510,4 +512,99 @@ describe Kitchen::Driver::Vra do
510
512
  end
511
513
  end
512
514
  end
515
+
516
+ describe "credential caching" do
517
+ let(:cache_dir) { Dir.mktmpdir("kitchen-vra-spec") }
518
+ let(:cache_file) { File.join(cache_dir, ".kitchen", "cached_vra") }
519
+
520
+ # c_save/c_load address the cache by a path relative to the working
521
+ # directory, so each example runs inside a throwaway directory.
522
+ around do |example|
523
+ Dir.chdir(cache_dir) { example.run }
524
+ end
525
+
526
+ after { FileUtils.remove_entry(cache_dir) }
527
+
528
+ describe "#c_save" do
529
+ it "creates the cache file" do
530
+ driver.c_save
531
+ expect(File.exist?(cache_file)).to be true
532
+ end
533
+
534
+ it "creates the .kitchen directory when it does not exist" do
535
+ expect { driver.c_save }.to change { Dir.exist?(File.join(cache_dir, ".kitchen")) }.from(false).to(true)
536
+ end
537
+
538
+ it "writes the file readable only by its owner" do
539
+ driver.c_save
540
+ expect(File.stat(cache_file).mode & 0o777).to eq(0o600)
541
+ end
542
+
543
+ it "does not write the password in the clear" do
544
+ driver.c_save
545
+ expect(File.read(cache_file)).not_to include("mypassword")
546
+ end
547
+ end
548
+
549
+ describe "#c_load" do
550
+ it "restores credentials written by #c_save" do
551
+ driver.c_save
552
+
553
+ reader = Kitchen::Driver::Vra.new(config.reject { |k, _v| %i{username password}.include?(k) })
554
+ allow(reader).to receive(:instance).and_return(instance)
555
+ reader.c_load
556
+
557
+ expect(reader[:username]).to eq("myuser")
558
+ expect(reader[:password]).to eq("mypassword")
559
+ end
560
+
561
+ it "does nothing when no cache file exists" do
562
+ driver.c_load
563
+ expect(driver[:username]).to eq("myuser")
564
+ end
565
+
566
+ it "refuses a cache written against a different base_url" do
567
+ driver.c_save
568
+
569
+ other = Kitchen::Driver::Vra.new(config.merge(base_url: "https://other.corp.local")
570
+ .reject { |k, _v| %i{username password}.include?(k) })
571
+ allow(other).to receive(:instance).and_return(instance)
572
+ expect(other).to receive(:warn).with(/Failed to load cached credentials/)
573
+ other.c_load
574
+
575
+ expect(other[:username]).to be_nil
576
+ expect(other[:password]).to be_nil
577
+ end
578
+
579
+ it "refuses a corrupted cache rather than returning garbage" do
580
+ driver.c_save
581
+ File.write(cache_file, File.read(cache_file).succ)
582
+
583
+ loader = Kitchen::Driver::Vra.new(config.reject { |k, _v| %i{username password}.include?(k) })
584
+ allow(loader).to receive(:instance).and_return(instance)
585
+ expect(loader).to receive(:warn).with(/Failed to load cached credentials/)
586
+ loader.c_load
587
+
588
+ expect(loader[:username]).to be_nil
589
+ end
590
+ end
591
+
592
+ describe "#check_config" do
593
+ it "uses the cache instead of prompting" do
594
+ driver.c_save
595
+
596
+ reader = Kitchen::Driver::Vra.new(config.reject { |k, _v| %i{username password}.include?(k) })
597
+ allow(reader).to receive(:instance).and_return(instance)
598
+ allow(ENV).to receive(:[]).and_call_original
599
+ allow(ENV).to receive(:[]).with("VRA_USER_NAME").and_return(nil)
600
+ allow(ENV).to receive(:[]).with("VRA_USER_PASSWORD").and_return(nil)
601
+ expect(reader).not_to receive(:ask)
602
+
603
+ reader.check_config
604
+
605
+ expect(reader[:username]).to eq("myuser")
606
+ expect(reader[:password]).to eq("mypassword")
607
+ end
608
+ end
609
+ end
513
610
  end
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.3
4
+ version: 3.3.4
5
5
  platform: ruby
6
6
  authors:
7
- - Chef Commmunity Tools Team
7
+ - Chef Community Tools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2026-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -106,14 +106,16 @@ extensions: []
106
106
  extra_rdoc_files: []
107
107
  files:
108
108
  - ".github/CODEOWNERS"
109
- - ".github/dependabot.yml"
110
109
  - ".github/workflows/linters.yml"
111
110
  - ".github/workflows/publish.yml"
112
111
  - ".gitignore"
113
112
  - ".markdownlint.yaml"
114
113
  - ".release-please-manifest.json"
115
114
  - ".rubocop.yml"
115
+ - ".yamllint"
116
+ - ".yardopts"
116
117
  - CHANGELOG.md
118
+ - CONTRIBUTING.md
117
119
  - Gemfile
118
120
  - LICENSE.txt
119
121
  - README.md
@@ -144,10 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
146
  - !ruby/object:Gem::Version
145
147
  version: '0'
146
148
  requirements: []
147
- rubygems_version: 3.4.10
149
+ rubygems_version: 3.5.9
148
150
  signing_key:
149
151
  specification_version: 4
150
152
  summary: A Test Kitchen driver for VMware vRealize Automation (vRA)
151
- test_files:
152
- - spec/spec_helper.rb
153
- - spec/vra_spec.rb
153
+ test_files: []
@@ -1,8 +0,0 @@
1
- ---
2
- version: 2
3
- updates:
4
- - package-ecosystem: bundler
5
- directory: "/"
6
- schedule:
7
- interval: daily
8
- open-pull-requests-limit: 10