vmware-vra 3.1.2 → 3.2.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 +4 -4
- data/.github/workflows/linters.yml +9 -0
- data/.markdownlint.yaml +5 -0
- data/.mdlrc +1 -0
- data/CHANGELOG.md +15 -0
- data/README.md +40 -29
- data/Rakefile +2 -2
- data/lib/vra/catalog.rb +6 -7
- data/lib/vra/catalog_base.rb +4 -4
- data/lib/vra/catalog_item.rb +12 -12
- data/lib/vra/catalog_source.rb +13 -13
- data/lib/vra/catalog_type.rb +6 -6
- data/lib/vra/client.rb +26 -15
- data/lib/vra/deployment.rb +25 -21
- data/lib/vra/deployment_request.rb +8 -9
- data/lib/vra/deployments.rb +1 -1
- data/lib/vra/http.rb +6 -6
- data/lib/vra/request.rb +10 -6
- data/lib/vra/request_parameters.rb +9 -9
- data/lib/vra/resource.rb +16 -16
- data/lib/vra/version.rb +1 -1
- data/lib/vra.rb +14 -14
- data/spec/catalog_item_spec.rb +50 -50
- data/spec/catalog_source_spec.rb +53 -53
- data/spec/catalog_spec.rb +45 -45
- data/spec/catalog_type_spec.rb +32 -32
- data/spec/client_spec.rb +202 -202
- data/spec/deployment_request_spec.rb +74 -74
- data/spec/deployment_spec.rb +70 -70
- data/spec/deployments_spec.rb +19 -19
- data/spec/http_spec.rb +59 -59
- data/spec/request_spec.rb +34 -34
- data/spec/resource_spec.rb +55 -55
- data/spec/spec_helper.rb +4 -4
- metadata +9 -9
- data/.github/ISSUE_TEMPLATE.md +0 -23
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- data/.github/workflows/unit.yml +0 -23
data/spec/catalog_type_spec.rb
CHANGED
@@ -16,23 +16,23 @@
|
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
|
-
require
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Vra::CatalogType do
|
22
22
|
let(:client) do
|
23
23
|
Vra::Client.new(
|
24
|
-
username:
|
25
|
-
password:
|
26
|
-
|
27
|
-
base_url:
|
24
|
+
username: "user@corp.local",
|
25
|
+
password: "password",
|
26
|
+
domain: "domain",
|
27
|
+
base_url: "https://vra.corp.local"
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
31
31
|
let(:sample_data) do
|
32
|
-
JSON.parse(File.read(
|
32
|
+
JSON.parse(File.read("spec/fixtures/resource/sample_catalog_type.json"))
|
33
33
|
end
|
34
34
|
|
35
|
-
describe
|
35
|
+
describe "#initialize" do
|
36
36
|
let(:cat_type) do
|
37
37
|
described_class.allocate
|
38
38
|
end
|
@@ -41,74 +41,74 @@ describe Vra::CatalogType do
|
|
41
41
|
allow(client).to receive(:get_parsed).and_return(sample_data)
|
42
42
|
end
|
43
43
|
|
44
|
-
it
|
44
|
+
it "should validate and fetch data" do
|
45
45
|
expect(cat_type).to receive(:validate!)
|
46
46
|
expect(cat_type).to receive(:fetch_data)
|
47
47
|
|
48
|
-
cat_type.send(:initialize, client, id:
|
48
|
+
cat_type.send(:initialize, client, id: "com.vmw.vro.workflow")
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
52
|
-
cat_type.send(:initialize, client, id:
|
51
|
+
it "should fetch data when id is passed" do
|
52
|
+
cat_type.send(:initialize, client, id: "com.vmw.vro.workflow")
|
53
53
|
|
54
54
|
expect(cat_type.send(:data)).not_to be_nil
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
57
|
+
it "should set id when data is passed" do
|
58
58
|
cat_type.send(:initialize, client, data: sample_data)
|
59
59
|
|
60
|
-
expect(cat_type.id).to eq(
|
60
|
+
expect(cat_type.id).to eq("com.vmw.vro.workflow")
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe
|
64
|
+
describe "#validate" do
|
65
65
|
let(:cat_type) do
|
66
66
|
described_class.allocate
|
67
67
|
end
|
68
68
|
|
69
|
-
it
|
69
|
+
it "should raise exception when neither id nor data passed" do
|
70
70
|
expect { cat_type.send(:initialize, client) }.to raise_error(ArgumentError)
|
71
71
|
end
|
72
72
|
|
73
|
-
it
|
74
|
-
params = [client, { id:
|
73
|
+
it "should raise exception when both id and data is passed" do
|
74
|
+
params = [client, { id: "com.vmw.vra.workflow", data: sample_data }]
|
75
75
|
expect { cat_type.send(:initialize, *params) }.to raise_error(ArgumentError)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe
|
79
|
+
describe "#fetch_data" do
|
80
80
|
let(:cat_type) do
|
81
81
|
described_class.allocate
|
82
82
|
end
|
83
83
|
|
84
|
-
it
|
84
|
+
it "should fetch the data correctly" do
|
85
85
|
allow(client).to receive(:get_parsed).and_return(sample_data)
|
86
|
-
cat_type.send(:initialize, client, id:
|
86
|
+
cat_type.send(:initialize, client, id: "com.vmw.vro.workflow")
|
87
87
|
|
88
88
|
data = cat_type.send(:data)
|
89
89
|
expect(data).not_to be_nil
|
90
|
-
expect(cat_type.id).to eq(data[
|
91
|
-
expect(data[
|
90
|
+
expect(cat_type.id).to eq(data["id"])
|
91
|
+
expect(data["name"]).to eq("vRealize Orchestrator Workflow")
|
92
92
|
end
|
93
93
|
|
94
|
-
it
|
94
|
+
it "should raise when catalog with type not found" do
|
95
95
|
allow(client).to receive(:get_parsed).and_raise(Vra::Exception::HTTPNotFound)
|
96
96
|
|
97
|
-
expect { cat_type.send(:initialize, client, id: sample_data[
|
97
|
+
expect { cat_type.send(:initialize, client, id: sample_data["id"]) }
|
98
98
|
.to raise_error(Vra::Exception::NotFound)
|
99
|
-
.with_message("catalog type ID #{sample_data[
|
99
|
+
.with_message("catalog type ID #{sample_data["id"]} does not exist")
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
describe
|
104
|
-
it
|
103
|
+
describe "attributes" do
|
104
|
+
it "should have the correct attributes" do
|
105
105
|
allow(client).to receive(:get_parsed).and_return(sample_data)
|
106
106
|
|
107
|
-
cat_type = described_class.new(client, id: sample_data[
|
108
|
-
expect(cat_type.name).to eq(
|
109
|
-
expect(cat_type.base_url).to eq(
|
110
|
-
expect(cat_type.config_schema).to eq(sample_data[
|
111
|
-
expect(cat_type.icon_id).to eq(
|
107
|
+
cat_type = described_class.new(client, id: sample_data["id"])
|
108
|
+
expect(cat_type.name).to eq("vRealize Orchestrator Workflow")
|
109
|
+
expect(cat_type.base_url).to eq("https://vra.corp.local:8080/vro")
|
110
|
+
expect(cat_type.config_schema).to eq(sample_data["configSchema"])
|
111
|
+
expect(cat_type.icon_id).to eq("0616ff81-c13b-32fe-b3b9-de3c2edd85dd")
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|