Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fda8eb2

Browse files
authored
[ggj][engx] build: add integration golden tests to CircleCI (#440)
* fix: support non-name fields with res-refs in resname def parsing * fix: add workaround for missing default_host and oauth_scopes annotation * fix: clarify LRO parsing error messages * feat: support deeply-nested types in AST and proto message parsing * fix: prevent resname tokens from matching subcomponents * fix: use TypeParser for proto message parsing * fix: use generic types in field instantiation in ServiceClientTest * fix: prevent descension into map types in nested message parsing * fix: merge master * fix: use both map generics in ServiceClientTest codegen * fix: dir structure of generated files * test: add asset API gradle pkg rules * fix: remove unused dep * test: add logging integration target and goldens, consolidate rules * fix: fix asset_java_gapic build * fix: fix test src packaging, update integration goldens * fix: pass all tokens to instansiate in resname 1-pattern case * fix: update goldens * fix: update goldens * build: add all integration tests to pre-commit hook * build: run pre-commit when goldens have changed * build: add integration golden tests to CircleCI * Update pre-commit * fix: merge master
1 parent 5247a6b commit fda8eb2

File tree

7 files changed

+47
-34
lines changed

7 files changed

+47
-34
lines changed

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ jobs:
3535
cd /tmp/gapic-generator-java
3636
bazel --batch test //src/test/... --noshow_progress
3737
find . -type f -regex ".*/bazel-testlogs/.*xml" -exec cp {} ${TEST_REPORTS_DIR} \;
38+
- run:
39+
name: Run integration tests for gapic-generator-java
40+
command: |
41+
cd /tmp/gapic-generator-java
42+
# Check only the goldens, rely on the pre-commits for client library compilation tests.
43+
# Otherwise, this would take too long.
44+
bazel --batch test //test/integration:asset //test/integration:logging //test/integration:redis --noshow_progress
45+
find . -type f -regex ".*/bazel-testlogs/.*xml" -exec cp {} ${TEST_REPORTS_DIR} \;
3846
- store_test_results:
3947
path: ~/.cache/bazel
4048
google-java-format:

test/integration/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ java_gapic_library(
5252
"@com_google_googleapis//google/iam/v1:iam_java_grpc",
5353
],
5454
deps = [
55+
"@com_google_googleapis//google/cloud/asset/v1:asset_java_proto",
5556
"@com_google_googleapis//google/iam/v1:iam_java_proto",
5657
"@com_google_googleapis//google/identity/accesscontextmanager/v1:accesscontextmanager_proto",
5758
],

test/integration/goldens/asset/AssetServiceClient.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,31 +84,32 @@ public class AssetServiceClient implements BackgroundResource {
8484
private final AssetServiceStub stub;
8585
private final OperationsClient operationsClient;
8686

87-
/** Constructs an instance of EchoClient with default settings. */
87+
/** Constructs an instance of AssetServiceClient with default settings. */
8888
public static final AssetServiceClient create() throws IOException {
8989
return create(AssetServiceSettings.newBuilder().build());
9090
}
9191

9292
/**
93-
* Constructs an instance of EchoClient, using the given settings. The channels are created based
94-
* on the settings passed in, or defaults for any settings that are not set.
93+
* Constructs an instance of AssetServiceClient, using the given settings. The channels are
94+
* created based on the settings passed in, or defaults for any settings that are not set.
9595
*/
9696
public static final AssetServiceClient create(AssetServiceSettings settings) throws IOException {
9797
return new AssetServiceClient(settings);
9898
}
9999

100100
/**
101-
* Constructs an instance of EchoClient, using the given stub for making calls. This is for
102-
* advanced usage - prefer using create(AssetServiceSettings).
101+
* Constructs an instance of AssetServiceClient, using the given stub for making calls. This is
102+
* for advanced usage - prefer using create(AssetServiceSettings).
103103
*/
104104
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
105105
public static final AssetServiceClient create(AssetServiceStub stub) {
106106
return new AssetServiceClient(stub);
107107
}
108108

109109
/**
110-
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
111-
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
110+
* Constructs an instance of AssetServiceClient, using the given settings. This is protected so
111+
* that it is easy to make a subclass, but otherwise, the static factory methods should be
112+
* preferred.
112113
*/
113114
protected AssetServiceClient(AssetServiceSettings settings) throws IOException {
114115
this.settings = settings;

test/integration/goldens/logging/ConfigServiceV2Client.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,33 @@ public class ConfigServiceV2Client implements BackgroundResource {
8080
private final ConfigServiceV2Settings settings;
8181
private final ConfigServiceV2Stub stub;
8282

83-
/** Constructs an instance of EchoClient with default settings. */
83+
/** Constructs an instance of ConfigServiceV2Client with default settings. */
8484
public static final ConfigServiceV2Client create() throws IOException {
8585
return create(ConfigServiceV2Settings.newBuilder().build());
8686
}
8787

8888
/**
89-
* Constructs an instance of EchoClient, using the given settings. The channels are created based
90-
* on the settings passed in, or defaults for any settings that are not set.
89+
* Constructs an instance of ConfigServiceV2Client, using the given settings. The channels are
90+
* created based on the settings passed in, or defaults for any settings that are not set.
9191
*/
9292
public static final ConfigServiceV2Client create(ConfigServiceV2Settings settings)
9393
throws IOException {
9494
return new ConfigServiceV2Client(settings);
9595
}
9696

9797
/**
98-
* Constructs an instance of EchoClient, using the given stub for making calls. This is for
99-
* advanced usage - prefer using create(ConfigServiceV2Settings).
98+
* Constructs an instance of ConfigServiceV2Client, using the given stub for making calls. This is
99+
* for advanced usage - prefer using create(ConfigServiceV2Settings).
100100
*/
101101
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
102102
public static final ConfigServiceV2Client create(ConfigServiceV2Stub stub) {
103103
return new ConfigServiceV2Client(stub);
104104
}
105105

106106
/**
107-
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
108-
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
107+
* Constructs an instance of ConfigServiceV2Client, using the given settings. This is protected so
108+
* that it is easy to make a subclass, but otherwise, the static factory methods should be
109+
* preferred.
109110
*/
110111
protected ConfigServiceV2Client(ConfigServiceV2Settings settings) throws IOException {
111112
this.settings = settings;

test/integration/goldens/logging/LoggingServiceV2Client.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,32 +82,33 @@ public class LoggingServiceV2Client implements BackgroundResource {
8282
private final LoggingServiceV2Settings settings;
8383
private final LoggingServiceV2Stub stub;
8484

85-
/** Constructs an instance of EchoClient with default settings. */
85+
/** Constructs an instance of LoggingServiceV2Client with default settings. */
8686
public static final LoggingServiceV2Client create() throws IOException {
8787
return create(LoggingServiceV2Settings.newBuilder().build());
8888
}
8989

9090
/**
91-
* Constructs an instance of EchoClient, using the given settings. The channels are created based
92-
* on the settings passed in, or defaults for any settings that are not set.
91+
* Constructs an instance of LoggingServiceV2Client, using the given settings. The channels are
92+
* created based on the settings passed in, or defaults for any settings that are not set.
9393
*/
9494
public static final LoggingServiceV2Client create(LoggingServiceV2Settings settings)
9595
throws IOException {
9696
return new LoggingServiceV2Client(settings);
9797
}
9898

9999
/**
100-
* Constructs an instance of EchoClient, using the given stub for making calls. This is for
101-
* advanced usage - prefer using create(LoggingServiceV2Settings).
100+
* Constructs an instance of LoggingServiceV2Client, using the given stub for making calls. This
101+
* is for advanced usage - prefer using create(LoggingServiceV2Settings).
102102
*/
103103
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
104104
public static final LoggingServiceV2Client create(LoggingServiceV2Stub stub) {
105105
return new LoggingServiceV2Client(stub);
106106
}
107107

108108
/**
109-
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
110-
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
109+
* Constructs an instance of LoggingServiceV2Client, using the given settings. This is protected
110+
* so that it is easy to make a subclass, but otherwise, the static factory methods should be
111+
* preferred.
111112
*/
112113
protected LoggingServiceV2Client(LoggingServiceV2Settings settings) throws IOException {
113114
this.settings = settings;

test/integration/goldens/logging/MetricsServiceV2Client.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,32 +79,33 @@ public class MetricsServiceV2Client implements BackgroundResource {
7979
private final MetricsServiceV2Settings settings;
8080
private final MetricsServiceV2Stub stub;
8181

82-
/** Constructs an instance of EchoClient with default settings. */
82+
/** Constructs an instance of MetricsServiceV2Client with default settings. */
8383
public static final MetricsServiceV2Client create() throws IOException {
8484
return create(MetricsServiceV2Settings.newBuilder().build());
8585
}
8686

8787
/**
88-
* Constructs an instance of EchoClient, using the given settings. The channels are created based
89-
* on the settings passed in, or defaults for any settings that are not set.
88+
* Constructs an instance of MetricsServiceV2Client, using the given settings. The channels are
89+
* created based on the settings passed in, or defaults for any settings that are not set.
9090
*/
9191
public static final MetricsServiceV2Client create(MetricsServiceV2Settings settings)
9292
throws IOException {
9393
return new MetricsServiceV2Client(settings);
9494
}
9595

9696
/**
97-
* Constructs an instance of EchoClient, using the given stub for making calls. This is for
98-
* advanced usage - prefer using create(MetricsServiceV2Settings).
97+
* Constructs an instance of MetricsServiceV2Client, using the given stub for making calls. This
98+
* is for advanced usage - prefer using create(MetricsServiceV2Settings).
9999
*/
100100
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
101101
public static final MetricsServiceV2Client create(MetricsServiceV2Stub stub) {
102102
return new MetricsServiceV2Client(stub);
103103
}
104104

105105
/**
106-
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
107-
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
106+
* Constructs an instance of MetricsServiceV2Client, using the given settings. This is protected
107+
* so that it is easy to make a subclass, but otherwise, the static factory methods should be
108+
* preferred.
108109
*/
109110
protected MetricsServiceV2Client(MetricsServiceV2Settings settings) throws IOException {
110111
this.settings = settings;

test/integration/goldens/redis/CloudRedisClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,21 @@ public class CloudRedisClient implements BackgroundResource {
9393
private final CloudRedisStub stub;
9494
private final OperationsClient operationsClient;
9595

96-
/** Constructs an instance of EchoClient with default settings. */
96+
/** Constructs an instance of CloudRedisClient with default settings. */
9797
public static final CloudRedisClient create() throws IOException {
9898
return create(CloudRedisSettings.newBuilder().build());
9999
}
100100

101101
/**
102-
* Constructs an instance of EchoClient, using the given settings. The channels are created based
103-
* on the settings passed in, or defaults for any settings that are not set.
102+
* Constructs an instance of CloudRedisClient, using the given settings. The channels are created
103+
* based on the settings passed in, or defaults for any settings that are not set.
104104
*/
105105
public static final CloudRedisClient create(CloudRedisSettings settings) throws IOException {
106106
return new CloudRedisClient(settings);
107107
}
108108

109109
/**
110-
* Constructs an instance of EchoClient, using the given stub for making calls. This is for
110+
* Constructs an instance of CloudRedisClient, using the given stub for making calls. This is for
111111
* advanced usage - prefer using create(CloudRedisSettings).
112112
*/
113113
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
@@ -116,8 +116,8 @@ public static final CloudRedisClient create(CloudRedisStub stub) {
116116
}
117117

118118
/**
119-
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
120-
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
119+
* Constructs an instance of CloudRedisClient, using the given settings. This is protected so that
120+
* it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
121121
*/
122122
protected CloudRedisClient(CloudRedisSettings settings) throws IOException {
123123
this.settings = settings;

0 commit comments

Comments
 (0)