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 2018/12/05 14:52:51 UTC

[GitHub] little-cui closed pull request #507: SCB-1070 New instance 'TESTING' status

little-cui closed pull request #507: SCB-1070 New instance 'TESTING' status
URL: https://github.com/apache/servicecomb-service-center/pull/507
 
 
   

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/common.go b/server/core/proto/common.go
index c7c5eccf..f21dcf5f 100644
--- a/server/core/proto/common.go
+++ b/server/core/proto/common.go
@@ -32,6 +32,7 @@ const (
 	MSI_UP           string = "UP"
 	MSI_DOWN         string = "DOWN"
 	MSI_STARTING     string = "STARTING"
+	MSI_TESTING      string = "TESTING"
 	MSI_OUTOFSERVICE string = "OUTOFSERVICE"
 
 	CHECK_BY_HEARTBEAT string = "push"
diff --git a/server/service/instance_test.go b/server/service/instance_test.go
index 3b67e018..25b654fa 100644
--- a/server/service/instance_test.go
+++ b/server/service/instance_test.go
@@ -620,11 +620,43 @@ var _ = Describe("'Instance' service", func() {
 			It("should be passed", func() {
 				By("update instance status")
 				respUpdateStatus, err := instanceResource.UpdateStatus(getContext(), &pb.UpdateInstanceStatusRequest{
+					ServiceId:  serviceId,
+					InstanceId: instanceId,
+					Status:     pb.MSI_DOWN,
+				})
+				Expect(err).To(BeNil())
+				Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
+
+				respUpdateStatus, err = instanceResource.UpdateStatus(getContext(), &pb.UpdateInstanceStatusRequest{
+					ServiceId:  serviceId,
+					InstanceId: instanceId,
+					Status:     pb.MSI_OUTOFSERVICE,
+				})
+				Expect(err).To(BeNil())
+				Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
+
+				respUpdateStatus, err = instanceResource.UpdateStatus(getContext(), &pb.UpdateInstanceStatusRequest{
 					ServiceId:  serviceId,
 					InstanceId: instanceId,
 					Status:     pb.MSI_STARTING,
 				})
+				Expect(err).To(BeNil())
+				Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
+
+				respUpdateStatus, err = instanceResource.UpdateStatus(getContext(), &pb.UpdateInstanceStatusRequest{
+					ServiceId:  serviceId,
+					InstanceId: instanceId,
+					Status:     pb.MSI_TESTING,
+				})
+
+				Expect(err).To(BeNil())
+				Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
 
+				respUpdateStatus, err = instanceResource.UpdateStatus(getContext(), &pb.UpdateInstanceStatusRequest{
+					ServiceId:  serviceId,
+					InstanceId: instanceId,
+					Status:     pb.MSI_UP,
+				})
 				Expect(err).To(BeNil())
 				Expect(respUpdateStatus.Response.Code).To(Equal(pb.Response_SUCCESS))
 
diff --git a/server/service/instance_validator.go b/server/service/instance_validator.go
index cf7a1dfb..bebb2c31 100644
--- a/server/service/instance_validator.go
+++ b/server/service/instance_validator.go
@@ -36,9 +36,9 @@ var (
 
 var (
 	instStatusRegex, _ = regexp.Compile("^(" + util.StringJoin([]string{
-		pb.MSI_UP, pb.MSI_DOWN, pb.MSI_STARTING, pb.MSI_OUTOFSERVICE}, "|") + ")?$")
+		pb.MSI_UP, pb.MSI_DOWN, pb.MSI_STARTING, pb.MSI_TESTING, pb.MSI_OUTOFSERVICE}, "|") + ")?$")
 	updateInstStatusRegex, _ = regexp.Compile("^(" + util.StringJoin([]string{
-		pb.MSI_UP, pb.MSI_DOWN, pb.MSI_STARTING, pb.MSI_OUTOFSERVICE}, "|") + ")$")
+		pb.MSI_UP, pb.MSI_DOWN, pb.MSI_STARTING, pb.MSI_TESTING, pb.MSI_OUTOFSERVICE}, "|") + ")$")
 	hbModeRegex, _               = regexp.Compile(`^(push|pull)$`)
 	urlRegex, _                  = regexp.Compile(`^\S*$`)
 	epRegex, _                   = regexp.Compile(`\S+`)


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services