knife-google 3.3.3 → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 912225d3b18ae28eb1e4c1cdddff75077cf863917f4888fb85c8aeb261c71e47
4
- data.tar.gz: 9827cb9f230891db43016ffe0fc1bd47b13158b0fda2f8db670643599335d40d
3
+ metadata.gz: 79bb948dc01979a7abe337108a6d908c6a5fd0aef3aad35f687a3570d0e0f2aa
4
+ data.tar.gz: 4e3d943d4ec4f4b9440d1cf2e59af79f72acb4010f49a7f6d590147cedd18b5f
5
5
  SHA512:
6
- metadata.gz: a76733350635961937f0a3f44fba7877039eb3e66f51906ae5e587d6c101b262e443f13574429787f2cf5fe9de578c404b4be442691996462a419571ee5d5988
7
- data.tar.gz: 21348ae47376ebbe56eb25917404079e3d7fad6160a46ef50c8986064beeb87102b9efac67fb10b61de43340bb2f1ed5e3f3e2429dde6a7954781e552b203c38
6
+ metadata.gz: 76e15187ff2749b8b9d91451368f95e7d38b6d4c671500c045402b1098ba2a24f1fc3e21bf06f56f9305bdf75f268dd7a516972fc9d88ab2447a3a1a3458dbca
7
+ data.tar.gz: ee18351ce616bc95a530d93dc3d84365f93736060c41565aec279b065645ad28b1aa2df5e7089396917de6a2e0843a26bcdd62180628d813b9311ea29580ac0f
@@ -4,24 +4,32 @@ Note: this log contains only changes from knife-google release 1.1.0 and later
4
4
  -- it does not contain the changes from prior releases. To view change history
