[ https://issues.apache.org/jira/browse/SCB-694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16521966#comment-16521966 ]
ASF GitHub Bot commented on SCB-694: ------------------------------------ little-cui closed pull request #378: SCB-694 Add 'PLATFORM' register type URL: https://github.com/apache/incubator-servicecomb-service-center/pull/378 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/server/core/proto/services.go b/server/core/proto/services.go index 1a6de8ec..133eb090 100644 --- a/server/core/proto/services.go +++ b/server/core/proto/services.go @@ -60,6 +60,7 @@ const ( REGISTERBY_SDK string = "SDK" REGISTERBY_SIDECAR string = "SIDECAR" + REGISTERBY_PLATFORM string = "PLATFORM" APP_ID = "default" VERSION = "0.0.1" diff --git a/server/service/microservice_test.go b/server/service/microservice_test.go index 58081967..9e419c7f 100644 --- a/server/service/microservice_test.go +++ b/server/service/microservice_test.go @@ -110,7 +110,7 @@ var _ = Describe("'Micro-service' service", func() { By("first: create") resp, err := serviceResource.Create(getContext(), &pb.CreateServiceRequest{ Service: &pb.MicroService{ - ServiceName: "create_serivce_rule_tag", + ServiceName: "create_service_rule_tag", AppId: "default", Version: "1.0.0", Level: "FRONT", @@ -131,7 +131,7 @@ var _ = Describe("'Micro-service' service", func() { tags["second"] = "second" resp, err = serviceResource.Create(getContext(), &pb.CreateServiceRequest{ Service: &pb.MicroService{ - ServiceName: "create_serivce_rule_tag", + ServiceName: "create_service_rule_tag", AppId: "default", Version: "1.0.0", Level: "FRONT", @@ -582,6 +582,36 @@ var _ = Describe("'Micro-service' service", func() { Expect(err).To(BeNil()) Expect(resp.Response.Code).To(Equal(scerr.ErrInvalidParams)) + By("valid registerBy") + r = &pb.CreateServiceRequest{ + Service: &pb.MicroService{ + AppId: "default", + ServiceName: "registerBy-test", + Version: "1.0.10", + Level: "BACK", + Status: "UP", + RegisterBy: "PLATFORM", + }, + } + resp, err = serviceResource.Create(getContext(), r) + Expect(err).To(BeNil()) + Expect(resp.Response.Code).To(Equal(pb.Response_SUCCESS)) + + By("valid registerBy") + r = &pb.CreateServiceRequest{ + Service: &pb.MicroService{ + AppId: "default", + ServiceName: "registerBy-test", + Version: "1.0.11", + Level: "BACK", + Status: "UP", + RegisterBy: "SIDECAR", + }, + } + resp, err = serviceResource.Create(getContext(), r) + Expect(err).To(BeNil()) + Expect(resp.Response.Code).To(Equal(pb.Response_SUCCESS)) + By("invalid description") r = &pb.CreateServiceRequest{ Service: &pb.MicroService{ diff --git a/server/service/microservice_validator.go b/server/service/microservice_validator.go index ea72b789..70a30728 100644 --- a/server/service/microservice_validator.go +++ b/server/service/microservice_validator.go @@ -47,7 +47,7 @@ var ( statusRegex, _ = regexp.Compile("^(" + pb.MS_UP + "|" + pb.MS_DOWN + ")?$") serviceIdRegex, _ = regexp.Compile(`^\S*$`) aliasRegex, _ = regexp.Compile(`^[a-zA-Z0-9_\-.:]*$`) - registerByRegex, _ = regexp.Compile("^(" + util.StringJoin([]string{pb.REGISTERBY_SDK, pb.REGISTERBY_SIDECAR}, "|") + ")*$") + registerByRegex, _ = regexp.Compile("^(" + util.StringJoin([]string{pb.REGISTERBY_SDK, pb.REGISTERBY_SIDECAR, pb.REGISTERBY_PLATFORM}, "|") + ")*$") envRegex, _ = regexp.Compile("^(" + util.StringJoin([]string{ pb.ENV_DEV, pb.ENV_TEST, pb.ENV_ACCEPT, pb.ENV_PROD}, "|") + ")*$") schemaIdRegex, _ = regexp.Compile(`^[a-zA-Z0-9]{1,160}$|^[a-zA-Z0-9][a-zA-Z0-9_\-.]{0,158}[a-zA-Z0-9]$`) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add 'PLATFORM' register type > ---------------------------- > > Key: SCB-694 > URL: https://issues.apache.org/jira/browse/SCB-694 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Service-Center > Reporter: little-cui > Assignee: little-cui > Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)