servicecomb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] little-cui closed pull request #294: SCB-362 Fix UT failure
Date Fri, 02 Mar 2018 03:55:14 GMT
little-cui closed pull request #294: SCB-362 Fix UT failure
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/294
 
 
   

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/service/instances_test.go b/server/service/instances_test.go
index dfba6d3a..abbf5fc7 100644
--- a/server/service/instances_test.go
+++ b/server/service/instances_test.go
@@ -690,7 +690,8 @@ var _ = Describe("'Instance' service", func() {
 			Expect(respCreate.Response.Code).To(Equal(pb.Response_SUCCESS))
 			serviceId7 = respCreate.ServiceId
 
-			respCreate, err = serviceResource.Create(util.SetDomainProject(context.Background(), "user",
"user"),
+			respCreate, err = serviceResource.Create(
+				util.SetDomainProject(util.CloneContext(getContext()), "user", "user"),
 				&pb.CreateServiceRequest{
 					Service: &pb.MicroService{
 						AppId:       "default",
@@ -933,6 +934,17 @@ var _ = Describe("'Instance' service", func() {
 				Expect(len(respFind.Instances)).To(Equal(1))
 				Expect(respFind.Instances[0].InstanceId).To(Equal(instanceId5))
 
+				By("get same domain deps")
+				respGetC, err := serviceResource.GetConsumerDependencies(
+					util.SetDomainProject(util.CloneContext(getContext()), "user", "user"),
+					&pb.GetDependenciesRequest{
+						ServiceId:  serviceId6,
+						SameDomain: true,
+					})
+				Expect(err).To(BeNil())
+				Expect(respGetC.Response.Code).To(Equal(pb.Response_SUCCESS))
+				Expect(len(respGetC.Providers)).To(Equal(0))
+
 				core.Service.Environment = pb.ENV_DEV
 			})
 		})
diff --git a/server/service/service_dependency_test.go b/server/service/service_dependency_test.go
index d96304bb..04f8c25a 100644
--- a/server/service/service_dependency_test.go
+++ b/server/service/service_dependency_test.go
@@ -17,12 +17,10 @@
 package service_test
 
 import (
-	"github.com/apache/incubator-servicecomb-service-center/pkg/util"
 	pb "github.com/apache/incubator-servicecomb-service-center/server/core/proto"
 	"github.com/apache/incubator-servicecomb-service-center/server/service/event"
 	. "github.com/onsi/ginkgo"
 	. "github.com/onsi/gomega"
-	"golang.org/x/net/context"
 )
 
 var deh event.DependencyEventHandler
@@ -412,7 +410,6 @@ var _ = Describe("'Dependency' service", func() {
 	Describe("execute 'get' operartion", func() {
 		var (
 			consumerId1 string
-			consumerId2 string
 			providerId1 string
 			providerId2 string
 		)
@@ -431,21 +428,6 @@ var _ = Describe("'Dependency' service", func() {
 			Expect(respCreateService.Response.Code).To(Equal(pb.Response_SUCCESS))
 			consumerId1 = respCreateService.ServiceId
 
-			respCreateService, err = serviceResource.Create(util.SetDomainProject(context.Background(),
"user", "user"),
-				&pb.CreateServiceRequest{
-					Service: &pb.MicroService{
-						Environment: pb.ENV_DEV,
-						AppId:       "get_dep_group",
-						ServiceName: "get_same_domain_dep_consumer",
-						Version:     "1.0.0",
-						Level:       "FRONT",
-						Status:      pb.MS_UP,
-					},
-				})
-			Expect(err).To(BeNil())
-			Expect(respCreateService.Response.Code).To(Equal(pb.Response_SUCCESS))
-			consumerId2 = respCreateService.ServiceId
-
 			respCreateService, err = serviceResource.Create(getContext(), &pb.CreateServiceRequest{
 				Service: &pb.MicroService{
 					AppId:       "get_dep_group",
@@ -599,30 +581,6 @@ var _ = Describe("'Dependency' service", func() {
 				Expect(err).To(BeNil())
 				Expect(respGetC.Response.Code).To(Equal(pb.Response_SUCCESS))
 				Expect(len(respGetC.Providers)).To(Equal(1))
-
-				By("get same domain deps")
-				respFind, err := instanceResource.Find(
-					util.SetTargetDomainProject(
-						util.SetDomainProject(util.CloneContext(getContext()), "user", "user"),
-						"default", "default"),
-					&pb.FindInstancesRequest{
-						ConsumerServiceId: consumerId2,
-						AppId:             "default",
-						ServiceName:       "SERVICECENTER",
-						VersionRule:       "latest",
-					})
-				Expect(err).To(BeNil())
-				Expect(respFind.Response.Code).To(Equal(pb.Response_SUCCESS))
-
-				respGetC, err = serviceResource.GetConsumerDependencies(
-					util.SetDomainProject(context.Background(), "user", "user"),
-					&pb.GetDependenciesRequest{
-						ServiceId:  consumerId2,
-						SameDomain: true,
-					})
-				Expect(err).To(BeNil())
-				Expect(respGetC.Response.Code).To(Equal(pb.Response_SUCCESS))
-				Expect(len(respGetC.Providers)).To(Equal(0))
 			})
 		})
 	})


 

----------------------------------------------------------------
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

Mime
View raw message