From 050fa7edf3d6045dcc92fb1670f764a0012a88f7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 12 Dec 2017 11:25:16 -0500 Subject: [PATCH] feat: add test for apps starting with numeric characters --- plugins/common/common_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugins/common/common_test.go b/plugins/common/common_test.go index 535ba0f01..c7281b583 100644 --- a/plugins/common/common_test.go +++ b/plugins/common/common_test.go @@ -14,6 +14,10 @@ var ( testAppDir = strings.Join([]string{"/home/dokku/", testAppName}, "") testEnvFile = strings.Join([]string{testAppDir, "/ENV"}, "") testEnvLine = "export testKey=TESTING" + testAppName2 = "01-test-app-1" + testAppDir2 = strings.Join([]string{"/home/dokku/", testAppName}, "") + testEnvFile2 = strings.Join([]string{testAppDir, "/ENV"}, "") + testEnvLine2 = "export testKey=TESTING" ) func setupTestApp() (err error) { @@ -25,10 +29,23 @@ func setupTestApp() (err error) { return } +func setupTestApp2() (err error) { + Expect(os.MkdirAll(testAppDir2, 0644)).To(Succeed()) + b := []byte(testEnvLine2 + "\n") + if err = ioutil.WriteFile(testEnvFile2, b, 0644); err != nil { + return + } + return +} + func teardownTestApp() { os.RemoveAll(testAppDir) } +func teardownTestApp2() { + os.RemoveAll(testAppDir2) +} + func TestCommonGetEnv(t *testing.T) { RegisterTestingT(t) Expect(MustGetEnv("DOKKU_ROOT")).To(Equal("/home/dokku")) @@ -55,6 +72,11 @@ func TestCommonVerifyAppName(t *testing.T) { Expect(setupTestApp()).To(Succeed()) Expect(VerifyAppName(testAppName)).To(Succeed()) teardownTestApp() + + RegisterTestingT(t) + Expect(setupTestApp2()).To(Succeed()) + Expect(VerifyAppName(testAppName2)).To(Succeed()) + teardownTestApp2() } func TestCommonDokkuAppsError(t *testing.T) {