@@ -160,7 +160,9 @@ func DebugShell() Action {
160
160
func Exec (cmd string , args ... string ) Action {
161
161
return func (t testing.TB , ic TestContext ) {
162
162
Infof ("Executing (in %s): %s %s" , ic .workDir , cmd , shellquote .Join (args ... ))
163
- err := ftlexec .Command (ic , log .Debug , ic .workDir , cmd , args ... ).RunStderrError (ic )
163
+ command := ftlexec .Command (ic , log .Debug , ic .workDir , cmd , args ... )
164
+ command .Env = append (command .Env , "FTL_ENDPOINT=http://127.0.0.1:" + TestPort )
165
+ err := command .RunStderrError (ic )
164
166
assert .NoError (t , err )
165
167
}
166
168
}
@@ -170,6 +172,7 @@ func Exec(cmd string, args ...string) Action {
170
172
func ExecWithExpectedOutput (want string , cmd string , args ... string ) Action {
171
173
return func (t testing.TB , ic TestContext ) {
172
174
Infof ("Executing: %s %s" , cmd , shellquote .Join (args ... ))
175
+ t .Setenv ("FTL_ENDPOINT" , "http://127.0.0.1:" + TestPort )
173
176
output , err := ftlexec .Capture (ic , ic .workDir , cmd , args ... )
174
177
assert .NoError (t , err )
175
178
assert .Equal (t , output , []byte (want ))
@@ -181,6 +184,7 @@ func ExecWithExpectedOutput(want string, cmd string, args ...string) Action {
181
184
func ExecWithExpectedError (want string , cmd string , args ... string ) Action {
182
185
return func (t testing.TB , ic TestContext ) {
183
186
Infof ("Executing: %s %s" , cmd , shellquote .Join (args ... ))
187
+ t .Setenv ("FTL_ENDPOINT" , "http://127.0.0.1:" + TestPort )
184
188
output , err := ftlexec .Capture (ic , ic .workDir , cmd , args ... )
185
189
assert .Error (t , err )
186
190
assert .Contains (t , string (output ), want )
@@ -193,7 +197,7 @@ func ExecWithExpectedError(want string, cmd string, args ...string) Action {
193
197
func ExecWithOutput (cmd string , args []string , capture func (output string )) Action {
194
198
return func (t testing.TB , ic TestContext ) {
195
199
Infof ("Executing: %s %s" , cmd , shellquote .Join (args ... ))
196
- output , err := ftlexec .Capture (ic , ic .workDir , cmd , args ... )
200
+ output , err := ftlexec .CaptureWithEnv (ic , ic .workDir , cmd , [] string { "FTL_ENDPOINT=http://127.0.0.1:" + TestPort } , args ... )
197
201
assert .NoError (t , err , "%s" , string (output ))
198
202
capture (string (output ))
199
203
}
@@ -220,7 +224,7 @@ func ExpectError(action Action, expectedErrorMsg ...string) Action {
220
224
// Deploy a module from the working directory and wait for it to become available.
221
225
func Deploy (module string ) Action {
222
226
return Chain (
223
- Exec ("ftl" , "deploy" , module ),
227
+ Exec ("ftl" , "deploy" , "--endpoint" , "http://127.0.0.1:" + TestPort , module ),
224
228
Wait (module ),
225
229
)
226
230
}
@@ -521,7 +525,7 @@ func JsonData(t testing.TB, body interface{}) []byte {
521
525
func HttpCall (method string , path string , headers map [string ][]string , body []byte , onResponse func (t testing.TB , resp * HTTPResponse )) Action {
522
526
return func (t testing.TB , ic TestContext ) {
523
527
Infof ("HTTP %s %s" , method , path )
524
- baseURL , err := url .Parse (fmt .Sprintf ("http://localhost:8891" ))
528
+ baseURL , err := url .Parse (fmt .Sprintf ("http://localhost:" + TestIngressPort ))
525
529
assert .NoError (t , err )
526
530
527
531
u , err := baseURL .Parse (path )
0 commit comments