Skip to content

Commit

Permalink
test: fix broken tests, for ddev#5813 (ddev#6232)
Browse files Browse the repository at this point in the history
  • Loading branch information
stasadev authored May 24, 2024
1 parent 5b0e640 commit 70fc4cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/ddev/cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,10 @@ func TestConfigGitignore(t *testing.T) {
out = strings.ReplaceAll(out, "new file: .ddev/config.yaml", "")
assert.NotContains(out, "new file:")

_, err = exec.RunHostCommand("bash", "-c", fmt.Sprintf(`touch "/%s" "/%s"`, filepath.Join(globalDdevDir, "commands", "web", t.Name()), filepath.Join(globalDdevDir, "homeadditions", t.Name())))
_, err = exec.RunHostCommand("bash", "-c", fmt.Sprintf(`touch "%s" "%s"`, filepath.Join(globalDdevDir, "commands", "web", t.Name()), filepath.Join(globalDdevDir, "homeadditions", t.Name())))
assert.NoError(err)
if err != nil {
out, err = exec.RunHostCommand("bash", "-c", fmt.Sprintf(`ls -l "/%s" && ls -lR "/%s" "/%s"`, globalDdevDir, filepath.Join(globalDdevDir, "commands"), filepath.Join(globalDdevDir, "homeadditions")))
out, err = exec.RunHostCommand("bash", "-c", fmt.Sprintf(`ls -l "%s" && ls -lR "%s" "%s"`, globalDdevDir, filepath.Join(globalDdevDir, "commands"), filepath.Join(globalDdevDir, "homeadditions")))
assert.NoError(err)
t.Logf("Contents of global .ddev: \n=====\n%s\n====", out)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/dockerutil/docker_compose_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ func TestDockerComposeDownload(t *testing.T) {
DdevBin = os.Getenv("DDEV_BINARY_FULLPATH")
}

_, err = dockerutil.DownloadDockerComposeIfNeeded()
require.NoError(t, err)

tmpXdgConfigHomeDir := testcommon.CopyGlobalDdevDir(t)

t.Cleanup(func() {
Expand Down
5 changes: 2 additions & 3 deletions pkg/testcommon/testcommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,7 @@ func ResetGlobalDdevDir(t *testing.T, tmpXdgConfigHomeDir string) {
// After the $XDG_CONFIG_HOME directory is removed,
// globalconfig.GetGlobalDdevDir() should point to ~/.ddev
t.Setenv("XDG_CONFIG_HOME", "")
err := os.RemoveAll(tmpXdgConfigHomeDir)
require.NoError(t, err)
_ = os.RemoveAll(tmpXdgConfigHomeDir)
// Make sure that the global config directory is set to ~/.ddev
originalGlobalDdevDir := globalconfig.GetGlobalDdevDirLocation()
require.Equal(t, originalGlobalDdevDir, globalconfig.GetGlobalDdevDir())
Expand All @@ -291,7 +290,7 @@ func ResetGlobalDdevDir(t *testing.T, tmpXdgConfigHomeDir string) {
// refresh the global config from ~/.ddev
globalconfig.EnsureGlobalConfig()
// Reset $MUTAGEN_DATA_DIRECTORY
err = os.Unsetenv("MUTAGEN_DATA_DIRECTORY")
err := os.Unsetenv("MUTAGEN_DATA_DIRECTORY")
require.NoError(t, err)
// Start mutagen daemon if it's enabled
if globalconfig.DdevGlobalConfig.IsMutagenEnabled() {
Expand Down

0 comments on commit 70fc4cd

Please sign in to comment.