From ef109ed9a9d33713d14e9e42aea171948e6668b5 Mon Sep 17 00:00:00 2001 From: Bill Sager Date: Thu, 16 Jan 2025 13:59:28 -0800 Subject: [PATCH] eliminate override flag, explicitly take and release ownership, add comments, update tests --- internal/deployment/deployment.go | 25 +++++--- .../deployment/deployment_owner_registry.go | 14 +++- .../deployment_owner_registry_test.go | 33 ++++++++++ internal/deployment/deployment_test.go | 64 ++++++++----------- internal/publish/bundle.go | 2 +- internal/publish/publish.go | 10 +-- .../services/api/delete_deployment_test.go | 2 +- .../services/api/get_deployment_env_test.go | 8 +-- internal/services/api/get_deployment_test.go | 2 +- internal/services/api/get_deployments_test.go | 4 +- internal/services/api/patch_deployment.go | 4 +- .../services/api/patch_deployment_test.go | 8 +-- internal/services/api/post_deployment.go | 8 +++ .../api/post_deployment_cancel_test.go | 8 ++- internal/services/api/post_deployment_test.go | 2 +- internal/services/api/post_deployments.go | 2 +- internal/state/state_test.go | 4 +- 17 files changed, 127 insertions(+), 73 deletions(-) diff --git a/internal/deployment/deployment.go b/internal/deployment/deployment.go index 1ab763976..9bf327696 100644 --- a/internal/deployment/deployment.go +++ b/internal/deployment/deployment.go @@ -142,19 +142,20 @@ func (d *Deployment) Write(w io.Writer) error { return enc.Encode(d) } +// When being called from methods active during a deployment, they will be running within a +// go function with a state which includes a localID. By supplying it when calling this method, +// they protect the deployment file from being updated by any methods active but not current. +// +// NOTE: deployment threads currently run to completion, so when a user "dismisses" a deployment +// the go functions continue to want to update the record (even though they might be "old" news) func (d *Deployment) WriteFile( path util.AbsolutePath, - localId string, - setOwnership bool, + localIdIfDeploying string, log logging.Logger, ) (*Deployment, error) { - log.Debug("Attempting to update deployment record", "path", path, "localId", localId, "setOwnership", setOwnership) + log.Debug("Attempting to update deployment record", "path", path, "localIdIfDeploying", localIdIfDeploying) - if setOwnership { - // Establish ownership of a deployment record, as is done at beginning - // of each publishing run. - ActiveDeploymentRegistry.Set(path.String(), localId) - } else { + if localIdIfDeploying != "" { // we will only update the deployment record, if the local id passed in // owns the record (as determined by the ActiveDeploymentRegistry) // matches (which confirms the ownership of the record vs. another deployment thread) @@ -168,7 +169,7 @@ func (d *Deployment) WriteFile( } } if existingDeployment != nil { - if !ActiveDeploymentRegistry.Check(path.String(), localId) { + if !ActiveDeploymentRegistry.Check(path.String(), localIdIfDeploying) { log.Debug("Skipping deployment record update since existing record is being updated by another thread.") return existingDeployment, nil } @@ -177,7 +178,13 @@ func (d *Deployment) WriteFile( return existingDeployment, nil } } + } else { + // Protect against overlaps of deployment thread updates and user initiated updates + // (which pass in no value for localIdIfDeploying + ActiveDeploymentRegistry.Lock() + defer ActiveDeploymentRegistry.Unlock() } + log.Debug("Updating deployment record", "path", path) err := path.Dir().MkdirAll(0777) diff --git a/internal/deployment/deployment_owner_registry.go b/internal/deployment/deployment_owner_registry.go index 0680af5d4..9f2eebdc3 100644 --- a/internal/deployment/deployment_owner_registry.go +++ b/internal/deployment/deployment_owner_registry.go @@ -16,7 +16,9 @@ func (o *DeploymentOwnerRegistry) Set(deploymentPath string, localId string) { o.Lock() defer o.Unlock() - o.m[deploymentPath] = localId + if localId != "" { + o.m[deploymentPath] = localId + } } func (o *DeploymentOwnerRegistry) Check(deploymentPath string, localId string) bool { @@ -27,6 +29,16 @@ func (o *DeploymentOwnerRegistry) Check(deploymentPath string, localId string) b return owner == localId } +func (o *DeploymentOwnerRegistry) Clear(deploymentPath string, localId string) { + o.Lock() + defer o.Unlock() + + owner := o.m[deploymentPath] + if owner == localId { + delete(o.m, deploymentPath) + } +} + func (o *DeploymentOwnerRegistry) Reset() { o.Lock() defer o.Unlock() diff --git a/internal/deployment/deployment_owner_registry_test.go b/internal/deployment/deployment_owner_registry_test.go index 4b60851af..a0d6f4c1e 100644 --- a/internal/deployment/deployment_owner_registry_test.go +++ b/internal/deployment/deployment_owner_registry_test.go @@ -18,13 +18,30 @@ func TestDeploymentOwnerMapSuite(t *testing.T) { } func (s *DeploymentOwnerMapSuite) SetupTest() { + ActiveDeploymentRegistry.Reset() +} + +func (s *DeploymentOwnerMapSuite) TestReset() { + s.Equal(0, len(ActiveDeploymentRegistry.m)) + + ActiveDeploymentRegistry.Set("abc/def", "123") + ActiveDeploymentRegistry.Set("abc/def2", "124") + ActiveDeploymentRegistry.Set("abc/def3", "125") + s.Equal(3, len(ActiveDeploymentRegistry.m)) + + ActiveDeploymentRegistry.Reset() + s.Equal(0, len(ActiveDeploymentRegistry.m)) } func (s *DeploymentOwnerMapSuite) TestSet() { + ActiveDeploymentRegistry.Set("abc/def", "") + s.Equal(0, len(ActiveDeploymentRegistry.m)) + ActiveDeploymentRegistry.Set("abc/def", "123") ActiveDeploymentRegistry.Set("abc/def2", "124") ActiveDeploymentRegistry.Set("abc/def3", "125") s.Equal(true, ActiveDeploymentRegistry.Check("abc/def", "123")) + } func (s *DeploymentOwnerMapSuite) TestCheckAndSet() { @@ -36,3 +53,19 @@ func (s *DeploymentOwnerMapSuite) TestCheckAndSet() { // non-existing s.Equal(false, ActiveDeploymentRegistry.Check("xyz", "789")) } + +func (s *DeploymentOwnerMapSuite) TestClear() { + ActiveDeploymentRegistry.Set("abc/def", "123") + ActiveDeploymentRegistry.Set("abc/def2", "124") + ActiveDeploymentRegistry.Set("abc/def3", "125") + s.Equal(3, len(ActiveDeploymentRegistry.m)) + + // Valid request w/ local ID match + ActiveDeploymentRegistry.Clear("abc/def", "123") + s.Equal(2, len(ActiveDeploymentRegistry.m)) + + // Ignored request w/ non match + ActiveDeploymentRegistry.Clear("abc/def3", "999") + // still should be same number as before the operation + s.Equal(2, len(ActiveDeploymentRegistry.m)) +} diff --git a/internal/deployment/deployment_test.go b/internal/deployment/deployment_test.go index 6949af39c..16bf63602 100644 --- a/internal/deployment/deployment_test.go +++ b/internal/deployment/deployment_test.go @@ -51,7 +51,7 @@ func (s *DeploymentSuite) createDeploymentFile(name string) *Deployment { Version: "3.4.5", PackageManager: "pip", } - _, err := d.WriteFile(path, "abc", false, s.log) + _, err := d.WriteFile(path, "abc", s.log) s.NoError(err) return d } @@ -113,7 +113,7 @@ func (s *DeploymentSuite) TestFromFileErr() { func (s *DeploymentSuite) TestWriteFile() { deploymentFile := GetDeploymentPath(s.cwd, "myTargetName") d := New() - _, err := d.WriteFile(deploymentFile, "", false, s.log) + _, err := d.WriteFile(deploymentFile, "", s.log) s.NoError(err) content, err := deploymentFile.ReadFile() @@ -145,70 +145,58 @@ func (s *DeploymentSuite) TestWriteFile() { func (s *DeploymentSuite) TestWriteFileOptions() { type testOptions struct { - existingLocalID string + owningLocalID string updateLocalID string existingDismissed string - override bool expectedSuccess bool } + // Need to rethink... tests := [...]testOptions{ + // Non deployment thread test cases + // ownership take-over w/o dismissal { - existingLocalID: "123", - updateLocalID: "123", + owningLocalID: "123", + updateLocalID: "", existingDismissed: "", - override: false, expectedSuccess: true, }, + // ownership take-over w/ dismissal { - existingLocalID: "123", - updateLocalID: "123", + owningLocalID: "123", + updateLocalID: "", existingDismissed: "2025-01-08T17:10:22-08:00", - override: false, - expectedSuccess: false, + expectedSuccess: true, }, + // deployment in progress take-over tests + // ownership match w/ no dismissal { - existingLocalID: "123", + owningLocalID: "123", updateLocalID: "123", existingDismissed: "", - override: true, expectedSuccess: true, }, + // ownership match w/ dismissal { - existingLocalID: "123", + owningLocalID: "123", updateLocalID: "123", existingDismissed: "2025-01-08T17:10:22-08:00", - override: true, - expectedSuccess: true, + expectedSuccess: false, }, + // ownership mismatch w/o dismissal { - existingLocalID: "123", + owningLocalID: "123", updateLocalID: "456", existingDismissed: "", - override: false, expectedSuccess: false, }, + // ownership mismatch w/ dismissal { - existingLocalID: "123", + owningLocalID: "123", updateLocalID: "456", existingDismissed: "2025-01-08T17:10:22-08:00", - override: false, expectedSuccess: false, }, - { - existingLocalID: "123", - updateLocalID: "456", - existingDismissed: "", - override: true, - expectedSuccess: true, - }, - { - existingLocalID: "123", - updateLocalID: "456", - existingDismissed: "2025-01-08T17:10:22-08:00", - override: true, - expectedSuccess: true, - }, } for ndx, test := range tests { @@ -219,9 +207,9 @@ func (s *DeploymentSuite) TestWriteFileOptions() { deploymentFile := GetDeploymentPath(s.cwd, "myTargetName") d := New() d.ConfigName = "original" // Tests use this field to detect changes in file on disk - ActiveDeploymentRegistry.Set(deploymentFile.String(), test.existingLocalID) + ActiveDeploymentRegistry.Set(deploymentFile.String(), test.owningLocalID) d.DismissedAt = test.existingDismissed - returnedD, err := d.WriteFile(deploymentFile, test.existingLocalID, false, s.log) + returnedD, err := d.WriteFile(deploymentFile, test.owningLocalID, s.log) s.NoError(err) s.Equal("original", returnedD.ConfigName, "Failed iteration %d of test (location 1)", i) @@ -232,7 +220,7 @@ func (s *DeploymentSuite) TestWriteFileOptions() { // try and update it origD.ConfigName = "updated" - returnedD, err = origD.WriteFile(deploymentFile, test.updateLocalID, test.override, s.log) + returnedD, err = origD.WriteFile(deploymentFile, test.updateLocalID, s.log) s.NoError(err) if test.expectedSuccess { s.Equal("updated", returnedD.ConfigName, "Failed iteration %d of test (location 3)", i) @@ -256,7 +244,7 @@ func (s *DeploymentSuite) TestWriteFileErr() { readonlyFs := afero.NewReadOnlyFs(deploymentFile.Fs()) readonlyFile := deploymentFile.WithFs(readonlyFs) deployment := New() - _, err := deployment.WriteFile(readonlyFile, "", false, s.log) + _, err := deployment.WriteFile(readonlyFile, "", s.log) s.NotNil(err) } diff --git a/internal/publish/bundle.go b/internal/publish/bundle.go index 9115d14db..c5be789cb 100644 --- a/internal/publish/bundle.go +++ b/internal/publish/bundle.go @@ -106,7 +106,7 @@ func (p *defaultPublisher) createAndUploadBundle( p.Target.Renv = lockfile } - _, err = p.writeDeploymentRecord(false) + _, err = p.writeDeploymentRecord() if err != nil { return "", err } diff --git a/internal/publish/publish.go b/internal/publish/publish.go index 7fefdc4f8..229aecbde 100644 --- a/internal/publish/publish.go +++ b/internal/publish/publish.go @@ -134,7 +134,7 @@ func (p *defaultPublisher) emitErrorEvents(err error) { // Record the error in the deployment record if p.Target != nil { p.Target.Error = agentErr - _, writeErr := p.writeDeploymentRecord(false) + _, writeErr := p.writeDeploymentRecord() if writeErr != nil { p.log.Warn("failed to write updated deployment record", "name", p.TargetName, "err", writeErr) } @@ -201,7 +201,7 @@ func (p *defaultPublisher) PublishDirectory() error { return err } -func (p *defaultPublisher) writeDeploymentRecord(setOwnership bool) (*deployment.Deployment, error) { +func (p *defaultPublisher) writeDeploymentRecord() (*deployment.Deployment, error) { if p.SaveName == "" { // Redeployment p.log.Debug("No SaveName found while redeploying.", "deployment", p.TargetName) @@ -219,7 +219,7 @@ func (p *defaultPublisher) writeDeploymentRecord(setOwnership bool) (*deployment recordPath := deployment.GetDeploymentPath(p.Dir, p.SaveName) - return p.Target.WriteFile(recordPath, string(p.State.LocalID), setOwnership, p.log) + return p.Target.WriteFile(recordPath, string(p.State.LocalID), p.log) } func CancelDeployment( @@ -240,7 +240,7 @@ func CancelDeployment( target.DismissedAt = time.Now().Format(time.RFC3339) // Possibly update the deployment file - d, err := target.WriteFile(deploymentPath, localID, false, log) + d, err := target.WriteFile(deploymentPath, localID, log) return d, err } @@ -292,7 +292,7 @@ func (p *defaultPublisher) createDeploymentRecord( // localID to be recorded into the deployment record file, which // then keeps old threads from updating the file for previous // publishing attempts - _, err := p.writeDeploymentRecord(true) + _, err := p.writeDeploymentRecord() return err } diff --git a/internal/services/api/delete_deployment_test.go b/internal/services/api/delete_deployment_test.go index 62b35151f..1171936a4 100644 --- a/internal/services/api/delete_deployment_test.go +++ b/internal/services/api/delete_deployment_test.go @@ -60,7 +60,7 @@ func createSampleDeployment(root util.AbsolutePath, name string) (*deployment.De d.DashboardURL = "/connect/#/apps/12345678" d.DirectURL = "/content/12345678/" d.LogsURL = "/connect/#/apps/12345678/logs" - _, err := d.WriteFile(path, "", false, logging.New()) + _, err := d.WriteFile(path, "", logging.New()) return d, err } diff --git a/internal/services/api/get_deployment_env_test.go b/internal/services/api/get_deployment_env_test.go index d22a16953..074029361 100644 --- a/internal/services/api/get_deployment_env_test.go +++ b/internal/services/api/get_deployment_env_test.go @@ -54,7 +54,7 @@ func (s *GetDeploymentEnvSuite) TestGetDeploymentEnv() { d := deployment.New() d.ID = "123" d.ServerURL = "https://connect.example.com" - d.WriteFile(path, "", false, s.log) + d.WriteFile(path, "", s.log) lister := &accounts.MockAccountList{} acct := &accounts.Account{ @@ -120,7 +120,7 @@ func (s *GetDeploymentEnvSuite) TestGetDeploymentEnvFileError() { func (s *GetDeploymentEnvSuite) TestGetDeploymentEnvDeploymentNotDeployed() { path := deployment.GetDeploymentPath(s.cwd, "dep") d := deployment.New() - d.WriteFile(path, "", false, s.log) + d.WriteFile(path, "", s.log) h := GetDeploymentEnvironmentHandlerFunc(s.cwd, s.log, &accounts.MockAccountList{}) @@ -140,7 +140,7 @@ func (s *GetDeploymentEnvSuite) TestGetDeploymentEnvNoCredential() { d := deployment.New() d.ID = "123" d.ServerURL = "https://connect.example.com" - d.WriteFile(path, "", false, s.log) + d.WriteFile(path, "", s.log) lister := &accounts.MockAccountList{} lister.On("GetAccountByServerURL", "https://connect.example.com").Return(nil, errors.New("no such account")) @@ -163,7 +163,7 @@ func (s *GetDeploymentEnvSuite) TestGetDeploymentEnvPassesStatusFromServer() { d := deployment.New() d.ID = "123" d.ServerURL = "https://connect.example.com" - d.WriteFile(path, "", false, s.log) + d.WriteFile(path, "", s.log) lister := &accounts.MockAccountList{} acct := &accounts.Account{ diff --git a/internal/services/api/get_deployment_test.go b/internal/services/api/get_deployment_test.go index ee3beb771..55697e55c 100644 --- a/internal/services/api/get_deployment_test.go +++ b/internal/services/api/get_deployment_test.go @@ -119,7 +119,7 @@ func (s *GetDeploymentSuite) TestGetPreDeployment() { d.ServerType = accounts.ServerTypeConnect testError := errors.New("test error") d.Error = types.AsAgentError(testError) - _, err := d.WriteFile(path, "", false, s.log) + _, err := d.WriteFile(path, "", s.log) s.NoError(err) h := GetDeploymentHandlerFunc(s.cwd, s.log) diff --git a/internal/services/api/get_deployments_test.go b/internal/services/api/get_deployments_test.go index b5abb476c..b99c2bcfb 100644 --- a/internal/services/api/get_deployments_test.go +++ b/internal/services/api/get_deployments_test.go @@ -178,7 +178,7 @@ func createAlternateDeployment(root util.AbsolutePath, name string) (*deployment cfg.Type = config.ContentTypeHTML cfg.Entrypoint = "index.html" d.Configuration = cfg - _, err := d.WriteFile(path, "", false, logging.New()) + _, err := d.WriteFile(path, "", logging.New()) return d, err } @@ -232,7 +232,7 @@ func (s *GetDeploymentsSuite) makeSubdirDeployment(name string, subdir string) ( d.DashboardURL = "/connect/#/apps/abc123" d.DirectURL = "/content/abc123/" d.LogsURL = "/connect/#/apps/abc123/logs" - _, err = d.WriteFile(path, "", false, s.log) + _, err = d.WriteFile(path, "", s.log) return d, err } diff --git a/internal/services/api/patch_deployment.go b/internal/services/api/patch_deployment.go index 6d97034cb..e8003edeb 100644 --- a/internal/services/api/patch_deployment.go +++ b/internal/services/api/patch_deployment.go @@ -86,7 +86,9 @@ func PatchDeploymentHandlerFunc( d.DirectURL = util.GetDirectURL(d.ServerURL, b.ID) } - latest, err := d.WriteFile(path, "", true, log) + // Not operating within a deployment thread, so we'll use an empty string + // for the localIdIfDeploying + latest, err := d.WriteFile(path, "", log) if err != nil { InternalError(w, req, log, err) return diff --git a/internal/services/api/patch_deployment_test.go b/internal/services/api/patch_deployment_test.go index c16c8308f..141d9054a 100644 --- a/internal/services/api/patch_deployment_test.go +++ b/internal/services/api/patch_deployment_test.go @@ -50,7 +50,7 @@ func (s *PatchDeploymentHandlerFuncSuite) TestPatchDeploymentHandlerFuncWithConf path := deployment.GetDeploymentPath(s.cwd, "myTargetName") d := deployment.New() - _, err = d.WriteFile(path, "", false, s.log) + _, err = d.WriteFile(path, "", s.log) s.NoError(err) cfg := config.New() @@ -79,7 +79,7 @@ func (s *PatchDeploymentHandlerFuncSuite) TestPatchDeploymentHandlerFuncWithID() path := deployment.GetDeploymentPath(s.cwd, "myTargetName") d := deployment.New() - _, err = d.WriteFile(path, "", false, s.log) + _, err = d.WriteFile(path, "", s.log) s.NoError(err) cfg := config.New() @@ -141,7 +141,7 @@ func (s *PatchDeploymentHandlerFuncSuite) TestPatchDeploymentHandlerConfigNotFou d := deployment.New() - _, err = d.WriteFile(deployment.GetDeploymentPath(s.cwd, "myTargetName"), "", false, s.log) + _, err = d.WriteFile(deployment.GetDeploymentPath(s.cwd, "myTargetName"), "", s.log) s.NoError(err) req.Body = io.NopCloser(strings.NewReader(`{"configurationName": "myConfig"}`)) @@ -190,7 +190,7 @@ func (s *PatchDeploymentHandlerFuncSuite) TestPatchDeploymentSubdir() { path := deployment.GetDeploymentPath(s.cwd, "myTargetName") d := deployment.New() - _, err = d.WriteFile(path, "", false, s.log) + _, err = d.WriteFile(path, "", s.log) s.NoError(err) cfg := config.New() diff --git a/internal/services/api/post_deployment.go b/internal/services/api/post_deployment.go index 72a2ec73c..8fbaafa84 100644 --- a/internal/services/api/post_deployment.go +++ b/internal/services/api/post_deployment.go @@ -10,6 +10,7 @@ import ( "github.com/gorilla/mux" "github.com/posit-dev/publisher/internal/accounts" "github.com/posit-dev/publisher/internal/config" + "github.com/posit-dev/publisher/internal/deployment" "github.com/posit-dev/publisher/internal/events" "github.com/posit-dev/publisher/internal/logging" "github.com/posit-dev/publisher/internal/publish" @@ -115,6 +116,7 @@ func PostDeploymentHandlerFunc( log := log.WithArgs("local_id", localID) newState.LocalID = localID + rExecutable := util.NewPath(b.R, nil) publisher, err := publisherFactory(newState, rExecutable, emitter, log) log.Debug("New publisher derived from state", "account", b.AccountName, "config", b.ConfigName) @@ -124,6 +126,12 @@ func PostDeploymentHandlerFunc( } go func() { + // take ownership of this deployment when we start, release when we are done. + // release will first check to make sure we still have ownership before releasing + // someone else's ownership + deployment.ActiveDeploymentRegistry.Set(newState.SaveName, string(newState.LocalID)) + defer deployment.ActiveDeploymentRegistry.Clear(newState.SaveName, string(newState.LocalID)) + err = publisher.PublishDirectory() if err != nil { log.Error("Deployment failed", "error", err.Error()) diff --git a/internal/services/api/post_deployment_cancel_test.go b/internal/services/api/post_deployment_cancel_test.go index 160f604ad..2ca0e593b 100644 --- a/internal/services/api/post_deployment_cancel_test.go +++ b/internal/services/api/post_deployment_cancel_test.go @@ -45,8 +45,10 @@ func (s *PostDeploymentCancelTestSuite) Test200WithLocalIDMatch() { localId := "abc" d := deployment.New() + path := deployment.GetDeploymentPath(s.cwd, deploymentName) + deployment.ActiveDeploymentRegistry.Set(path.String(), localId) - _, err := d.WriteFile(deployment.GetDeploymentPath(s.cwd, deploymentName), "abc", true, s.log) + _, err := d.WriteFile(path, "abc", s.log) s.NoError(err) h := PostDeploymentCancelHandlerFunc(s.cwd, s.log) @@ -75,8 +77,10 @@ func (s *PostDeploymentCancelTestSuite) Test200WithoutLocalIDMatch() { deploymentName := "newDeployment" d := deployment.New() + path := deployment.GetDeploymentPath(s.cwd, deploymentName) + deployment.ActiveDeploymentRegistry.Set(path.String(), "abc") - _, err := d.WriteFile(deployment.GetDeploymentPath(s.cwd, deploymentName), "abc", true, s.log) + _, err := d.WriteFile(path, "abc", s.log) s.NoError(err) h := PostDeploymentCancelHandlerFunc(s.cwd, s.log) diff --git a/internal/services/api/post_deployment_test.go b/internal/services/api/post_deployment_test.go index 577e54729..3fdbe69f7 100644 --- a/internal/services/api/post_deployment_test.go +++ b/internal/services/api/post_deployment_test.go @@ -158,7 +158,7 @@ func (s *PostDeploymentHandlerFuncSuite) TestPostDeploymentHandlerFuncWrongServe d := deployment.New() d.ServerURL = originalAcct.URL - _, err = d.WriteFile(deployment.GetDeploymentPath(s.cwd, deploymentName), "", false, s.log) + _, err = d.WriteFile(deployment.GetDeploymentPath(s.cwd, deploymentName), "", s.log) s.NoError(err) cfg := config.New() diff --git a/internal/services/api/post_deployments.go b/internal/services/api/post_deployments.go index b394a1aa4..c682fe5ae 100644 --- a/internal/services/api/post_deployments.go +++ b/internal/services/api/post_deployments.go @@ -101,7 +101,7 @@ func PostDeploymentsHandlerFunc( } log.Debug("Writing deployment file", "path", path.String()) - latest, err := d.WriteFile(path, "", true, log) + latest, err := d.WriteFile(path, "", log) if err != nil { InternalError(w, req, log, err) return diff --git a/internal/state/state_test.go b/internal/state/state_test.go index 1d087eb32..794762971 100644 --- a/internal/state/state_test.go +++ b/internal/state/state_test.go @@ -378,7 +378,7 @@ func (s *StateSuite) TestNewWithTarget() { d.ConfigName = "savedConfigName" d.ServerURL = "https://saved.server.example.com" d.Configuration = cfg - _, err := d.WriteFile(targetPath, "", false, s.log) + _, err := d.WriteFile(targetPath, "", s.log) s.NoError(err) state, err := New(s.cwd, "", "", "myTargetName", "", accts, nil, false) @@ -419,7 +419,7 @@ func (s *StateSuite) TestNewWithTargetAndAccount() { d.ConfigName = "savedConfigName" d.ServerURL = "https://saved.server.example.com" d.Configuration = cfg - _, err := d.WriteFile(targetPath, "", false, s.log) + _, err := d.WriteFile(targetPath, "", s.log) s.NoError(err) state, err := New(s.cwd, "acct2", "", "myTargetName", "mySaveName", accts, nil, false)