Skip to content

Commit

Permalink
update integration and unit testing
Browse files Browse the repository at this point in the history
[finishes #153546864]

Signed-off-by: An Yu <anyu@pivotal.io>
  • Loading branch information
vitreuz authored and anyu committed Dec 15, 2017
1 parent 61ca71a commit c77e557
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actor/pushaction/command_line_settings_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ var _ = Describe("CommandLineSettings with provided path", func() {

Entry("path = current directory; provided and manifest paths are empty", "", "", currentDirectory),
Entry("path = manfiest path; provided is empty and manifest path is not empty", "", "some-manifest-path", "some-manifest-path"),
Entry("path = absolute provided path; provided relative path is not empty and manifest path is empty", "some-provided-path", "", "C:\\some\\current-directory\\some-provided-path"),
Entry("path = absolute provided path; provided relative path and manifest path are not empty", "some-provided-path", "some-manifest-path", "C:\\some\\current-directory\\some-provided-path"),
Entry("path = absolute provided path; provided relative path is not empty and manifest path is empty", "some-provided-path", "", "some-provided-path"),
Entry("path = absolute provided path; provided relative path and manifest path are not empty", "some-provided-path", "some-manifest-path", "some-provided-path"),
Entry("path = provided path; provided path is absolute", "C:\\some-provided-path", "", "C:\\some-provided-path"),
)

Expand Down
93 changes: 93 additions & 0 deletions integration/push/path_windows_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// +build windows

package push

import (
"path/filepath"
"regexp"
"strings"

"code.cloudfoundry.org/cli/integration/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
. "github.com/onsi/gomega/gexec"
)

var _ = Describe("pushing a path with the -p flag", func() {
var (
appName string
)

BeforeEach(func() {
appName = helpers.NewAppName()
})

Context("pushing a relative root path (\\)", func() {
It("pushes the app from the directory", func() {
helpers.WithHelloWorldApp(func(appDir string) {
volumeName := filepath.VolumeName(appDir)
relativeRoot := strings.TrimPrefix(appDir, volumeName)
Expect(strings.HasPrefix(relativeRoot, `\`))

session := helpers.CF(PushCommandName, appName, "-p", relativeRoot)
Eventually(session).Should(Say("Getting app info\\.\\.\\."))
Eventually(session).Should(Say("Creating app with these attributes\\.\\.\\."))
Eventually(session).Should(Say("path:\\s+%s", regexp.QuoteMeta(appDir)))
Eventually(session).Should(Say("routes:"))
Eventually(session).Should(Say("Mapping routes\\.\\.\\."))
Eventually(session).Should(Say("Comparing local files to remote cache\\.\\.\\."))
Eventually(session).Should(Say("Packaging files to upload\\.\\.\\."))
Eventually(session).Should(Say("Uploading files\\.\\.\\."))
Eventually(session).Should(Say("Waiting for API to complete processing files\\.\\.\\."))
Eventually(session).Should(Say("Staging app and tracing logs\\.\\.\\."))
Eventually(session).Should(Say("name:\\s+%s", appName))

Eventually(session).Should(Exit(0))
})
})
})
})

var _ = XDescribe("pushing a path from a manifest", func() {
var (
appName string
)

BeforeEach(func() {
appName = helpers.NewAppName()
})

Context("pushing a relative root path (\\)", func() {
It("pushes the app from the directory", func() {
helpers.WithHelloWorldApp(func(appDir string) {
volumeName := filepath.VolumeName(appDir)
relativeRoot := strings.TrimPrefix(appDir, volumeName)
Expect(strings.HasPrefix(relativeRoot, `\`))
helpers.WriteManifest(filepath.Join(appDir, "manifest.yml"), map[string]interface{}{
"applications": []map[string]interface{}{
{
"name": appName,
"path": relativeRoot,
},
},
})

session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, PushCommandName)
Eventually(session).Should(Say("Getting app info\\.\\.\\."))
Eventually(session).Should(Say("Creating app with these attributes\\.\\.\\."))
Eventually(session).Should(Say("path:\\s+%s", regexp.QuoteMeta(appDir)))
Eventually(session).Should(Say("routes:"))
Eventually(session).Should(Say("Mapping routes\\.\\.\\."))
Eventually(session).Should(Say("Comparing local files to remote cache\\.\\.\\."))
Eventually(session).Should(Say("Packaging files to upload\\.\\.\\."))
Eventually(session).Should(Say("Uploading files\\.\\.\\."))
Eventually(session).Should(Say("Waiting for API to complete processing files\\.\\.\\."))
Eventually(session).Should(Say("Staging app and tracing logs\\.\\.\\."))
Eventually(session).Should(Say("name:\\s+%s", appName))

Eventually(session).Should(Exit(0))
})
})
})
})

0 comments on commit c77e557

Please sign in to comment.