Skip to content

Commit 3dc4596

Browse files
author
Menno Smits
committed
featuretests: API error handling in upgrade logins
The call to FullStatus was always expected to work but would occasionally fail if the apiserver worker was in the middle of being restarted. Instead of failing immediately allow retries to continue. Fixes https://bugs.launchpad.net/juju/+bug/1619744
1 parent 6cf1bc9 commit 3dc4596

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

featuretests/upgrade_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"strings"
1111
"time"
1212

13+
"github.com/juju/errors"
1314
jc "github.com/juju/testing/checkers"
1415
"github.com/juju/utils"
1516
"github.com/juju/utils/arch"
@@ -338,13 +339,17 @@ func (s *upgradeSuite) attemptRestrictedAPIAsUser(c *gc.C, conf agent.Config) er
338339
}
339340
defer apiState.Close()
340341

341-
// this call should always work
342-
var result params.FullStatus
343-
err = apiState.APICall("Client", 1, "", "FullStatus", nil, &result)
344-
c.Assert(err, jc.ErrorIsNil)
342+
// This call should always work, but might fail if the apiserver
343+
// is restarting. If it fails just return the error so retries
344+
// can continue.
345+
err = apiState.APICall("Client", 1, "", "FullStatus", nil, new(params.FullStatus))
346+
if err != nil {
347+
return errors.Annotate(err, "FullStatus call")
348+
}
345349

346350
// this call should only work if API is not restricted
347-
return apiState.APICall("Client", 1, "", "WatchAll", nil, nil)
351+
err = apiState.APICall("Client", 1, "", "WatchAll", nil, nil)
352+
return errors.Annotate(err, "WatchAll call")
348353
}
349354

350355
var upgradeTestDialOpts = api.DialOpts{

0 commit comments

Comments
 (0)