@@ -18,7 +18,7 @@ import (
1818 "github.com/stretchr/testify/assert"
1919 "github.com/stretchr/testify/require"
2020
21- //fly "github.com/superfly/fly-go"
21+ // fly "github.com/superfly/fly-go"
2222
2323 "github.com/superfly/flyctl/test/preflight/testlib"
2424)
@@ -84,36 +84,11 @@ func TestFlyDeployHAPlacement(t *testing.T) {
8484 f := testlib .NewTestEnvFromEnv (t )
8585 appName := f .CreateRandomAppName ()
8686
87- // Create the app without deploying to avoid the Corrosion replication race
8887 f .Fly (
89- "launch --org %s --name %s --region %s --image nginx --internal-port 80 --no-deploy " ,
88+ "launch --org %s --name %s --region %s --image nginx --internal-port 80 --ha " ,
9089 f .OrgSlug (), appName , f .PrimaryRegion (),
9190 )
9291
93- // Retry the deploy command to handle Corrosion replication lag race conditions
94- // The backend may not have replicated the app record to all hosts yet when
95- // creating the second machine for HA, resulting in "sql: no rows in result set" errors
96- var lastError string
97- require .EventuallyWithT (t , func (c * assert.CollectT ) {
98- result := f .FlyAllowExitFailure ("deploy --buildkit --remote-only" )
99- if result .ExitCode () != 0 {
100- stderr := result .StdErrString ()
101- lastError = stderr
102- // Only retry if it's the known Corrosion replication lag error
103- if strings .Contains (stderr , "failed to get app: sql: no rows in result set" ) {
104- t .Logf ("Corrosion replication lag detected, retrying... (error: %s)" , stderr )
105- assert .Fail (c , "Corrosion replication lag, retrying..." )
106- } else {
107- // Log the unexpected error and fail without retrying
108- t .Logf ("Deploy failed with unexpected error (will not retry): %s" , stderr )
109- assert .Fail (c , fmt .Sprintf ("deploy failed with unexpected error: %s" , stderr ))
110- }
111- } else {
112- // Explicitly assert success so EventuallyWithT knows we passed
113- assert .True (c , true , "deploy succeeded" )
114- }
115- }, 30 * time .Second , 5 * time .Second , "deploy should succeed after Corrosion replication, last error: %s" , lastError )
116-
11792 assertHostDistribution (t , f , appName , 2 )
11893}
11994
@@ -241,35 +216,10 @@ func testDeployNodeAppWithRemoteBuilder(tt *testing.T) {
241216 require .NoError (t , err )
242217
243218 t .Logf ("deploy %s" , appName )
244- // Retry deploy to handle transient network errors (DNS, WireGuard, buildkit connection issues)
245- // BuildKit deployments can fail with various transient errors during the initial connection
246- var lastError string
247- require .EventuallyWithT (tt , func (c * assert.CollectT ) {
248- result := f .FlyAllowExitFailure ("deploy --buildkit --remote-only --ha=false" )
249- if result .ExitCode () != 0 {
250- stderr := result .StdErrString ()
251- lastError = stderr
252- t .Logf ("Deploy failed (will retry), error: %s" , stderr )
253- assert .Fail (c , "deploy failed, retrying..." )
254- } else {
255- assert .True (c , true , "deploy succeeded" )
256- }
257- }, 120 * time .Second , 10 * time .Second , "deploy should succeed after retries, last error: %s" , lastError )
219+ f .Fly ("deploy --remote-only --ha=false" )
258220
259221 t .Logf ("deploy %s again" , appName )
260- // Retry second deploy as well
261- lastError = ""
262- require .EventuallyWithT (tt , func (c * assert.CollectT ) {
263- result := f .FlyAllowExitFailure ("deploy --buildkit --remote-only --strategy immediate --ha=false" )
264- if result .ExitCode () != 0 {
265- stderr := result .StdErrString ()
266- lastError = stderr
267- t .Logf ("Deploy failed (will retry), error: %s" , stderr )
268- assert .Fail (c , "deploy failed, retrying..." )
269- } else {
270- assert .True (c , true , "deploy succeeded" )
271- }
272- }, 120 * time .Second , 10 * time .Second , "deploy should succeed after retries, last error: %s" , lastError )
222+ f .Fly ("deploy --remote-only --strategy immediate" )
273223
274224 body , err := testlib .RunHealthCheck (fmt .Sprintf ("https://%s.fly.dev" , appName ))
275225 require .NoError (t , err )
@@ -298,35 +248,10 @@ func testDeployNodeAppWithBuildKitRemoteBuilder(tt *testing.T) {
298248 require .NoError (t , err )
299249
300250 t .Logf ("deploy %s with BuildKit" , appName )
301- // Retry deploy to handle transient network errors (DNS, WireGuard, buildkit connection issues)
302- // BuildKit deployments can fail with various transient errors during the initial connection
303- var lastError string
304- require .EventuallyWithT (tt , func (c * assert.CollectT ) {
305- result := f .FlyAllowExitFailure ("deploy --buildkit --remote-only --ha=false" )
306- if result .ExitCode () != 0 {
307- stderr := result .StdErrString ()
308- lastError = stderr
309- t .Logf ("Deploy failed (will retry), error: %s" , stderr )
310- assert .Fail (c , "deploy failed, retrying..." )
311- } else {
312- assert .True (c , true , "deploy succeeded" )
313- }
314- }, 120 * time .Second , 10 * time .Second , "deploy should succeed after retries, last error: %s" , lastError )
251+ f .Fly ("deploy --buildkit --remote-only --ha=false" )
315252
316253 t .Logf ("deploy %s again with BuildKit" , appName )
317- // Retry second deploy as well
318- lastError = ""
319- require .EventuallyWithT (tt , func (c * assert.CollectT ) {
320- result := f .FlyAllowExitFailure ("deploy --buildkit --remote-only --strategy immediate --ha=false" )
321- if result .ExitCode () != 0 {
322- stderr := result .StdErrString ()
323- lastError = stderr
324- t .Logf ("Deploy failed (will retry), error: %s" , stderr )
325- assert .Fail (c , "deploy failed, retrying..." )
326- } else {
327- assert .True (c , true , "deploy succeeded" )
328- }
329- }, 120 * time .Second , 10 * time .Second , "deploy should succeed after retries, last error: %s" , lastError )
254+ f .Fly ("deploy --buildkit --remote-only --strategy immediate" )
330255
331256 body , err := testlib .RunHealthCheck (fmt .Sprintf ("https://%s.fly.dev" , appName ))
332257 require .NoError (t , err )
@@ -461,7 +386,7 @@ func TestDeployManifest(t *testing.T) {
461386 appName := f .CreateRandomAppName ()
462387 f .Fly ("launch --org %s --name %s --region %s --image nginx:latest --internal-port 80 --ha=false --strategy rolling" , f .OrgSlug (), appName , f .PrimaryRegion ())
463388
464- var manifestPath = filepath .Join (f .WorkDir (), "manifest.json" )
389+ manifestPath : = filepath .Join (f .WorkDir (), "manifest.json" )
465390
466391 f .Fly ("deploy --buildkit --remote-only --export-manifest %s" , manifestPath )
467392
0 commit comments