Commit 67b24f3
committed
test: fix generation/conversation e2e (model id -> mistral plain FM, error/null guards)
Two Gen2-cdk e2e suites (generation, conversation) were failing for
reasons unrelated to product code. This change fixes the test fixtures
and adds fail-fast hygiene guards. Test-side only; no product behavior
changes.
Model ids
The fixtures invoked anthropic.claude-3-haiku-20240307-v1:0, a legacy
Bedrock model that has been auto-revoked in the e2e account; invoking
it returned ResourceNotFoundException, AppSync resolved null, and the
tests crashed on a null-deref.
- generation: the @generation transformer's AppSync->Bedrock IAM role
grants bedrock:InvokeModel only on the foundation-model ARN, so a
cross-region inference profile fails with AccessDenied. The
generation fixture is switched to the active on-demand foundation
model mistral.mistral-large-2407-v1:0, which the e2e account can
invoke under the existing IAM and which satisfies the basic
text/scalar assertions.
- conversation: routes via @aws-amplify/ai-constructs, which handles
inference-profile IAM, so the conversation fixture uses the active
inference profile us.anthropic.claude-haiku-4-5-20251001-v1:0.
Fail-fast guards
generation.test.ts: assert the GraphQL response has no errors and that
the generated recipe is not null before dereferencing, so a
Bedrock/GraphQL error is printed instead of a TypeError.
conversation.test.ts: replace the ineffective toBeDefined() check on
the stream part with not.toBeNull(), guard the .length read when the
part is null, and add a max-iteration / overall-timeout guard inside
the subscription for-await loop so a non-streaming assistant fails
fast with a descriptive message instead of cascading into the jest
timeout.
---
Prompt: Split the mixed e2e/CI branch into a clean draft PR off main
containing only the generation/conversation e2e test fixes: switch the
dead legacy claude-3-haiku model id to a working model (generation ->
mistral plain on-demand FM, conversation -> working inference profile)
and add the error/null fail-fast guards. tsc the construct-tests
package and commit (no --no-verify).1 parent 9a2c742 commit 67b24f3
4 files changed
Lines changed: 30 additions & 8 deletions
File tree
- packages/amplify-graphql-api-construct-tests/src/__tests__
- conversations
- graphql
- generations
- graphql
Lines changed: 24 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
117 | 135 | | |
118 | | - | |
119 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
120 | 140 | | |
121 | | - | |
| 141 | + | |
122 | 142 | | |
123 | 143 | | |
124 | 144 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
0 commit comments