Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,9 @@ protected final void blockingGetToCallback(URI uri, RequestMetadataCallback call
* @throws IOException if there was an error getting up-to-date access.
*/
public abstract void refresh() throws IOException;

/** Dummy method to test CI recognition of auth changes. */
public String getTestString() {
return "test";
}
Comment on lines +198 to +201
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding a public method to the Credentials class modifies the library's public API. For a core class, introducing "dummy" methods can lead to maintenance issues and confusion for external consumers. If this method is required for cross-repository CI testing, it should be restricted using an annotation like @InternalApi or @VisibleForTesting to prevent it from being considered part of the stable public API.

}
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ private BigQuery getBigQueryConnection() {
bigQueryOptions.setProjectId(this.catalog);
}
if (this.credentials != null) {
this.credentials.getTestString();
bigQueryOptions.setCredentials(this.credentials);
}
if (this.location != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ public SpanBuilder addSettingsAttributesToCurrentSpan(SpanBuilder spanBuilder) {
.build());

if (datastoreOptions.getCredentials() != null) {
datastoreOptions.getCredentials().getTestString();
spanBuilder =
spanBuilder.setAttribute(
ATTRIBUTE_SERVICE_PREFIX + "settings.credentials.authenticationType",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ private void setupGcpFallback(
try {
Credentials credentials = credentialsProvider.getCredentials();
if (credentials != null) {
credentials.getTestString();
cloudPathBuilder.intercept(
new ClientInterceptor() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ private Tuple<StorageSettings, Opts<UserProject>> resolveSettingsAndOpts() throw
Opts<UserProject> defaultOpts = Opts.empty();
CredentialsProvider credentialsProvider;
Preconditions.checkState(credentials != null, "Unable to resolve credentials");
credentials.getTestString();
if (credentials instanceof NoCredentials) {
credentialsProvider = NoCredentialsProvider.create();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,9 @@ public <T> T getOption(Key<T> key) {
@InternalApi
public void validateUniverseDomain() {
try {
if (credentials != null) {
credentials.getTestString();
}
Comment on lines +732 to +734
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The call to credentials.getTestString() is a no-op as the return value is not utilized. This introduces dead code into the validateUniverseDomain method. While this is a test PR, such code should not be present in the final implementation to avoid unnecessary execution overhead and maintain code clarity.

endpointContext.validateUniverseDomain(credentials, UNAUTHENTICATED_STATUS_CODE);
} catch (IOException e) {
// Check if it is an Auth Exception (All instances of IOException from endpointContext's
Expand Down
Loading