@@ -9,43 +9,19 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
99describe . skip ( 'add gateway-target command' , ( ) => {
1010 let testDir : string ;
1111 let projectDir : string ;
12- const agentName = 'TestAgent' ;
13- const gatewayName = 'test-gateway' ; // Used in skipped behind-gateway tests
12+ const gatewayName = 'test-gateway' ;
1413
1514 beforeAll ( async ( ) => {
1615 testDir = join ( tmpdir ( ) , `agentcore-add-gateway-target-${ randomUUID ( ) } ` ) ;
1716 await mkdir ( testDir , { recursive : true } ) ;
1817
19- // Create project with agent
18+ // Create project
2019 const projectName = 'GatewayTargetProj' ;
21- let result = await runCLI ( [ 'create' , '--name' , projectName , '--no-agent' ] , testDir ) ;
20+ const result = await runCLI ( [ 'create' , '--name' , projectName , '--no-agent' ] , testDir ) ;
2221 if ( result . exitCode !== 0 ) {
2322 throw new Error ( `Failed to create project: ${ result . stdout } ${ result . stderr } ` ) ;
2423 }
2524 projectDir = join ( testDir , projectName ) ;
26-
27- // Add agent for mcp-runtime tests
28- result = await runCLI (
29- [
30- 'add' ,
31- 'agent' ,
32- '--name' ,
33- agentName ,
34- '--language' ,
35- 'Python' ,
36- '--framework' ,
37- 'Strands' ,
38- '--model-provider' ,
39- 'Bedrock' ,
40- '--memory' ,
41- 'none' ,
42- '--json' ,
43- ] ,
44- projectDir
45- ) ;
46- if ( result . exitCode !== 0 ) {
47- throw new Error ( `Failed to create agent: ${ result . stdout } ${ result . stderr } ` ) ;
48- }
4925 } ) ;
5026
5127 afterAll ( async ( ) => {
@@ -61,32 +37,9 @@ describe.skip('add gateway-target command', () => {
6137 expect ( json . error . includes ( '--name' ) , `Error: ${ json . error } ` ) . toBeTruthy ( ) ;
6238 } ) ;
6339
64- it ( 'requires exposure flag' , async ( ) => {
65- const result = await runCLI (
66- [ 'add' , 'gateway-target' , '--name' , 'test' , '--language' , 'Python' , '--json' ] ,
67- projectDir
68- ) ;
69- expect ( result . exitCode ) . toBe ( 1 ) ;
70- const json = JSON . parse ( result . stdout ) ;
71- expect ( json . success ) . toBe ( false ) ;
72- expect ( json . error . includes ( '--exposure' ) , `Error: ${ json . error } ` ) . toBeTruthy ( ) ;
73- } ) ;
74-
7540 it ( 'validates language' , async ( ) => {
7641 const result = await runCLI (
77- [
78- 'add' ,
79- 'gateway-target' ,
80- '--name' ,
81- 'test' ,
82- '--language' ,
83- 'InvalidLang' ,
84- '--exposure' ,
85- 'mcp-runtime' ,
86- '--agents' ,
87- agentName ,
88- '--json' ,
89- ] ,
42+ [ 'add' , 'gateway-target' , '--name' , 'test' , '--language' , 'InvalidLang' , '--json' ] ,
9043 projectDir
9144 ) ;
9245 expect ( result . exitCode ) . toBe ( 1 ) ;
@@ -100,19 +53,7 @@ describe.skip('add gateway-target command', () => {
10053
10154 it ( 'accepts Other as valid language option' , async ( ) => {
10255 const result = await runCLI (
103- [
104- 'add' ,
105- 'gateway-target' ,
106- '--name' ,
107- 'container-tool' ,
108- '--language' ,
109- 'Other' ,
110- '--exposure' ,
111- 'mcp-runtime' ,
112- '--agents' ,
113- agentName ,
114- '--json' ,
115- ] ,
56+ [ 'add' , 'gateway-target' , '--name' , 'container-tool' , '--language' , 'Other' , '--json' ] ,
11657 projectDir
11758 ) ;
11859
@@ -127,79 +68,6 @@ describe.skip('add gateway-target command', () => {
12768 } ) ;
12869 } ) ;
12970
130- describe ( 'mcp-runtime' , ( ) => {
131- it ( 'creates mcp-runtime tool' , async ( ) => {
132- const toolName = `rttool${ Date . now ( ) } ` ;
133- const result = await runCLI (
134- [
135- 'add' ,
136- 'gateway-target' ,
137- '--name' ,
138- toolName ,
139- '--language' ,
140- 'Python' ,
141- '--exposure' ,
142- 'mcp-runtime' ,
143- '--agents' ,
144- agentName ,
145- '--json' ,
146- ] ,
147- projectDir
148- ) ;
149-
150- expect ( result . exitCode , `stdout: ${ result . stdout } , stderr: ${ result . stderr } ` ) . toBe ( 0 ) ;
151- const json = JSON . parse ( result . stdout ) ;
152- expect ( json . success ) . toBe ( true ) ;
153- expect ( json . toolName ) . toBe ( toolName ) ;
154-
155- // Verify in mcp.json
156- const mcpSpec = JSON . parse ( await readFile ( join ( projectDir , 'agentcore/mcp.json' ) , 'utf-8' ) ) ;
157- const tool = mcpSpec . mcpRuntimeTools ?. find ( ( t : { name : string } ) => t . name === toolName ) ;
158- expect ( tool , 'Tool should be in mcpRuntimeTools' ) . toBeTruthy ( ) ;
159-
160- // Verify agent has remote tool reference
161- const projectSpec = JSON . parse ( await readFile ( join ( projectDir , 'agentcore/agentcore.json' ) , 'utf-8' ) ) ;
162- const agent = projectSpec . agents . find ( ( a : { name : string } ) => a . name === agentName ) ;
163- const hasRef = agent ?. remoteTools ?. some ( ( rt : { mcpRuntimeName ?: string } ) => rt . mcpRuntimeName === toolName ) ;
164- expect ( hasRef , 'Agent should have remoteTools reference' ) . toBeTruthy ( ) ;
165- } ) ;
166-
167- it ( 'requires agents for mcp-runtime' , async ( ) => {
168- const result = await runCLI (
169- [ 'add' , 'gateway-target' , '--name' , 'no-agents' , '--language' , 'Python' , '--exposure' , 'mcp-runtime' , '--json' ] ,
170- projectDir
171- ) ;
172- expect ( result . exitCode ) . toBe ( 1 ) ;
173- const json = JSON . parse ( result . stdout ) ;
174- expect ( json . success ) . toBe ( false ) ;
175- expect ( json . error . includes ( '--agents' ) , `Error: ${ json . error } ` ) . toBeTruthy ( ) ;
176- } ) ;
177-
178- it ( 'returns clear error for Other language with mcp-runtime' , async ( ) => {
179- const result = await runCLI (
180- [
181- 'add' ,
182- 'gateway-target' ,
183- '--name' ,
184- 'runtime-container' ,
185- '--language' ,
186- 'Other' ,
187- '--exposure' ,
188- 'mcp-runtime' ,
189- '--agents' ,
190- agentName ,
191- '--json' ,
192- ] ,
193- projectDir
194- ) ;
195-
196- expect ( result . exitCode ) . toBe ( 1 ) ;
197- const json = JSON . parse ( result . stdout ) ;
198- expect ( json . success ) . toBe ( false ) ;
199- expect ( json . error . length > 0 , 'Should have error message' ) . toBeTruthy ( ) ;
200- } ) ;
201- } ) ;
202-
20371 // Gateway disabled - skip behind-gateway tests until gateway feature is enabled
20472 describe . skip ( 'behind-gateway' , ( ) => {
20573 it ( 'creates behind-gateway tool' , async ( ) => {
@@ -212,8 +80,6 @@ describe.skip('add gateway-target command', () => {
21280 toolName ,
21381 '--language' ,
21482 'Python' ,
215- '--exposure' ,
216- 'behind-gateway' ,
21783 '--gateway' ,
21884 gatewayName ,
21985 '--host' ,
@@ -237,19 +103,7 @@ describe.skip('add gateway-target command', () => {
237103
238104 it ( 'requires gateway for behind-gateway' , async ( ) => {
239105 const result = await runCLI (
240- [
241- 'add' ,
242- 'gateway-target' ,
243- '--name' ,
244- 'no-gw' ,
245- '--language' ,
246- 'Python' ,
247- '--exposure' ,
248- 'behind-gateway' ,
249- '--host' ,
250- 'Lambda' ,
251- '--json' ,
252- ] ,
106+ [ 'add' , 'gateway-target' , '--name' , 'no-gw' , '--language' , 'Python' , '--host' , 'Lambda' , '--json' ] ,
253107 projectDir
254108 ) ;
255109 expect ( result . exitCode ) . toBe ( 1 ) ;
@@ -260,19 +114,7 @@ describe.skip('add gateway-target command', () => {
260114
261115 it ( 'requires host for behind-gateway' , async ( ) => {
262116 const result = await runCLI (
263- [
264- 'add' ,
265- 'gateway-target' ,
266- '--name' ,
267- 'no-host' ,
268- '--language' ,
269- 'Python' ,
270- '--exposure' ,
271- 'behind-gateway' ,
272- '--gateway' ,
273- gatewayName ,
274- '--json' ,
275- ] ,
117+ [ 'add' , 'gateway-target' , '--name' , 'no-host' , '--language' , 'Python' , '--gateway' , gatewayName , '--json' ] ,
276118 projectDir
277119 ) ;
278120 expect ( result . exitCode ) . toBe ( 1 ) ;
@@ -290,8 +132,6 @@ describe.skip('add gateway-target command', () => {
290132 'gateway-container' ,
291133 '--language' ,
292134 'Other' ,
293- '--exposure' ,
294- 'behind-gateway' ,
295135 '--gateway' ,
296136 gatewayName ,
297137 '--host' ,
0 commit comments