diff options
author | Rajamohan Raj <rajamohan.raj@intel.com> | 2020-09-25 03:16:40 +0000 |
---|---|---|
committer | Eric Multanen <eric.w.multanen@intel.com> | 2020-10-02 23:40:47 -0700 |
commit | d4b89af411ec7444b554a8b0ddeb7e239fa0fc73 (patch) | |
tree | 34938e3e8f5663e9354a05fddd03e62e9c2501b9 /src/orchestrator/pkg/module/generic_placement_intent_test.go | |
parent | 49f3d84b1dd20e7504018ee952d81885d5f21796 (diff) |
Modify GenericPlacement APIs to include DepIntGrp
Modify the genericPlacementIntent API such that deploymentIntentGroup
becomes a mandatory parameter.
Issue-ID: MULTICLOUD-1218
Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com>
Change-Id: I33d2eeac5b60228e9c08921c9347b1b6aa3f8d28
Diffstat (limited to 'src/orchestrator/pkg/module/generic_placement_intent_test.go')
-rw-r--r-- | src/orchestrator/pkg/module/generic_placement_intent_test.go | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/src/orchestrator/pkg/module/generic_placement_intent_test.go b/src/orchestrator/pkg/module/generic_placement_intent_test.go index d779e81f..59c1cac5 100644 --- a/src/orchestrator/pkg/module/generic_placement_intent_test.go +++ b/src/orchestrator/pkg/module/generic_placement_intent_test.go @@ -31,6 +31,7 @@ func TestCreateGenericPlacementIntent(t *testing.T) { inputProject string inputCompositeApp string inputCompositeAppVersion string + inputDepIntGrpName string expectedError string mockdb *db.MockDB expected GenericPlacementIntent @@ -44,13 +45,11 @@ func TestCreateGenericPlacementIntent(t *testing.T) { UserData1: "userData1", UserData2: "userData2", }, - Spec: GenIntentSpecData{ - LogicalCloud: "logicalCloud1", - }, }, inputProject: "testProject", inputCompositeApp: "testCompositeApp", inputCompositeAppVersion: "testCompositeAppVersion", + inputDepIntGrpName: "testDeploymentIntentGroup", expected: GenericPlacementIntent{ MetaData: GenIntentMetaData{ Name: "testGenericPlacement", @@ -58,9 +57,6 @@ func TestCreateGenericPlacementIntent(t *testing.T) { UserData1: "userData1", UserData2: "userData2", }, - Spec: GenIntentSpecData{ - LogicalCloud: "logicalCloud1", - }, }, expectedError: "", mockdb: &db.MockDB{ @@ -82,6 +78,40 @@ func TestCreateGenericPlacementIntent(t *testing.T) { "\"spec\":{" + "\"version\":\"version of the composite app\"}}"), }, + DeploymentIntentGroupKey{ + Name: "testDeploymentIntentGroup", + Project: "testProject", + CompositeApp: "testCompositeApp", + Version: "testCompositeAppVersion", + }.String(): { + "deploymentintentgroupmetadata": []byte( + "{\"metadata\":{\"name\":\"testDeploymentIntentGroup\"," + + "\"description\":\"DescriptionTestDeploymentIntentGroup\"," + + "\"userData1\": \"userData1\"," + + "\"userData2\": \"userData2\"}," + + "\"spec\":{\"profile\": \"Testprofile\"," + + "\"version\": \"version of deployment\"," + + "\"override-values\":[" + + "{" + + "\"app-name\": \"TestAppName\"," + + "\"values\": " + + "{" + + "\"imageRepository\":\"registry.hub.docker.com\"" + + "}" + + "}," + + "{" + + "\"app-name\": \"TestAppName\"," + + "\"values\": " + + "{" + + "\"imageRepository\":\"registry.hub.docker.com\"" + + "}" + + "}" + + "]," + + "\"logical-cloud\": \"cloud1\"" + + "}"+ + "}"), + }, + }, }, }, @@ -91,7 +121,7 @@ func TestCreateGenericPlacementIntent(t *testing.T) { t.Run(testCase.label, func(t *testing.T) { db.DBconn = testCase.mockdb intentCli := NewGenericPlacementIntentClient() - got, err := intentCli.CreateGenericPlacementIntent(testCase.inputIntent, testCase.inputProject, testCase.inputCompositeApp, testCase.inputCompositeAppVersion) + got, err := intentCli.CreateGenericPlacementIntent(testCase.inputIntent, testCase.inputProject, testCase.inputCompositeApp, testCase.inputCompositeAppVersion, testCase.inputDepIntGrpName) if err != nil { if testCase.expectedError == "" { t.Fatalf("CreateGenericPlacementIntent returned an unexpected error %s", err) @@ -120,6 +150,7 @@ func TestGetGenericPlacementIntent(t *testing.T) { projectName string compositeAppName string compositeAppVersion string + deploymentIntentGroupName string }{ { label: "Get Intent", @@ -127,6 +158,7 @@ func TestGetGenericPlacementIntent(t *testing.T) { projectName: "testProject", compositeAppName: "testCompositeApp", compositeAppVersion: "testVersion", + deploymentIntentGroupName: "testDeploymentIntentGroup", expected: GenericPlacementIntent{ MetaData: GenIntentMetaData{ Name: "testIntent", @@ -134,9 +166,6 @@ func TestGetGenericPlacementIntent(t *testing.T) { UserData1: "userData1", UserData2: "userData2", }, - Spec: GenIntentSpecData{ - LogicalCloud: "logicalCloud1", - }, }, expectedError: "", mockdb: &db.MockDB{ @@ -146,13 +175,14 @@ func TestGetGenericPlacementIntent(t *testing.T) { Project: "testProject", CompositeApp: "testCompositeApp", Version: "testVersion", + DigName: "testDeploymentIntentGroup", }.String(): { "genericplacementintentmetadata": []byte( "{\"metadata\":{\"Name\":\"testIntent\"," + "\"Description\":\"A sample intent for testing\"," + "\"UserData1\": \"userData1\"," + - "\"UserData2\": \"userData2\"}," + - "\"spec\":{\"Logical-Cloud\": \"logicalCloud1\"}}"), + "\"UserData2\": \"userData2\"}" + + "}"), }, }, }, @@ -163,7 +193,7 @@ func TestGetGenericPlacementIntent(t *testing.T) { t.Run(testCase.label, func(t *testing.T) { db.DBconn = testCase.mockdb intentCli := NewGenericPlacementIntentClient() - got, err := intentCli.GetGenericPlacementIntent(testCase.intentName, testCase.projectName, testCase.compositeAppName, testCase.compositeAppVersion) + got, err := intentCli.GetGenericPlacementIntent(testCase.intentName, testCase.projectName, testCase.compositeAppName, testCase.compositeAppVersion, testCase.deploymentIntentGroupName) if err != nil { if testCase.expectedError == "" { t.Fatalf("GetGenericPlacementIntent returned an unexpected error: %s", err) |