5
5
  prior to release 1.1.0, please visit the [source repository](https://github.com/chef/knife-google/commits).
6
6
 
7
- <!-- latest_release 3.3.3 -->
8
- ## [v3.3.3](https://github.com/chef/knife-google/tree/v3.3.3) (2018-10-17)
7
+ <!-- latest_release 3.3.6 -->
8
+ ## [v3.3.6](https://github.com/chef/knife-google/tree/v3.3.6) (2018-11-20)
9
9
 
10
10
  #### Merged Pull Requests
11
- - Allow for newer google-api-client releases [#137](https://github.com/chef/knife-google/pull/137) ([tas50](https://github.com/tas50))
11
+ - MSYS-917 Allows knife google zone list, region list, region quotas, project quotas to run without giving --gce_zone option [#142](https://github.com/chef/knife-google/pull/142) ([Vasu1105](https://github.com/Vasu1105))
12
12
  <!-- latest_release -->
13
13
 
14
- <!-- release_rollup since=3.3.0 -->
15
- ### Changes since 3.3.0 release
14
+ <!-- release_rollup since=3.3.3 -->
15
+ ### Changes not yet released to rubygems.org
16
16
 
17
17
  #### Merged Pull Requests
18
- - Allow for newer google-api-client releases [#137](https://github.com/chef/knife-google/pull/137) ([tas50](https://github.com/tas50)) <!-- 3.3.3 -->
19
- - Empty commit to test expeditor [#136](https://github.com/chef/knife-google/pull/136) ([btm](https://github.com/btm)) <!-- 3.3.2 -->
18
+ - MSYS-917 Allows knife google zone list, region list, region quotas, project quotas to run without giving --gce_zone option [#142](https://github.com/chef/knife-google/pull/142) ([Vasu1105](https://github.com/Vasu1105)) <!-- 3.3.6 -->
19
+ - Documenting the knife-google manual testing prerequisite [#141](https://github.com/chef/knife-google/pull/141) ([Vasu1105](https://github.com/Vasu1105)) <!-- 3.3.5 -->
20
+ - Remove github_changelog_generator development dependency [#138](https://github.com/chef/knife-google/pull/138) ([tas50](https://github.com/tas50)) <!-- 3.3.4 -->
20
21
  <!-- release_rollup -->
21
22
 
22
23
  <!-- latest_stable_release -->
24
+ ## [v3.3.3](https://github.com/chef/knife-google/tree/v3.3.3) (2018-10-17)
25
+
26
+ #### Merged Pull Requests
27
+ - Empty commit to test expeditor [#136](https://github.com/chef/knife-google/pull/136) ([btm](https://github.com/btm))
28
+ - Allow for newer google-api-client releases [#137](https://github.com/chef/knife-google/pull/137) ([tas50](https://github.com/tas50))
23
29
  <!-- latest_stable_release -->
24
30
 
31
+
32
+
25
33
  ## [3.3.0](https://github.com/chef/knife-google/tree/v3.3.0)
26
34
 
27
35
  [Full Changelog](https://github.com/chef/knife-google/compare/v3.2.0...v3.3.0)
@@ -0,0 +1,48 @@
1
+ ## Manual Testing Prerequisite:
2
+
3
+ To work with knife google commands following setup needs to be done.
4
+
5
+ Configure google authentication and authorization as suggested [here](https://github.com/chef/knife-google#authentication-and-authorization).
6
+
7
+ To work with knife google command you should create GCP project and assign zone and region to that project
8
+
9
+ **Ref:** https://cloud.google.com/resource-manager/docs/creating-managing-projects
10
+ https://cloud.google.com/compute/docs/regions-zones/changing-default-zone-region
11
+
12
+ Some useful Google cloud commands which you can use with Google Cloud command line interface [#REF](https://cloud.google.com/compute/docs/gcloud-compute/#set_default_zone_and_region_in_your_local_client)
13
+
14
+ ``` gcloud projects create PROJECT_ID ```
15
+
16
+ ``` gcloud config configurations activate CONFIGURATION_NAME ```
17
+
18
+ ``` gcloud config set compute/zone ZONE ```
19
+
20
+ ``` gcloud config set compute/zone ZONE ```
21
+
22
+ Once the above setup is done get the PROJECT_ID and Zone and set it in your knife configuration file(knife.rb/config.rb).
23
+ ```
24
+ knife[:gce_project] = 'my-test-project'
25
+ knife[:gce_zone] = 'us-east1-b'
26
+ ```
27
+ **NOTE** Not providing `gce_project` and `gce_zone` in knife configuartion file will run into following errors while running any knife google command.
28
+
29
+ ```
30
+ ERROR: The following required parameters are missing: gce_project, gce_zone
31
+ ERROR: RuntimeError: The following required parameters are missing: gce_project, gce_zone
32
+ ```
33
+
34
+ ## Valid knife google commands
35
+
36
+ ```
37
+ knife google disk create NAME --gce-disk-size N (options)
38
+ knife google disk delete NAME [NAME] (options)
39
+ knife google disk list
40
+ knife google project quotas
41
+ knife google region list
42
+ knife google region quotas
43
+ knife google server create NAME -m MACHINE_TYPE -I IMAGE (options)
44
+ knife google server delete INSTANCE_NAME [INSTANCE_NAME] (options)
45
+ knife google server list
46
+ knife google server show INSTANCE_NAME (options)
47
+ knife google zone list
48
+ ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.3.3
1
+ 3.3.6
@@ -21,7 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency "google-api-client", ">= 0.19.8", "< 0.25" # each version introduces breaking changes which we need to validate
22
22
  s.add_dependency "gcewinpass", "~> 1.1"
23
23
 
24
- s.add_development_dependency "github_changelog_generator"
25
-
26
24
  s.files = `git ls-files -z`.split("\x0")
27
25
  end
@@ -51,7 +51,7 @@ class Chef::Knife::Cloud
51
51
  "useraccounts-ro" => "cloud.useraccounts.readonly",
52
52
  "useraccounts-rw" => "cloud.useraccounts",
53
53
  "userinfo-email" => "userinfo.email",
54
- }
54
+ }.freeze
55
55
 
56
56
  IMAGE_ALIAS_MAP = {
57
57
  "centos-6" => { project: "centos-cloud", prefix: "centos-6" },
@@ -76,7 +76,7 @@ class Chef::Knife::Cloud
76
76
  "ubuntu-1604-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1604-xenial" },
77
77
  "windows-2008-r2" => { project: "windows-cloud", prefix: "windows-server-2008-r2" },
78
78
  "windows-2012-r2" => { project: "windows-cloud", prefix: "windows-server-2012-r2" },
79
- }
79
+ }.freeze
80
80
 
81
81
  def initialize(options = {})
82
82
  @project = options[:project]
@@ -19,7 +19,7 @@
19
19
 
20
20
  class Chef::Knife::Cloud
21
21
  module GoogleServiceHelpers
22
- REQUIRED_KEYS = [:gce_project, :gce_zone]
22
+ REQUIRED_KEYS = [:gce_project].freeze
23
23
 
24
24
  def create_service_instance
25
25
  Chef::Knife::Cloud::GoogleService.new(
@@ -47,7 +47,7 @@ class Chef::Knife::Cloud
47
47
  default: nil
48
48
 
49
49
  def validate_params!
50
- check_for_missing_config_values!(:disk_size, :disk_type)
50
+ check_for_missing_config_values!(:gce_zone, :disk_size, :disk_type)
51
51
  raise "Please specify a disk name." unless @name_args.first
52
52
  raise "Disk size must be between 10 and 10,000" unless valid_disk_size?(locate_config_value(:disk_size))
53
53
  super
@@ -31,7 +31,7 @@ class Chef::Knife::Cloud
31
31
  banner "knife google disk delete NAME [NAME] (options)"
32
32
 
33
33
  def validate_params!
34
- check_for_missing_config_values!
34
+ check_for_missing_config_values!(:gce_zone)
35
35
  raise "You must specify at least one disk to delete." if @name_args.empty?
36
36
  super
37
37
  end
@@ -31,7 +31,7 @@ class Chef::Knife::Cloud
31
31
  banner "knife google disk list"
32
32
 
33
33
  def validate_params!
34
- check_for_missing_config_values!
34
+ check_for_missing_config_values!(:gce_zone)
35
35
  super
36
36
  end
37
37
 
@@ -184,7 +184,7 @@ class Chef::Knife::Cloud
184
184
  end
185
185
 
186
186
  def validate_params!
187
- check_for_missing_config_values!(:machine_type, :image, :boot_disk_size, :network)
187
+ check_for_missing_config_values!(:gce_zone, :machine_type, :image, :boot_disk_size, :network)
188
188
  raise "You must supply an instance name." if @name_args.first.nil?
189
189
  raise "Boot disk size must be between 10 and 10,000" unless valid_disk_size?(boot_disk_size)
190
190
  if locate_config_value(:bootstrap_protocol) == "winrm" && locate_config_value(:gce_email).nil?
@@ -32,7 +32,7 @@ class Chef::Knife::Cloud
32
32
  banner "knife google server list"
33
33
 
34
34
  def validate_params!
35
- check_for_missing_config_values!
35
+ check_for_missing_config_values!(:gce_zone)
36
36
  super
37
37
  end
38
38
 
@@ -34,7 +34,7 @@ class Chef
34
34
  banner "knife google server show INSTANCE_NAME (options)"
35
35
 
36
36
  def validate_params!
37
- check_for_missing_config_values!
37
+ check_for_missing_config_values!(:gce_zone)
38
38
  raise "You must supply an instance name to display" if @name_args.empty?
39
39
  raise "You may only supply one instance name" if @name_args.size > 1
40
40
  super
@@ -15,7 +15,7 @@
15
15
  #
16
16
  module Knife
17
17
  module Google
18
- VERSION = "3.3.3"
18
+ VERSION = "3.3.6"
19
19
  MAJOR, MINOR, TINY = VERSION.split(".")
20
20
  end
21
21
  end
@@ -52,7 +52,6 @@ describe Chef::Knife::Cloud::GoogleServiceHelpers do
52
52
  describe "#check_for_missing_config_values" do
53
53
  it "does not raise an exception if all parameters are present" do
54
54
  expect(tester).to receive(:locate_config_value).with(:gce_project).and_return("project")
55
- expect(tester).to receive(:locate_config_value).with(:gce_zone).and_return("zone")
56
55
  expect(tester).to receive(:locate_config_value).with(:key1).and_return("value1")
57
56
  expect(tester).to receive(:locate_config_value).with(:key2).and_return("value2")
58
57
 
@@ -63,10 +62,9 @@ describe Chef::Knife::Cloud::GoogleServiceHelpers do
63
62
  ui = double("ui")
64
63
  expect(tester).to receive(:ui).and_return(ui)
65
64
  expect(tester).to receive(:locate_config_value).with(:gce_project).and_return("project")
66
- expect(tester).to receive(:locate_config_value).with(:gce_zone).and_return(nil)
67
65
  expect(tester).to receive(:locate_config_value).with(:key1).and_return("value1")
68
66
  expect(tester).to receive(:locate_config_value).with(:key2).and_return(nil)
69
- expect(ui).to receive(:error).with("The following required parameters are missing: gce_zone, key2")
67
+ expect(ui).to receive(:error).with("The following required parameters are missing: key2")
70
68
  expect { tester.check_for_missing_config_values!(:key1, :key2) }.to raise_error(RuntimeError)
71
69
  end
72
70
  end
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_disk_create"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleDiskCreate do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new(%w{disk1}) }
26
31
  let(:service) { double("service") }
27
32
 
@@ -38,7 +43,7 @@ describe Chef::Knife::Cloud::GoogleDiskCreate do
38
43
  end
39
44
 
40
45
  it "checks for missing config values" do
41
- expect(command).to receive(:check_for_missing_config_values!).with(:disk_size, :disk_type)
46
+ expect(command).to receive(:check_for_missing_config_values!).with(:gce_zone, :disk_size, :disk_type)
42
47
 
43
48
  command.validate_params!
44
49
  end
@@ -52,6 +57,14 @@ describe Chef::Knife::Cloud::GoogleDiskCreate do
52
57
  expect { command.validate_params! }.to raise_error(RuntimeError, "Disk size must be between 10 and 10,000")
53
58
  end
54
59
 
60
+ it "raises an exception if the gce_project is missing" do
61
+ ui = double("ui")
62
+ expect(tester).to receive(:ui).and_return(ui)
63
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
64
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
65
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
66
+ end
67
+
55
68
  context "when no disk name is provided" do
56
69
  let(:command) { described_class.new }
57
70
  it "raises an exception" do
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_disk_delete"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleDiskDelete do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new(%w{disk1 disk2}) }
26
31
  let(:service) { double("service") }
27
32
 
@@ -37,7 +42,7 @@ describe Chef::Knife::Cloud::GoogleDiskDelete do
37
42
  end
38
43
 
39
44
  it "checks for missing config values" do
40
- expect(command).to receive(:check_for_missing_config_values!)
45
+ expect(command).to receive(:check_for_missing_config_values!).with(:gce_zone)
41
46
 
42
47
  command.validate_params!
43
48
  end
@@ -46,6 +51,14 @@ describe Chef::Knife::Cloud::GoogleDiskDelete do
46
51
  expect { command.validate_params! }.not_to raise_error
47
52
  end
48
53
 
54
+ it "raises an exception if the gce_project is missing" do
55
+ ui = double("ui")
56
+ expect(tester).to receive(:ui).and_return(ui)
57
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
58
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
59
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
60
+ end
61
+
49
62
  context "when no disk name is provided" do
50
63
  let(:command) { described_class.new }
51
64
  it "raises an exception" do
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_disk_list"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleDiskList do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new }
26
31
  let(:service) { double("service") }
27
32
 
@@ -33,10 +38,18 @@ describe Chef::Knife::Cloud::GoogleDiskList do
33
38
 
34
39
  describe "#validate_params!" do
35
40
  it "checks for missing config values" do
36
- expect(command).to receive(:check_for_missing_config_values!)
41
+ expect(command).to receive(:check_for_missing_config_values!).with(:gce_zone)
37
42
 
38
43
  command.validate_params!
39
44
  end
45
+
46
+ it "raises an exception if the gce_project is missing" do
47
+ ui = double("ui")
48
+ expect(tester).to receive(:ui).and_return(ui)
49
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
50
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
51
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
52
+ end
40
53
  end
41
54
 
42
55
  describe "#query_resource" do
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_project_quotas"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleProjectQuotas do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new }
26
31
  let(:service) { double("service") }
27
32
 
@@ -37,6 +42,14 @@ describe Chef::Knife::Cloud::GoogleProjectQuotas do
37
42
 
38
43
  command.validate_params!
39
44
  end
45
+
46
+ it "raises an exception if the gce_project is missing" do
47
+ ui = double("ui")
48
+ expect(tester).to receive(:ui).and_return(ui)
49
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
50
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
51
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
52
+ end
40
53
  end
41
54
 
42
55
  describe "#query_resource" do
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_region_list"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleRegionList do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new }
26
31
  let(:service) { double("service") }
27
32
 
@@ -37,6 +42,14 @@ describe Chef::Knife::Cloud::GoogleRegionList do
37
42
 
38
43
  command.validate_params!
39
44
  end
45
+
46
+ it "raises an exception if the gce_project is missing" do
47
+ ui = double("ui")
48
+ expect(tester).to receive(:ui).and_return(ui)
49
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
50
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
51
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
52
+ end
40
53
  end
41
54
 
42
55
  describe "#query_resource" do
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_region_quotas"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleRegionQuotas do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new }
26
31
  let(:service) { double("service") }
27
32
 
@@ -37,6 +42,14 @@ describe Chef::Knife::Cloud::GoogleRegionQuotas do
37
42
 
38
43
  command.validate_params!
39
44
  end
45
+
46
+ it "raises an exception if the gce_project is missing" do
47
+ ui = double("ui")
48
+ expect(tester).to receive(:ui).and_return(ui)
49
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
50
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
51
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
52
+ end
40
53
  end
41
54
 
42
55
  describe "#execute_command" do
@@ -22,7 +22,12 @@ require "chef/knife/google_server_create"
22
22
  require "support/shared_examples_for_command"
23
23
  require "gcewinpass"
24
24
 
25
+ class Tester
26
+ include Chef::Knife::Cloud::GoogleServiceHelpers
27
+ end
28
+
25
29
  describe Chef::Knife::Cloud::GoogleServerCreate do
30
+ let(:tester) { Tester.new }
26
31
  let(:command) { described_class.new(["test_instance"]) }
27
32
  let(:service) { double("service") }
28
33
  let(:server) { double("server") }
@@ -57,7 +62,7 @@ describe Chef::Knife::Cloud::GoogleServerCreate do
57
62
  end
58
63
 
59
64
  it "checks for missing config values" do
60
- expect(command).to receive(:check_for_missing_config_values!).with(:machine_type, :image, :boot_disk_size, :network)
65
+ expect(command).to receive(:check_for_missing_config_values!).with(:gce_zone, :machine_type, :image, :boot_disk_size, :network)
61
66
 
62
67
  command.validate_params!
63
68
  end
@@ -67,6 +72,14 @@ describe Chef::Knife::Cloud::GoogleServerCreate do
67
72
  expect { command.validate_params! }.to raise_error(RuntimeError)
68
73
  end
69
74
 
75
+ it "raises an exception if the gce_project is missing" do
76
+ ui = double("ui")
77
+ expect(tester).to receive(:ui).and_return(ui)
78
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
79
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
80
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
81
+ end
82
+
70
83
  it "raises an exception if bootstrap is WinRM but no gcloud user email as supplied" do
71
84
  expect(command).to receive(:locate_config_value).with(:bootstrap_protocol).and_return("winrm")
72
85
  expect(command).to receive(:locate_config_value).with(:gce_email).and_return(nil)
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_server_delete"
22
22
  require "support/shared_examples_for_serverdeletecommand"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleServerDelete do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new(["test_instance"]) }
26
31
  let(:service) { double("service") }
27
32
 
@@ -36,5 +41,13 @@ describe Chef::Knife::Cloud::GoogleServerDelete do
36
41
  expect(command).to receive(:check_for_missing_config_values!)
37
42
  command.validate_params!
38
43
  end
44
+
45
+ it "raises an exception if the gce_project is missing" do
46
+ ui = double("ui")
47
+ expect(tester).to receive(:ui).and_return(ui)
48
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
49
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
50
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
51
+ end
39
52
  end
40
53
  end
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_server_list"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleServerList do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new }
26
31
  let(:service) { double("service") }
27
32
 
@@ -33,10 +38,18 @@ describe Chef::Knife::Cloud::GoogleServerList do
33
38
 
34
39
  describe "#validate_params!" do
35
40
  it "checks for missing config values" do
36
- expect(command).to receive(:check_for_missing_config_values!)
41
+ expect(command).to receive(:check_for_missing_config_values!).with(:gce_zone)
37
42
 
38
43
  command.validate_params!
39
44
  end
45
+
46
+ it "raises an exception if the gce_project is missing" do
47
+ ui = double("ui")
48
+ expect(tester).to receive(:ui).and_return(ui)
49
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
50
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
51
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
52
+ end
40
53
  end
41
54
 
42
55
  describe "#format_status_value" do
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_server_show"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleServerShow do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new(["test_instance"]) }
26
31
  let(:service) { double("service") }
27
32
 
@@ -37,11 +42,19 @@ describe Chef::Knife::Cloud::GoogleServerShow do
37
42
  end
38
43
 
39
44
  it "checks for missing config values" do
40
- expect(command).to receive(:check_for_missing_config_values!)
45
+ expect(command).to receive(:check_for_missing_config_values!).with(:gce_zone)
41
46
 
42
47
  command.validate_params!
43
48
  end
44
49
 
50
+ it "raises an exception if the gce_project is missing" do
51
+ ui = double("ui")
52
+ expect(tester).to receive(:ui).and_return(ui)
53
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
54
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
55
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
56
+ end
57
+
45
58
  context "when no server name is provided" do
46
59
  let(:command) { described_class.new }
47
60
 
@@ -21,7 +21,12 @@ require "spec_helper"
21
21
  require "chef/knife/google_zone_list"
22
22
  require "support/shared_examples_for_command"
23
23
 
24
+ class Tester
25
+ include Chef::Knife::Cloud::GoogleServiceHelpers
26
+ end
27
+
24
28
  describe Chef::Knife::Cloud::GoogleZoneList do
29
+ let(:tester) { Tester.new }
25
30
  let(:command) { described_class.new }
26
31
  let(:service) { double("service") }
27
32
 
@@ -37,6 +42,14 @@ describe Chef::Knife::Cloud::GoogleZoneList do
37
42
 
38
43
  command.validate_params!
39
44
  end
45
+
46
+ it "raises an exception if the gce_project is missing" do
47
+ ui = double("ui")
48
+ expect(tester).to receive(:ui).and_return(ui)
49
+ expect(tester).to receive(:locate_config_value).with(:gce_project).and_return(nil)
50
+ expect(ui).to receive(:error).with("The following required parameters are missing: gce_project")
51
+ expect { tester.check_for_missing_config_values! }.to raise_error(RuntimeError)
52
+ end
40
53
  end
41
54
 
42
55
  describe "#query_resource" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chiraq Jog
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2018-10-17 00:00:00.000000000 Z
16
+ date: 2018-11-20 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: knife-cloud
@@ -63,20 +63,6 @@ dependencies:
63
63
  - - "~>"
64
64
  - !ruby/object:Gem::Version
65
65
  version: '1.1'
66
- - !ruby/object:Gem::Dependency
67
- name: github_changelog_generator
68
- requirement: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: '0'
73
- type: :development
74
- prerelease: false
75
- version_requirements: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: '0'
80
66
  description: Google Compute Engine Support for Chef's Knife Command
81
67
  email:
82
68
  - paulrossman@google.com
@@ -101,6 +87,7 @@ files:
101
87
  - README.md
102
88
  - RELEASE_NOTES.md
103
89
  - Rakefile
90
+ - TESTING.md
104
91
  - VERSION
105
92
  - knife-google.gemspec
106
93
  - lib/chef/knife/cloud/google_service.rb