diff options
author | Eric Multanen <eric.w.multanen@intel.com> | 2020-04-16 10:44:06 -0700 |
---|---|---|
committer | Eric Multanen <eric.w.multanen@intel.com> | 2020-04-22 23:30:24 -0700 |
commit | 0b59486c82a9786c85438f6352636b19b83e1021 (patch) | |
tree | 06af2aa3929357f9cc4e328cd09c7fce554cbf43 /src/orchestrator/pkg/module/controller_test.go | |
parent | 9e086eb494441de0967b84d0f04d3b4dc7e753c2 (diff) |
Controller API support
Add controller API support as baseline for adding
gRPC framework.
Issue-ID: MULTICLOUD-1019
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
Change-Id: Ifd522a0eefbb8e54be45cc62003d3809283c9bfe
Diffstat (limited to 'src/orchestrator/pkg/module/controller_test.go')
-rw-r--r-- | src/orchestrator/pkg/module/controller_test.go | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/orchestrator/pkg/module/controller_test.go b/src/orchestrator/pkg/module/controller_test.go index 2e783c13..a13f43a5 100644 --- a/src/orchestrator/pkg/module/controller_test.go +++ b/src/orchestrator/pkg/module/controller_test.go @@ -37,14 +37,22 @@ func TestCreateController(t *testing.T) { { label: "Create Controller", inp: Controller{ - Name: "testController", - Host: "132.156.0.10", - Port: 8080, + Metadata: Metadata{ + Name: "testController", + }, + Spec: ControllerSpec{ + Host: "132.156.0.10", + Port: 8080, + }, }, expected: Controller{ - Name: "testController", - Host: "132.156.0.10", - Port: 8080, + Metadata: Metadata{ + Name: "testController", + }, + Spec: ControllerSpec{ + Host: "132.156.0.10", + Port: 8080, + }, }, expectedError: "", mockdb: &db.MockDB{}, @@ -62,7 +70,7 @@ func TestCreateController(t *testing.T) { t.Run(testCase.label, func(t *testing.T) { db.DBconn = testCase.mockdb impl := NewControllerClient() - got, err := impl.CreateController(testCase.inp) + got, err := impl.CreateController(testCase.inp, false) if err != nil { if testCase.expectedError == "" { t.Fatalf("Create returned an unexpected error %s", err) @@ -94,18 +102,25 @@ func TestGetController(t *testing.T) { label: "Get Controller", name: "testController", expected: Controller{ - Name: "testController", - Host: "132.156.0.10", - Port: 8080, + Metadata: Metadata{ + Name: "testController", + }, + Spec: ControllerSpec{ + Host: "132.156.0.10", + Port: 8080, + }, }, expectedError: "", mockdb: &db.MockDB{ Items: map[string]map[string][]byte{ ControllerKey{ControllerName: "testController"}.String(): { "controllermetadata": []byte( - "{\"name\":\"testController\"," + + "{\"metadata\":{" + + "\"name\":\"testController\"" + + "}," + + "\"spec\":{" + "\"host\":\"132.156.0.10\"," + - "\"port\":8080}"), + "\"port\": 8080 }}"), }, }, }, |