Skip to content

Commit

Permalink
[ggj][engx] build: add integration golden tests to CircleCI (#440)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
miraleung authored Oct 31, 2020
1 parent 5247a6b commit fda8eb2
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 34 deletions.
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ jobs:
cd /tmp/gapic-generator-java
bazel --batch test //src/test/... --noshow_progress
find . -type f -regex ".*/bazel-testlogs/.*xml" -exec cp {} ${TEST_REPORTS_DIR} \;
- run:
name: Run integration tests for gapic-generator-java
command: |
cd /tmp/gapic-generator-java
# Check only the goldens, rely on the pre-commits for client library compilation tests.
# Otherwise, this would take too long.
bazel --batch test //test/integration:asset //test/integration:logging //test/integration:redis --noshow_progress
find . -type f -regex ".*/bazel-testlogs/.*xml" -exec cp {} ${TEST_REPORTS_DIR} \;
- store_test_results:
path: ~/.cache/bazel
google-java-format:
Expand Down
1 change: 1 addition & 0 deletions test/integration/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ java_gapic_library(
"@com_google_googleapis//google/iam/v1:iam_java_grpc",
],
deps = [
"@com_google_googleapis//google/cloud/asset/v1:asset_java_proto",
"@com_google_googleapis//google/iam/v1:iam_java_proto",
"@com_google_googleapis//google/identity/accesscontextmanager/v1:accesscontextmanager_proto",
],
Expand Down
15 changes: 8 additions & 7 deletions test/integration/goldens/asset/AssetServiceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,32 @@ public class AssetServiceClient implements BackgroundResource {
private final AssetServiceStub stub;
private final OperationsClient operationsClient;

/** Constructs an instance of EchoClient with default settings. */
/** Constructs an instance of AssetServiceClient with default settings. */
public static final AssetServiceClient create() throws IOException {
return create(AssetServiceSettings.newBuilder().build());
}

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

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

/**
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
* Constructs an instance of AssetServiceClient, using the given settings. This is protected so
* that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected AssetServiceClient(AssetServiceSettings settings) throws IOException {
this.settings = settings;
Expand Down
15 changes: 8 additions & 7 deletions test/integration/goldens/logging/ConfigServiceV2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,33 @@ public class ConfigServiceV2Client implements BackgroundResource {
private final ConfigServiceV2Settings settings;
private final ConfigServiceV2Stub stub;

/** Constructs an instance of EchoClient with default settings. */
/** Constructs an instance of ConfigServiceV2Client with default settings. */
public static final ConfigServiceV2Client create() throws IOException {
return create(ConfigServiceV2Settings.newBuilder().build());
}

/**
* Constructs an instance of EchoClient, using the given settings. The channels are created based
* on the settings passed in, or defaults for any settings that are not set.
* Constructs an instance of ConfigServiceV2Client, using the given settings. The channels are
* created based on the settings passed in, or defaults for any settings that are not set.
*/
public static final ConfigServiceV2Client create(ConfigServiceV2Settings settings)
throws IOException {
return new ConfigServiceV2Client(settings);
}

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

/**
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
* Constructs an instance of ConfigServiceV2Client, using the given settings. This is protected so
* that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected ConfigServiceV2Client(ConfigServiceV2Settings settings) throws IOException {
this.settings = settings;
Expand Down
15 changes: 8 additions & 7 deletions test/integration/goldens/logging/LoggingServiceV2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,33 @@ public class LoggingServiceV2Client implements BackgroundResource {
private final LoggingServiceV2Settings settings;
private final LoggingServiceV2Stub stub;

/** Constructs an instance of EchoClient with default settings. */
/** Constructs an instance of LoggingServiceV2Client with default settings. */
public static final LoggingServiceV2Client create() throws IOException {
return create(LoggingServiceV2Settings.newBuilder().build());
}

/**
* Constructs an instance of EchoClient, using the given settings. The channels are created based
* on the settings passed in, or defaults for any settings that are not set.
* Constructs an instance of LoggingServiceV2Client, using the given settings. The channels are
* created based on the settings passed in, or defaults for any settings that are not set.
*/
public static final LoggingServiceV2Client create(LoggingServiceV2Settings settings)
throws IOException {
return new LoggingServiceV2Client(settings);
}

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

/**
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
* Constructs an instance of LoggingServiceV2Client, using the given settings. This is protected
* so that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected LoggingServiceV2Client(LoggingServiceV2Settings settings) throws IOException {
this.settings = settings;
Expand Down
15 changes: 8 additions & 7 deletions test/integration/goldens/logging/MetricsServiceV2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,32 +79,33 @@ public class MetricsServiceV2Client implements BackgroundResource {
private final MetricsServiceV2Settings settings;
private final MetricsServiceV2Stub stub;

/** Constructs an instance of EchoClient with default settings. */
/** Constructs an instance of MetricsServiceV2Client with default settings. */
public static final MetricsServiceV2Client create() throws IOException {
return create(MetricsServiceV2Settings.newBuilder().build());
}

/**
* Constructs an instance of EchoClient, using the given settings. The channels are created based
* on the settings passed in, or defaults for any settings that are not set.
* Constructs an instance of MetricsServiceV2Client, using the given settings. The channels are
* created based on the settings passed in, or defaults for any settings that are not set.
*/
public static final MetricsServiceV2Client create(MetricsServiceV2Settings settings)
throws IOException {
return new MetricsServiceV2Client(settings);
}

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

/**
* Constructs an instance of EchoClient, using the given settings. This is protected so that it is
* easy to make a subclass, but otherwise, the static factory methods should be preferred.
* Constructs an instance of MetricsServiceV2Client, using the given settings. This is protected
* so that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected MetricsServiceV2Client(MetricsServiceV2Settings settings) throws IOException {
this.settings = settings;
Expand Down
12 changes: 6 additions & 6 deletions test/integration/goldens/redis/CloudRedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ public class CloudRedisClient implements BackgroundResource {
private final CloudRedisStub stub;
private final OperationsClient operationsClient;

/** Constructs an instance of EchoClient with default settings. */
/** Constructs an instance of CloudRedisClient with default settings. */
public static final CloudRedisClient create() throws IOException {
return create(CloudRedisSettings.newBuilder().build());
}

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

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

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

0 comments on commit fda8eb2

Please sign in to comment.