Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure the "Syncing files into the container" spinner is displayed on Podman #6863

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/dev/podmandev/podmandev.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/redhat-developer/odo/pkg/devfile/location"
"github.com/redhat-developer/odo/pkg/exec"
"github.com/redhat-developer/odo/pkg/libdevfile"
"github.com/redhat-developer/odo/pkg/log"
odocontext "github.com/redhat-developer/odo/pkg/odo/context"
"github.com/redhat-developer/odo/pkg/podman"
"github.com/redhat-developer/odo/pkg/portForward"
Expand Down Expand Up @@ -114,6 +115,8 @@ func (o *DevClient) syncFiles(ctx context.Context, options dev.StartOptions, pod
PodName: pod.GetName(),
SyncFolder: syncFolder,
}
s := log.Spinner("Syncing files into the container")
defer s.End(false)

cmdKind := devfilev1.RunCommandGroupKind
cmdName := options.RunCommand
Expand Down Expand Up @@ -141,6 +144,7 @@ func (o *DevClient) syncFiles(ctx context.Context, options dev.StartOptions, pod
if err != nil {
return false, err
}
s.End(true)
return execRequired, nil
}

Expand Down
20 changes: 20 additions & 0 deletions tests/integration/cmd_dev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2567,6 +2567,9 @@ CMD ["npm", "start"]
})

It("should run successfully", func() {
By("telling the user that odo is synchronizing the files", func() {
Expect(string(stdout)).Should(ContainSubstring("Syncing files into the container"))
})
By("verifying from the output that all commands have been executed", func() {
helper.MatchAllInOutput(string(stdout), []string{
"Building your application in container",
Expand Down Expand Up @@ -2884,6 +2887,7 @@ CMD ["npm", "start"]

By("checking the output of the command", func() {
helper.MatchAllInOutput(stdout, []string{
"Syncing files into the container",
fmt.Sprintf("Building your application in container (command: %s)", tt.buildCmd),
fmt.Sprintf("Executing the application (command: %s)", tt.runCmd),
})
Expand Down Expand Up @@ -3636,6 +3640,10 @@ CMD ["npm", "start"]
It("should execute the build and run commands", func() {
Expect(string(stdout)).To(ContainSubstring(executeBuildCommand))
Expect(string(stdout)).To(ContainSubstring(executeRunCommand))

By("telling the user that odo is synchronizing the files", func() {
Expect(string(stdout)).Should(ContainSubstring("Syncing files into the container"))
})
})

When("a source file is modified", func() {
Expand All @@ -3649,6 +3657,10 @@ CMD ["npm", "start"]
It("should not re-execute the run command", func() {
Expect(string(stdout)).To(ContainSubstring(executeBuildCommand))
Expect(string(stdout)).ToNot(ContainSubstring(executeRunCommand))

By("telling the user that odo is synchronizing the files", func() {
Expect(string(stdout)).Should(ContainSubstring("Syncing files into the container"))
})
})
})
}))
Expand Down Expand Up @@ -3677,6 +3689,10 @@ CMD ["npm", "start"]
It("should execute the build and run commands", func() {
Expect(string(stdout)).To(ContainSubstring(executeBuildCommand))
Expect(string(stdout)).To(ContainSubstring(executeRunCommand))

By("telling the user that odo is synchronizing the files", func() {
Expect(string(stdout)).Should(ContainSubstring("Syncing files into the container"))
})
})

When("a source file is modified", func() {
Expand All @@ -3690,6 +3706,10 @@ CMD ["npm", "start"]
It("should not re-execute the run command", func() {
Expect(string(stdout)).ToNot(ContainSubstring(executeBuildCommand))
Expect(string(stdout)).ToNot(ContainSubstring(executeRunCommand))

By("telling the user that odo is synchronizing the files", func() {
Expect(string(stdout)).Should(ContainSubstring("Syncing files into the container"))
})
})
})
}))
Expand Down