Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bedrock contract tests. #855

Merged
merged 7 commits into from
Aug 16, 2024

Conversation

mxiamxia
Copy link
Member

@mxiamxia mxiamxia commented Jul 26, 2024

The PR is a follow up on bedrock service support PR:
#826

We add contract tests for following Bedrock services that covers all resource attributes we newly support:

  1. Bedrock API: GetGuardrail
  2. BedrockAgent APIs: GetAgent, GetDataSource, GetKnowledgeBase
  3. BedrockRuntime API: InvokeModel
  4. BedrockAgentRuntime API: InvokeAgent

Upgrade aws-java-sdk V1 and V2 to the latest version so that to support Bedrock services API calls.
Upgrade localstack/localstack image to the latest version 3.5.0 so resolve the SQS API call issue using localstack/localstack:2.0.1: localstack/localstack#9610
Add .withEnv("LOCALSTACK_HOST", "127.0.0.1") for LocalStackContainer to workaround the 3.X version limitation: localstack/localstack#9753

Contract test limitation:
The contract tests in current repo is using LocalStackContainer to serve AWS SDK service calls. But it doesn't has bedrock related service support (This is the full service list it support.). In this case, no matter which bedrock API we call in contract test, the response will always be 4XX.

As a workaround, we We point all Bedrock related request endpoints to the local app and then specifically handle each request to return the expected response to make sure we receive http response with expected status code and attributes.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mxiamxia mxiamxia requested a review from a team as a code owner July 26, 2024 06:00
@mxiamxia mxiamxia force-pushed the bedrock_contract_text branch from b124f15 to aa08642 Compare July 26, 2024 17:01
@mxiamxia mxiamxia force-pushed the bedrock_contract_text branch from aa08642 to e9d340d Compare July 26, 2024 17:11
Comment on lines 205 to 206
void testBedrockGetKnowlesgeBase() {
doTestBedrockGetKnowlesgeBase();
Copy link
Contributor

Choose a reason for hiding this comment

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

Not blocking:

Suggested change
void testBedrockGetKnowlesgeBase() {
doTestBedrockGetKnowlesgeBase();
void testBedrockGetKnowledgeBase() {
doTestBedrockGetKnowledgeBase();

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not blocking: Missed testBedrockAgentGetKnowlesgeBaseIdFromRequest

@thpierce
Copy link
Contributor

thpierce commented Aug 7, 2024

Is the overview up to date? It mentions changes that I don't see, like inject_200_success, inject_500_error, and _assert_semantic_conventions_span_attributes.

@zzhlogin
Copy link
Contributor

Is the overview up to date? It mentions changes that I don't see, like inject_200_success, inject_500_error, and _assert_semantic_conventions_span_attributes.

Seems like this is a rebased PR, and the PR description was not copied correctly. Updated the description from original PR.

Copy link
Member Author

@mxiamxia mxiamxia left a comment

Choose a reason for hiding this comment

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

the updates LGTM! ty!

@vasireddy99 vasireddy99 merged commit 5d211eb into aws-observability:main Aug 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants