Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: server/discovery/internal/testservices/discovery_test.go

Issue 1587323003: client/cmd/rpc: RPC CLI (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@discovery
Patch Set: rebased Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/proto/google/descriptor/util_test.proto ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package testservices 5 package testservices
6 6
7 // This test is not in discovery because it needs to a test services 7 // This test is not in discovery because it needs to a test services
8 // in different directories. 8 // in different directories.
9 // However, a generated service depends on server/discovery 9 // However, a generated service depends on server/discovery
10 // and a test in server/discovery depends on the service. 10 // and a test in server/discovery depends on the service.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 "testservices.Calc", 47 "testservices.Calc",
48 }) 48 })
49 49
50 desc := &descriptor.FileDescriptorSet{} 50 desc := &descriptor.FileDescriptorSet{}
51 err = proto.Unmarshal(res.FileDescriptionSet, desc) 51 err = proto.Unmarshal(res.FileDescriptionSet, desc)
52 So(err, ShouldBeNil) 52 So(err, ShouldBeNil)
53 53
54 // this checks that file deduplication actually works. 54 // this checks that file deduplication actually works.
55 So(len(desc.File), ShouldEqual, 2) 55 So(len(desc.File), ShouldEqual, 2)
56 56
57 » » discovery := desc.FindService("discovery.Discovery") 57 » » _, discoveryIndex := desc.FindService("discovery.Discovery")
58 » » So(discovery, ShouldNotBeNil) 58 » » So(discoveryIndex, ShouldNotEqual, -1)
59 59
60 » » calc := desc.FindService("testservices.Calc") 60 » » _, calcIndex := desc.FindService("testservices.Calc")
61 » » So(calc, ShouldNotBeNil) 61 » » So(calcIndex, ShouldNotEqual, -1)
62 62
63 » » serviceDesc := desc.FindService("testservices.Greeter") 63 » » file, greeterIndex := desc.FindService("testservices.Greeter")
64 » » So(serviceDesc, ShouldNotBeNil) 64 » » So(greeterIndex, ShouldNotEqual, -1)
65 » » greeter := file.Service[greeterIndex]
65 66
66 » » sayHelloDesc := serviceDesc.FindMethod("SayHello") 67 » » sayHelloIndex := greeter.FindMethod("SayHello")
67 » » So(sayHelloDesc, ShouldNotBeNil) 68 » » So(sayHelloIndex, ShouldNotEqual, -1)
69 » » sayHello := greeter.Method[sayHelloIndex]
68 70
69 » » So(sayHelloDesc.GetInputType(), ShouldEqual, ".testservices.Hell oRequest") 71 » » So(sayHello.GetInputType(), ShouldEqual, ".testservices.HelloReq uest")
70 » » helloReq := desc.FindMessage("testservices.HelloRequest") 72 » » _, obj, _ := desc.Resolve("testservices.HelloRequest")
73 » » So(obj, ShouldNotBeNil)
74 » » helloReq := obj.(*descriptor.DescriptorProto)
71 So(helloReq, ShouldNotBeNil) 75 So(helloReq, ShouldNotBeNil)
72 So(helloReq.Field, ShouldHaveLength, 1) 76 So(helloReq.Field, ShouldHaveLength, 1)
73 So(helloReq.Field[0].GetName(), ShouldEqual, "name") 77 So(helloReq.Field[0].GetName(), ShouldEqual, "name")
74 So(helloReq.Field[0].GetType(), ShouldEqual, descriptor.FieldDes criptorProto_TYPE_STRING) 78 So(helloReq.Field[0].GetType(), ShouldEqual, descriptor.FieldDes criptorProto_TYPE_STRING)
75 }) 79 })
76 } 80 }
OLDNEW
« no previous file with comments | « common/proto/google/descriptor/util_test.proto ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698