Skip to content

Commit 69ae172

Browse files
committed
tests: Streamline testing for LRO
- Disable testing of snippets rather than having all the files with "test disabled" - Remove the build test (which would require us to have snippet csproj files) - Move the fakes out of the folder where we expect generated code to live - Test against the full generated file instead of just small parts of it
1 parent a7edb89 commit 69ae172

20 files changed

+515
-120
lines changed

Google.Api.Generator.Tests/ProtoTest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void CleanUp(string path)
251251
public void Paginated0() => ProtoTestSingle("Paginated", ignoreCsProj: true);
252252

253253
[Fact]
254-
public void Lro0() => ProtoTestSingle("Lro");
254+
public void Lro0() => ProtoTestSingle("Lro", ignoreSnippets: true);
255255

256256
[Fact]
257257
public void ServerStreaming0() => ProtoTestSingle("ServerStreaming", ignoreCsProj: true, ignoreSnippets: true);
@@ -365,9 +365,6 @@ public void PublishingSettings() => ProtoTestSingle(
365365
[Fact]
366366
public void BuildBasic() => BuildTest("Basic", protoPackageVersion: "v1");
367367

368-
[Fact]
369-
public void BuildLro() => BuildTest("Lro");
370-
371368
[Fact]
372369
public void DuplicateResourceDefinitions()
373370
{

Google.Api.Generator.Tests/ProtoTests/Lro/Lro.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import "google/api/resource.proto";
66

77
package testing.lro;
88

9+
// LRO service to test.
910
service Lro {
1011
option (google.api.default_host) = "lro.example.com";
1112

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright 2019 Google Inc. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using Google.LongRunning;
16+
using Google.Protobuf.Reflection;
17+
using Grpc.Core;
18+
using System;
19+
20+
// Disable warning: Missing XML comment on public members.
21+
// Required to successfully build this generated test project.
22+
#pragma warning disable 1591
23+
24+
namespace Testing.Lro;
25+
26+
// gRPC fakes
27+
public static partial class Lro
28+
{
29+
public static ServiceDescriptor Descriptor => null;
30+
public partial class LroClient
31+
{
32+
private CallInvoker CallInvoker => throw new NotImplementedException();
33+
34+
public LroClient(CallInvoker callInvoker) { }
35+
public virtual AsyncUnaryCall<Operation> SignatureMethodAsync(Request request, CallOptions options) => throw new NotImplementedException();
36+
public virtual Operation SignatureMethod(Request request, CallOptions options) => throw new NotImplementedException();
37+
public virtual AsyncUnaryCall<Operation> ResourcedMethodAsync(ResourceRequest request, CallOptions options) => throw new NotImplementedException();
38+
public virtual Operation ResourcedMethod(ResourceRequest request, CallOptions options) => throw new NotImplementedException();
39+
}
40+
}
41+
42+
// Protobuf fakes
43+
public class Request : ProtoMsgFake<Request>
44+
{
45+
public string Name { get; set; }
46+
}
47+
48+
public partial class ResourceRequest : ProtoMsgFake<ResourceRequest>
49+
{
50+
public string Name { get; set; }
51+
}
52+
53+
public class LroResponse : ProtoMsgFake<LroResponse> {
54+
public class Types
55+
{
56+
public class Nested : ProtoMsgFake<Nested> { }
57+
}
58+
}
59+
60+
public class LroMetadata : ProtoMsgFake<LroMetadata>
61+
{
62+
public class Types
63+
{
64+
public class Nested : ProtoMsgFake<Nested> { }
65+
}
66+
}

Google.Api.Generator.Tests/ProtoTests/Lro/Testing.Lro.GeneratedSnippets/LroClient.ResourcedMethodAsyncSnippet.g.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

Google.Api.Generator.Tests/ProtoTests/Lro/Testing.Lro.GeneratedSnippets/LroClient.ResourcedMethodRequestObjectAsyncSnippet.g.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

Google.Api.Generator.Tests/ProtoTests/Lro/Testing.Lro.GeneratedSnippets/LroClient.ResourcedMethodRequestObjectSnippet.g.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

Google.Api.Generator.Tests/ProtoTests/Lro/Testing.Lro.GeneratedSnippets/LroClient.ResourcedMethodResourceNamesAsyncSnippet.g.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

Google.Api.Generator.Tests/ProtoTests/Lro/Testing.Lro.GeneratedSnippets/LroClient.ResourcedMethodResourceNamesSnippet.g.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

Google.Api.Generator.Tests/ProtoTests/Lro/Testing.Lro.GeneratedSnippets/LroClient.ResourcedMethodSnippet.g.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

Google.Api.Generator.Tests/ProtoTests/Lro/Testing.Lro.GeneratedSnippets/LroClient.SignatureMethodAsyncSnippet.g.cs

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)