You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/12/30 09:03:21 UTC

[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #787: WIP [SCD-2133] add new display data interface

tianxiaoliang commented on a change in pull request #787:
URL: https://github.com/apache/servicecomb-service-center/pull/787#discussion_r550056674



##########
File path: server/service/gov/config_distributor_test.go
##########
@@ -40,13 +47,61 @@ func TestCreate(t *testing.T) {
 		},
 	}
 	err := svc.Init()
+	if err != nil {
+		panic(err)
+	}
+}
+
+func TestCreate(t *testing.T) {
+	b, _ := json.MarshalIndent(&gov.Policy{
+		GovernancePolicy: &gov.GovernancePolicy{
+			Name: "Traffic2adminAPI",
+		},
+		Spec: &gov.LBSpec{RetryNext: 3, MarkerName: "traffic2adminAPI"},
+	}, "", "  ")
+	res, err := svc.Create(MockKind, Project, b)
+	id = string(res)
 	assert.NoError(t, err)
+}
+
+func TestUpdate(t *testing.T) {
 	b, _ := json.MarshalIndent(&gov.Policy{
 		GovernancePolicy: &gov.GovernancePolicy{
 			Name: "Traffic2adminAPI",
 		},
 		Spec: &gov.LBSpec{RetryNext: 3, MarkerName: "traffic2adminAPI"},
 	}, "", "  ")
-	err = svc.Create("lb", "default", b)
+	err := svc.Update(id, MockKind, Project, b)
+	assert.NoError(t, err)
+}
+
+func TestDisplay(t *testing.T) {
+	policies := &[]*gov.DisplayData{}
+	res, err := svc.Display(Project, MockApp, MockEnv)
+	assert.NoError(t, err)
+	err = json.Unmarshal(res, policies)
+	assert.NoError(t, err)

Review comment:
       起码做个 not empty的判断




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org