Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 5ad97e1

Browse files
authored
Merge pull request #539 from jcsirot/verify-stdout-stderr
Verify outputs to stdout and stderr
2 parents dfd4161 + 59049dd commit 5ad97e1

File tree

11 files changed

+17
-14
lines changed

11 files changed

+17
-14
lines changed

e2e/testdata/init-output.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
You will need to edit parameters.yml to fill in default values.
21
Created "app-test.dockerapp"
2+
You will need to edit parameters.yml to fill in default values.

internal/commands/bundle.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"encoding/json"
77
"fmt"
88
"io/ioutil"
9+
"os"
910

1011
"github.com/deislabs/cnab-go/bundle"
1112
"github.com/docker/app/internal/packager"
@@ -61,7 +62,7 @@ func runBundle(dockerCli command.Cli, appName string, opts bundleOptions) error
6162
return err
6263
}
6364

64-
fmt.Fprintf(dockerCli.Out(), "Invocation image %q successfully built\n", bundle.InvocationImages[0].Image)
65+
fmt.Fprintf(os.Stdout, "Invocation image %q successfully built\n", bundle.InvocationImages[0].Image)
6566
bundleBytes, err := json.MarshalIndent(bundle, "", "\t")
6667
if err != nil {
6768
return err

internal/commands/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,6 @@ func runInstall(dockerCli command.Cli, appname string, opts installOptions) erro
142142
return err2
143143
}
144144

145-
fmt.Printf("Application %q installed on context %q\n", installationName, opts.targetContext)
145+
fmt.Fprintf(os.Stdout, "Application %q installed on context %q\n", installationName, opts.targetContext)
146146
return nil
147147
}

internal/commands/pull.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package commands
22

33
import (
44
"fmt"
5+
"os"
56

67
"github.com/docker/app/internal/store"
78
"github.com/docker/cli/cli"
@@ -46,7 +47,7 @@ func runPull(dockerCli command.Cli, name string, opts registryOptions) error {
4647
return errors.Wrap(err, name)
4748
}
4849

49-
fmt.Printf("Successfully pulled %q (%s) from %s\n", bndl.Name, bndl.Version, ref.String())
50+
fmt.Fprintf(os.Stdout, "Successfully pulled %q (%s) from %s\n", bndl.Name, bndl.Version, ref.String())
5051

5152
return nil
5253
}

internal/commands/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func runPush(dockerCli command.Cli, name string, opts pushOptions) error {
118118
if err != nil {
119119
return errors.Wrapf(err, "pushing to %q", retag.cnabRef)
120120
}
121-
fmt.Printf("Successfully pushed bundle to %s. Digest is %s.\n", retag.cnabRef.String(), descriptor.Digest)
121+
fmt.Fprintf(os.Stdout, "Successfully pushed bundle to %s. Digest is %s.\n", retag.cnabRef.String(), descriptor.Digest)
122122
return nil
123123
}
124124

internal/commands/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
3434
mergeCmd(dockerCli),
3535
renderCmd(dockerCli),
3636
splitCmd(),
37-
validateCmd(dockerCli),
37+
validateCmd(),
3838
versionCmd(dockerCli),
3939
completionCmd(dockerCli, cmd),
4040
bundleCmd(dockerCli),

internal/commands/uninstall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ func runUninstall(dockerCli command.Cli, installationName string, opts uninstall
8686
if err := installationStore.Delete(installationName); err != nil {
8787
return fmt.Errorf("Failed to delete installation %q from the installation store: %s", installationName, err)
8888
}
89-
fmt.Printf("Application %q uninstalled on context %q\n", installationName, opts.targetContext)
89+
fmt.Fprintf(os.Stdout, "Application %q uninstalled on context %q\n", installationName, opts.targetContext)
9090
return nil
9191
}

internal/commands/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ func runUpgrade(dockerCli command.Cli, installationName string, opts upgradeOpti
9797
if err2 != nil {
9898
return err2
9999
}
100-
fmt.Printf("Application %q upgraded on context %q\n", installationName, opts.targetContext)
100+
fmt.Fprintf(os.Stdout, "Application %q upgraded on context %q\n", installationName, opts.targetContext)
101101
return nil
102102
}

internal/commands/validate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package commands
22

33
import (
44
"fmt"
5+
"os"
56

67
"github.com/docker/app/internal/packager"
78
"github.com/docker/app/render"
89
"github.com/docker/app/types"
910
"github.com/docker/cli/cli"
10-
"github.com/docker/cli/cli/command"
1111
cliopts "github.com/docker/cli/opts"
1212
"github.com/spf13/cobra"
1313
)
@@ -16,7 +16,7 @@ type validateOptions struct {
1616
parametersOptions
1717
}
1818

19-
func validateCmd(dockerCli command.Cli) *cobra.Command {
19+
func validateCmd() *cobra.Command {
2020
var opts validateOptions
2121
cmd := &cobra.Command{
2222
Use: "validate [APP_NAME] [--set KEY=VALUE ...] [--parameters-file PARAMETERS_FILE]",
@@ -35,7 +35,7 @@ func validateCmd(dockerCli command.Cli) *cobra.Command {
3535
if err != nil {
3636
return err
3737
}
38-
fmt.Fprintf(dockerCli.Out(), "Validated %q\n", app.Path)
38+
fmt.Fprintf(os.Stdout, "Validated %q\n", app.Path)
3939
return nil
4040
},
4141
}

internal/commands/version.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package commands
22

33
import (
44
"fmt"
5+
"os"
56

67
"github.com/docker/app/internal"
78
"github.com/docker/app/internal/packager"
@@ -25,9 +26,9 @@ In order to be able to build an invocation images when using docker app from an
2526
Run: func(cmd *cobra.Command, args []string) {
2627
image := packager.BaseInvocationImage(dockerCli)
2728
if onlyBaseImage {
28-
fmt.Fprintln(dockerCli.Out(), image)
29+
fmt.Fprintln(os.Stdout, image)
2930
} else {
30-
fmt.Fprintln(dockerCli.Out(), internal.FullVersion(image))
31+
fmt.Fprintln(os.Stdout, internal.FullVersion(image))
3132
}
3233
},
3334
}

0 commit comments

Comments
 (0)