Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #600 from aiordache/app_190_inconsistent_output_time
Browse files Browse the repository at this point in the history
APP-190 -- Updated status/list output times (added 'ago' at the end)
  • Loading branch information
silvin-lubecki authored Sep 2, 2019
2 parents 2c66384 + d99ac99 commit 964210e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions e2e/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) {
checkContains(t, icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined(),
[]string{
`INSTALLATION\s+APPLICATION\s+LAST ACTION\s+RESULT\s+CREATED\s+MODIFIED\s+REFERENCE`,
fmt.Sprintf(`%s\s+simple \(1.1.0-beta1\)\s+install\s+failure\s+.+second[s]?\s+.+second[s]?\s+`, appName),
fmt.Sprintf(`%s\s+simple \(1.1.0-beta1\)\s+install\s+failure\s+.+second[s]?\sago\s+.+second[s]?\sago\s+`, appName),
})

// Upgrading a failed installation is not allowed
Expand Down Expand Up @@ -437,7 +437,7 @@ STATUS
checkContains(t, icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined(),
[]string{
`INSTALLATION\s+APPLICATION\s+LAST ACTION\s+RESULT\s+CREATED\s+MODIFIED\s+REFERENCE`,
fmt.Sprintf(`%s\s+simple \(1.1.0-beta1\)\s+install\s+success\s+.+second[s]?\s+.+second[s]?\s+`, appName),
fmt.Sprintf(`%s\s+simple \(1.1.0-beta1\)\s+install\s+success\s+.+second[s]?\sago\s+.+second[s]?\sago\s+`, appName),
})

// Installing again the same application is forbidden
Expand Down
2 changes: 1 addition & 1 deletion e2e/pushpull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func TestPushPullInstall(t *testing.T) {
cmd.Command = dockerCli.Command("app", "list")
checkContains(t, icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined(),
[]string{
fmt.Sprintf(`%s\s+push-pull \(1.1.0-beta1\)\s+install\s+success\s+.+second[s]?\s+.+second[s]?\s+%s`, t.Name(), ref+tag),
fmt.Sprintf(`%s\s+push-pull \(1.1.0-beta1\)\s+install\s+success\s+.+second[s]?\sago\s+.+second[s]?\sago\s+%s`, t.Name(), ref+tag),
})

// install with --pull should fail (registry is stopped)
Expand Down
8 changes: 6 additions & 2 deletions internal/commands/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ var (
{"APPLICATION", func(i *store.Installation) string { return fmt.Sprintf("%s (%s)", i.Bundle.Name, i.Bundle.Version) }},
{"LAST ACTION", func(i *store.Installation) string { return i.Result.Action }},
{"RESULT", func(i *store.Installation) string { return i.Result.Status }},
{"CREATED", func(i *store.Installation) string { return units.HumanDuration(time.Since(i.Created)) }},
{"MODIFIED", func(i *store.Installation) string { return units.HumanDuration(time.Since(i.Modified)) }},
{"CREATED", func(i *store.Installation) string {
return fmt.Sprintf("%s ago", units.HumanDuration(time.Since(i.Created)))
}},
{"MODIFIED", func(i *store.Installation) string {
return fmt.Sprintf("%s ago", units.HumanDuration(time.Since(i.Modified)))
}},
{"REFERENCE", func(i *store.Installation) string { return i.Reference }},
}
)
Expand Down
5 changes: 3 additions & 2 deletions internal/commands/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ func runStatus(dockerCli command.Cli, installationName string, opts credentialOp

func displayInstallationStatus(w io.Writer, installation *store.Installation) {
printHeader(w, "INSTALLATION")

tab := tabwriter.NewWriter(w, 0, 0, 1, ' ', 0)
printValue(tab, "Name", installation.Name)
printValue(tab, "Created", units.HumanDuration(time.Since(installation.Created)))
printValue(tab, "Modified", units.HumanDuration(time.Since(installation.Modified)))
printValue(tab, "Created", fmt.Sprintf("%s ago", units.HumanDuration(time.Since(installation.Created))))
printValue(tab, "Modified", fmt.Sprintf("%s ago", units.HumanDuration(time.Since(installation.Modified))))
printValue(tab, "Revision", installation.Revision)
printValue(tab, "Last Action", installation.Result.Action)
printValue(tab, "Result", strings.ToUpper(installation.Result.Status))
Expand Down

0 comments on commit 964210e

Please sign in to comment.