Skip to content

Conversation

@iamrajiv
Copy link

@iamrajiv iamrajiv commented Jan 10, 2026

This adds e2e style tests to verify that when JWT call credentials (which require transport security) are used with an insecure transport, the RPC fails with a meaningful error as expected per gRFC A97.

Fixes #8635

RELEASE NOTES: none

@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.16%. Comparing base (ad8bd71) to head (e40e0b3).
⚠️ Report is 36 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8818      +/-   ##
==========================================
- Coverage   83.22%   83.16%   -0.06%     
==========================================
  Files         417      414       -3     
  Lines       32920    32751     -169     
==========================================
- Hits        27397    27239     -158     
+ Misses       4110     4094      -16     
- Partials     1413     1418       +5     

see 43 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@iamrajiv iamrajiv changed the title feat(e2e): Add end-to-end tests for JWT call credentials behavior test: Add end-to-end tests for JWT call credentials behavior Jan 10, 2026
@iamrajiv iamrajiv changed the title test: Add end-to-end tests for JWT call credentials behavior feat(e2e): Add end-to-end tests for JWT call credentials behavior Jan 10, 2026
@Pranjali-2501 Pranjali-2501 self-requested a review January 21, 2026 12:56
@Pranjali-2501 Pranjali-2501 self-assigned this Jan 21, 2026
@Pranjali-2501 Pranjali-2501 added this to the 1.80 Release milestone Jan 21, 2026
Copy link
Contributor

@Pranjali-2501 Pranjali-2501 left a comment

Choose a reason for hiding this comment

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

@iamrajiv , Thank you for taking the initiative to add the tests.

@Pranjali-2501 Pranjali-2501 changed the title feat(e2e): Add end-to-end tests for JWT call credentials behavior credentials: add end-to-end tests for JWT call credentials behavior Jan 22, 2026
Signed-off-by: iamrajiv <[email protected]>
@easwars easwars assigned Pranjali-2501 and unassigned iamrajiv Jan 22, 2026
Copy link
Contributor

@Pranjali-2501 Pranjali-2501 left a comment

Choose a reason for hiding this comment

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

The test looks good to me. I have minor nits.

Signed-off-by: iamrajiv <[email protected]>
@Pranjali-2501 Pranjali-2501 assigned easwars and unassigned iamrajiv Jan 29, 2026
@Pranjali-2501
Copy link
Contributor

@easwars , assigning it to you for second review.

@easwars
Copy link
Contributor

easwars commented Jan 29, 2026

@iamrajiv I'm sorry. I just realized that some of my comments are in direct contradiction to some of the previous comments made as part of the review process and now you are having to do double work.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 3, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@iamrajiv
Copy link
Author

iamrajiv commented Feb 3, 2026

No worries at all, @easwars! I appreciate the thorough review. The feedback to split into focused tests makes sense it's much cleaner and easier to debug now. Thanks for taking the time to review!

Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

Changes look good to me. Just a bunch of minor nits this time around.

@@ -0,0 +1,271 @@
/*
*
* Copyright 2025 gRPC authors.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This needs to 2026 now.

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()

client := testgrpc.NewTestServiceClient(cc)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Please consider defining a const wantErr = "cannot send secure credentials on an insecure connection". That way, the subsequent conditional statement and the error string will be shorter and easier to read.


client := testgrpc.NewTestServiceClient(cc)
_, err = client.EmptyCall(ctx, &testpb.Empty{}, grpc.PerRPCCredentials(jwtCreds))

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Nix this newline.

}
defer ss.Stop()

_, err = grpc.NewClient(ss.Address,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't break up lines this way. Please see the "Line length" section of the style guide: cannot send secure credentials on an insecure connection

This line is short enough to be on a single line. In other places where we have to pass a lot of dial options, we usually define a slice of dial options right before the call to NewClient and pass that slice to it.

grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithPerRPCCredentials(jwtCreds),
)

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Same here. Nix newline.

t.Fatalf("Failed to create client TLS credentials: %v", err)
}

cc, err := grpc.NewClient(ss.Address,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here too about being on a single line.

Copy link
Contributor

Choose a reason for hiding this comment

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

This file doesn't seem to have any code changes, but the file mode has been changed. Could you please revert the file mode changes. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an e2e style test to verify meaningful RPC error when using insecure transport creds with A97 JWT call creds

4 participants