aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2019-04-04 15:38:30 -0700
committerKiran Kamineni <kiran.k.kamineni@intel.com>2019-04-04 15:38:33 -0700
commit9e001472ab04fb0b5b85e38266bacd9a377cc343 (patch)
treeab7bdbff68826a18c5d74947944578825c88099e /src/k8splugin/api
parent99928f9cef81b627c2b22fcf6d7c0ca7ebe2cb0e (diff)
Use consistent naming for Name and Version
Definition Name and Definition Version are now using the consistent naming similar to the Profile and instance structure. Name becomes RBName Version becomes RBVersion Issue-ID: MULTICLOUD-350 Change-Id: Ifc329d4979a06cb017c6f9d916c227c696b664e0 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/api')
-rw-r--r--src/k8splugin/api/defhandler.go4
-rw-r--r--src/k8splugin/api/defhandler_test.go36
2 files changed, 20 insertions, 20 deletions
diff --git a/src/k8splugin/api/defhandler.go b/src/k8splugin/api/defhandler.go
index 93bbba15..1aa00413 100644
--- a/src/k8splugin/api/defhandler.go
+++ b/src/k8splugin/api/defhandler.go
@@ -49,13 +49,13 @@ func (h rbDefinitionHandler) createHandler(w http.ResponseWriter, r *http.Reques
}
// Name is required.
- if v.Name == "" {
+ if v.RBName == "" {
http.Error(w, "Missing name in POST request", http.StatusBadRequest)
return
}
// Version is required.
- if v.Version == "" {
+ if v.RBVersion == "" {
http.Error(w, "Missing version in POST request", http.StatusBadRequest)
return
}
diff --git a/src/k8splugin/api/defhandler_test.go b/src/k8splugin/api/defhandler_test.go
index 28bf1479..03189e1d 100644
--- a/src/k8splugin/api/defhandler_test.go
+++ b/src/k8splugin/api/defhandler_test.go
@@ -96,8 +96,8 @@ func TestRBDefCreateHandler(t *testing.T) {
"description":"test description"
}`)),
expected: rb.Definition{
- Name: "testresourcebundle",
- Version: "v1",
+ RBName: "testresourcebundle",
+ RBVersion: "v1",
ChartName: "testchart",
Description: "test description",
},
@@ -105,8 +105,8 @@ func TestRBDefCreateHandler(t *testing.T) {
//Items that will be returned by the mocked Client
Items: []rb.Definition{
{
- Name: "testresourcebundle",
- Version: "v1",
+ RBName: "testresourcebundle",
+ RBVersion: "v1",
ChartName: "testchart",
Description: "test description",
},
@@ -172,14 +172,14 @@ func TestRBDefListVersionsHandler(t *testing.T) {
expectedCode: http.StatusOK,
expected: []rb.Definition{
{
- Name: "testresourcebundle",
- Version: "v1",
+ RBName: "testresourcebundle",
+ RBVersion: "v1",
ChartName: "testchart",
Description: "test description",
},
{
- Name: "testresourcebundle",
- Version: "v2",
+ RBName: "testresourcebundle",
+ RBVersion: "v2",
ChartName: "testchart",
Description: "test description",
},
@@ -188,14 +188,14 @@ func TestRBDefListVersionsHandler(t *testing.T) {
// list of definitions that will be returned by the mockclient
Items: []rb.Definition{
{
- Name: "testresourcebundle",
- Version: "v1",
+ RBName: "testresourcebundle",
+ RBVersion: "v1",
ChartName: "testchart",
Description: "test description",
},
{
- Name: "testresourcebundle",
- Version: "v2",
+ RBName: "testresourcebundle",
+ RBVersion: "v2",
ChartName: "testchart",
Description: "test description",
},
@@ -222,12 +222,12 @@ func TestRBDefListVersionsHandler(t *testing.T) {
// Since the order of returned slice is not guaranteed
// Check both and return error if both don't match
sort.Slice(got, func(i, j int) bool {
- return got[i].Version < got[j].Version
+ return got[i].RBVersion < got[j].RBVersion
})
// Sort both as it is not expected that testCase.expected
// is sorted
sort.Slice(testCase.expected, func(i, j int) bool {
- return testCase.expected[i].Version < testCase.expected[j].Version
+ return testCase.expected[i].RBVersion < testCase.expected[j].RBVersion
})
if reflect.DeepEqual(testCase.expected, got) == false {
@@ -252,8 +252,8 @@ func TestRBDefGetHandler(t *testing.T) {
label: "Get Bundle Definition",
expectedCode: http.StatusOK,
expected: rb.Definition{
- Name: "testresourcebundle",
- Version: "v1",
+ RBName: "testresourcebundle",
+ RBVersion: "v1",
ChartName: "testchart",
Description: "test description",
},
@@ -263,8 +263,8 @@ func TestRBDefGetHandler(t *testing.T) {
// list of definitions that will be returned by the mockclient
Items: []rb.Definition{
{
- Name: "testresourcebundle",
- Version: "v1",
+ RBName: "testresourcebundle",
+ RBVersion: "v1",
ChartName: "testchart",
Description: "test description",
},