Skip to content

Commit

Permalink
SetSiteSettingsPaths() has to be set after we've read the config, fixes
Browse files Browse the repository at this point in the history
 #1553 (#1554)

* SetSiteSettingsPaths() has to be set after we've read the config, fixes #1553

* Add test coverage for SiteSettingsPath and ddev_drush_settings
  • Loading branch information
rfay committed Apr 30, 2019
1 parent 97c660a commit 7b2fbab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/ddevapp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func NewApp(AppRoot string, includeOverrides bool, provider string) (*DdevApp, e
// Provide a default app name based on directory name
app.Name = filepath.Base(app.AppRoot)
app.OmitContainers = globalconfig.DdevGlobalConfig.OmitContainers
app.SetApptypeSettingsPaths()

// These should always default to the latest image/tag names from the Version package.
app.WebImage = version.GetWebImage()
Expand All @@ -101,6 +100,7 @@ func NewApp(AppRoot string, includeOverrides bool, provider string) (*DdevApp, e
return app, fmt.Errorf("%v exists but cannot be read. It may be invalid due to a syntax error.: %v", app.ConfigPath, err)
}
}
app.SetApptypeSettingsPaths()

// If the dbimage has not been overridden (because it takes precedence
// and the mariadb_version *has* been changed by config,
Expand Down
7 changes: 7 additions & 0 deletions pkg/ddevapp/ddevapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ddevapp_test
import (
"bufio"
"fmt"
"github.com/drud/ddev/pkg/nodeps"
"io/ioutil"
"net"
"net/url"
Expand Down Expand Up @@ -902,6 +903,12 @@ func TestDdevFullSiteSetup(t *testing.T) {

err = app.Start()
assert.NoError(err)
settingsLocation, err := app.DetermineSettingsPathLocation()
assert.NoError(err)
assert.Equal(filepath.Dir(settingsLocation), filepath.Dir(app.SiteSettingsPath))
if nodeps.ArrayContainsString([]string{"drupal6", "drupal7", "drupal8", "backdrop"}, app.Type) {
assert.FileExists(filepath.Join(filepath.Dir(app.SiteSettingsPath), "ddev_drush_settings.php"))
}

if site.DBTarURL != "" {
_, cachedArchive, err := testcommon.GetCachedArchive(site.Name, site.Name+"_siteTarArchive", "", site.DBTarURL)
Expand Down

0 comments on commit 7b2fbab

Please sign in to comment.