diff --git a/cmd/puma-dev/main_test.go b/cmd/puma-dev/main_test.go index 2cab746..a3c0e12 100644 --- a/cmd/puma-dev/main_test.go +++ b/cmd/puma-dev/main_test.go @@ -1,6 +1,7 @@ package main import ( + "crypto/sha1" "encoding/json" "errors" "fmt" @@ -237,8 +238,12 @@ func runPlatformAgnosticTestScenarios(t *testing.T) { panic(err) } - assert.NoError(t, pollForEvent(t, "rack-hi-puma", "killing_app", "restart.txt touched")) - assert.NoError(t, pollForEvent(t, "rack-hi-puma", "shutdown", "")) + appRoot := filepath.Join(ProjectRoot, "etc", "rack-hi-puma") + h := sha1.New() + h.Write([]byte(appRoot)) + appName := fmt.Sprintf("rack-hi-puma-%.4x", h.Sum(nil)) + assert.NoError(t, pollForEvent(t, appName, "killing_app", "restart.txt touched")) + assert.NoError(t, pollForEvent(t, appName, "shutdown", "")) }) t.Run("unknown app", func(t *testing.T) { diff --git a/dev/app.go b/dev/app.go index 718a46a..8cae101 100644 --- a/dev/app.go +++ b/dev/app.go @@ -3,6 +3,7 @@ package dev import ( "bufio" "bytes" + "crypto/sha1" "fmt" "io" "io/ioutil" @@ -514,8 +515,10 @@ func (a *AppPool) App(name string) (*App, error) { destStat, err := os.Stat(destPath) if err == nil { destName := destStat.Name() - if destName != canonicalName { - canonicalName = destName + if destName != name { + h := sha1.New() + h.Write([]byte(destPath)) + canonicalName = fmt.Sprintf("%s-%.4x", destStat.Name(), h.Sum(nil)) aliasName = name } }