mirror of https://github.com/docker/compose.git
fix: lint
Signed-off-by: MohammadHasan Akbari <116190942+jarqvi@users.noreply.github.com> Signed-off-by: MohammadHasan Akbari <jarqvi.jarqvi@gmail.com>
This commit is contained in:
parent
b9d0c77cde
commit
bf0418bac1
|
@ -69,15 +69,24 @@ func (s *composeService) export(ctx context.Context, projectName string, options
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer responseBody.Close()
|
defer func() {
|
||||||
|
if err := responseBody.Close(); err != nil {
|
||||||
|
w.Event(progress.Event{
|
||||||
|
ID: name,
|
||||||
|
Text: msg,
|
||||||
|
Status: progress.Error,
|
||||||
|
StatusText: fmt.Sprintf("Failed to close response body: %v", err),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if !s.dryRun {
|
if !s.dryRun {
|
||||||
if options.Output == "" {
|
if options.Output == "" {
|
||||||
_, err := io.Copy(s.dockerCli.Out(), responseBody)
|
_, err := io.Copy(s.dockerCli.Out(), responseBody)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = command.CopyToFile(options.Output, responseBody); err != nil {
|
if err := command.CopyToFile(options.Output, responseBody); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,31 +21,30 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestExport(t *testing.T) {
|
func TestExport(t *testing.T) {
|
||||||
const projectName = "e2e-export-service"
|
const projectName = "e2e-export-service"
|
||||||
c := NewParallelCLI(t)
|
c := NewParallelCLI(t)
|
||||||
|
|
||||||
cleanup := func() {
|
cleanup := func() {
|
||||||
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--timeout=0", "--remove-orphans")
|
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--timeout=0", "--remove-orphans")
|
||||||
}
|
}
|
||||||
t.Cleanup(cleanup)
|
t.Cleanup(cleanup)
|
||||||
cleanup()
|
cleanup()
|
||||||
|
|
||||||
c.RunDockerComposeCmd(t, "-f", "./fixtures/export/compose.yaml", "--project-name", projectName, "up", "-d", "service")
|
c.RunDockerComposeCmd(t, "-f", "./fixtures/export/compose.yaml", "--project-name", projectName, "up", "-d", "service")
|
||||||
c.RunDockerComposeCmd(t, "--project-name", projectName, "export", "-o", "service.tar", "service")
|
c.RunDockerComposeCmd(t, "--project-name", projectName, "export", "-o", "service.tar", "service")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExportWithReplicas(t *testing.T) {
|
func TestExportWithReplicas(t *testing.T) {
|
||||||
const projectName = "e2e-export-service-with-replicas"
|
const projectName = "e2e-export-service-with-replicas"
|
||||||
c := NewParallelCLI(t)
|
c := NewParallelCLI(t)
|
||||||
|
|
||||||
cleanup := func() {
|
cleanup := func() {
|
||||||
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--timeout=0", "--remove-orphans")
|
c.RunDockerComposeCmd(t, "--project-name", projectName, "down", "--timeout=0", "--remove-orphans")
|
||||||
}
|
}
|
||||||
t.Cleanup(cleanup)
|
t.Cleanup(cleanup)
|
||||||
cleanup()
|
cleanup()
|
||||||
|
|
||||||
c.RunDockerComposeCmd(t, "-f", "./fixtures/export/compose.yaml", "--project-name", projectName, "up", "-d", "service-with-replicas")
|
c.RunDockerComposeCmd(t, "-f", "./fixtures/export/compose.yaml", "--project-name", projectName, "up", "-d", "service-with-replicas")
|
||||||
c.RunDockerComposeCmd(t, "--project-name", projectName, "export", "-o", "r1.tar", "--index=1", "service-with-replicas")
|
c.RunDockerComposeCmd(t, "--project-name", projectName, "export", "-o", "r1.tar", "--index=1", "service-with-replicas")
|
||||||
c.RunDockerComposeCmd(t, "--project-name", projectName, "export", "-o", "r2.tar", "--index=2", "service-with-replicas")
|
c.RunDockerComposeCmd(t, "--project-name", projectName, "export", "-o", "r2.tar", "--index=2", "service-with-replicas")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue