Skip to content

Commit

Permalink
Merge pull request #521 from mesg-foundation/fix/remove-point
Browse files Browse the repository at this point in the history
Remove point at the end of sentence
  • Loading branch information
antho1404 authored Oct 4, 2018
2 parents 0f695e6 + 0b3448f commit 2c6651f
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 58 deletions.
2 changes: 1 addition & 1 deletion api/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (d *serviceDeployer) FromGitURL(url string) (*service.Service, *importer.Va
return nil, nil, err
}

d.sendStatus("Service downloaded with success.", DonePositive)
d.sendStatus("Service downloaded with success", DonePositive)
r, err := xarchive.GzippedTar(path)
if err != nil {
return nil, nil, err
Expand Down
12 changes: 6 additions & 6 deletions api/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestDeployService(t *testing.T) {
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Service context received with success.",
Message: "Service context received with success",
Type: DonePositive,
}, <-statuses)

Expand All @@ -52,7 +52,7 @@ func TestDeployService(t *testing.T) {
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Image built with success.",
Message: "Image built with success",
Type: DonePositive,
}, <-statuses)

Expand Down Expand Up @@ -88,7 +88,7 @@ func TestDeployInvalidService(t *testing.T) {
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Service context received with success.",
Message: "Service context received with success",
Type: DonePositive,
}, <-statuses)

Expand Down Expand Up @@ -126,7 +126,7 @@ func TestDeployServiceFromURL(t *testing.T) {
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Service downloaded with success.",
Message: "Service downloaded with success",
Type: DonePositive,
}, <-statuses)

Expand All @@ -136,7 +136,7 @@ func TestDeployServiceFromURL(t *testing.T) {
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Service context received with success.",
Message: "Service context received with success",
Type: DonePositive,
}, <-statuses)

Expand All @@ -146,7 +146,7 @@ func TestDeployServiceFromURL(t *testing.T) {
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Image built with success.",
Message: "Image built with success",
Type: DonePositive,
}, <-statuses)

Expand Down
6 changes: 3 additions & 3 deletions commands/provider/service_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (p *ServiceProvider) ServiceValidate(path string) (string, error) {
}

if !validation.ServiceFileExist {
return fmt.Sprintf("%s File 'mesg.yml' does not exist.", pretty.FailSign), nil
return fmt.Sprintf("%s File 'mesg.yml' does not exist", pretty.FailSign), nil
}

if len(validation.ServiceFileWarnings) > 0 {
Expand All @@ -245,10 +245,10 @@ func (p *ServiceProvider) ServiceValidate(path string) (string, error) {
}

if !validation.DockerfileExist {
return fmt.Sprintf("%s Dockerfile does not exist.", pretty.FailSign), nil
return fmt.Sprintf("%s Dockerfile does not exist", pretty.FailSign), nil
}
if !validation.IsValid() {
return fmt.Sprintf("%s Service is not valid.", pretty.FailSign), nil
return fmt.Sprintf("%s Service is not valid", pretty.FailSign), nil
}

return fmt.Sprintf(`%s Dockerfile exists
Expand Down
2 changes: 1 addition & 1 deletion commands/service_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (c *serviceDeleteCmd) runE(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
fmt.Printf("%s all services are deleted.\n", pretty.SuccessSign)
fmt.Printf("%s all services are deleted\n", pretty.SuccessSign)
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions commands/service_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ func (c *serviceDevCmd) runE(cmd *cobra.Command, args []string) error {
err = c.e.ServiceDelete(id)
})
if err != nil {
fmt.Printf("%s Error while removing the service.\n", pretty.FailSign)
fmt.Printf("%s Error while removing the service\n", pretty.FailSign)
fmt.Printf(pretty.Failln(err))
} else {
fmt.Printf("%s Service removed.\n", pretty.SuccessSign)
fmt.Printf("%s Service removed\n", pretty.SuccessSign)
}
}()

pretty.Progress("Starting the service...", func() { err = c.e.ServiceStart(id) })
if err != nil {
return err
}
fmt.Printf("%s Service started.\n", pretty.SuccessSign)
fmt.Printf("%s Service started\n", pretty.SuccessSign)

listenEventsC, eventsErrC, err := c.e.ServiceListenEvents(id, c.eventFilter)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion commands/service_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (c *serviceExecuteCmd) runE(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
fmt.Printf("%s Task %q executed.\n", pretty.SuccessSign, c.taskKey)
fmt.Printf("%s Task %q executed\n", pretty.SuccessSign, c.taskKey)

var result *coreapi.ResultData
pretty.Progress("Waiting for result...", func() {
Expand Down
4 changes: 2 additions & 2 deletions commands/service_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (c *serviceInitCmd) preRunE(cmd *cobra.Command, args []string) error {
}

if result == addMyOwn {
fmt.Println("You can create and add your own template to this list.")
fmt.Println("You can create and add your own template to this list")
fmt.Println("Go to the Awesome Github to see how")
fmt.Println("https://github.com/mesg-foundation/awesome")
os.Exit(0)
Expand Down Expand Up @@ -113,7 +113,7 @@ func (c *serviceInitCmd) runE(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
fmt.Printf("%s Service initialized in %q.\n", pretty.SuccessSign, c.dir)
fmt.Printf("%s Service initialized in %q\n", pretty.SuccessSign, c.dir)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions commands/service_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newServiceStartCmd(e ServiceExecutor) *serviceStartCmd {
c.cmd = newCommand(&cobra.Command{
Use: "start SERVICE",
Short: "Start a service",
Long: "Start a service previously published services.",
Long: "Start a service previously published services",
Example: `mesg-core service start SERVICE`,
Args: cobra.ExactArgs(1),
RunE: c.runE,
Expand All @@ -37,7 +37,7 @@ func (c *serviceStartCmd) runE(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
fmt.Printf("%s Service started.\n", pretty.SuccessSign)
fmt.Printf("%s Service started\n", pretty.SuccessSign)
fmt.Printf("To see its logs, run the command:\n\tmesg-core service logs %s\n", serviceID)
return nil
}
2 changes: 1 addition & 1 deletion commands/service_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func (c *serviceStopCmd) runE(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
fmt.Printf("%s Service stopped.\n", pretty.SuccessSign)
fmt.Printf("%s Service stopped\n", pretty.SuccessSign)
return nil
}
2 changes: 1 addition & 1 deletion commands/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ func (c *startCmd) runE(cmd *cobra.Command, args []string) error {
return err
}

fmt.Printf("%s Core started.\n", pretty.SuccessSign)
fmt.Printf("%s Core started\n", pretty.SuccessSign)
return nil
}
2 changes: 1 addition & 1 deletion commands/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestStartCmdRunE(t *testing.T) {
c.cmd.Execute()

stdout, stderr := closeStd()
require.Contains(t, stdout, "Starting Core.")
require.Contains(t, stdout, "Starting Core")
require.Contains(t, stdout, "Core started")
require.Empty(t, stderr)

Expand Down
2 changes: 1 addition & 1 deletion commands/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func newStatusCmd(e RootExecutor) *statusCmd {
c := &statusCmd{e: e}
c.cmd = newCommand(&cobra.Command{
Use: "status",
Short: "Get the Core's status.",
Short: "Get the Core's status",
RunE: c.runE,
})
return c
Expand Down
2 changes: 1 addition & 1 deletion database/service_db.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type DecodeError struct {
}

func (e *DecodeError) Error() string {
return fmt.Sprintf("Database services: Could not decode service %q.", e.ID)
return fmt.Sprintf("Database services: Could not decode service %q", e.ID)
}

// IsErrNotFound returs true if err is type of ErrNotFound, false otherwise.
Expand Down
2 changes: 1 addition & 1 deletion interface/grpc/core/deploy_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestIntegrationDeployService(t *testing.T) {

require.Len(t, stream.serviceID, 40)
require.Contains(t, stream.statuses, api.DeployStatus{
Message: "Image built with success.",
Message: "Image built with success",
Type: api.DonePositive,
})
}
2 changes: 1 addition & 1 deletion interface/grpc/core/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestDeployService(t *testing.T) {
require.Len(t, stream.serviceID, 40)

require.Contains(t, stream.statuses, api.DeployStatus{
Message: "Image built with success.",
Message: "Image built with success",
Type: api.DonePositive,
})
}
Expand Down
4 changes: 2 additions & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (s *Service) saveContext(r io.Reader) error {
}

s.sendStatus("Receiving service context...", DRunning)
defer s.sendStatus("Service context received with success.", DDonePositive)
defer s.sendStatus("Service context received with success", DDonePositive)

return archive.Untar(r, s.tempPath, &archive.TarOptions{
Compression: archive.Gzip,
Expand All @@ -198,7 +198,7 @@ func (s *Service) deploy() error {
return err
}

s.sendStatus("Image built with success.", DDonePositive)
s.sendStatus("Image built with success", DDonePositive)

s.configuration.Key = "service"
s.configuration.Image = imageHash
Expand Down
50 changes: 21 additions & 29 deletions service/service_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package service

import (
"sync"
"testing"

"github.com/mesg-foundation/core/container"
Expand Down Expand Up @@ -68,33 +67,7 @@ func TestNew(t *testing.T) {
archive, err := xarchive.GzippedTar(path)
require.NoError(t, err)

statuses := make(chan DeployStatus)
var wg sync.WaitGroup

wg.Add(1)
go func() {
defer wg.Done()

require.Equal(t, DeployStatus{
Message: "Receiving service context...",
Type: DRunning,
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Service context received with success.",
Type: DDonePositive,
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Building Docker image...",
Type: DRunning,
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Image built with success.",
Type: DDonePositive,
}, <-statuses)
}()
statuses := make(chan DeployStatus, 4)

s, err := New(archive,
ContainerOption(mc),
Expand All @@ -104,8 +77,27 @@ func TestNew(t *testing.T) {
require.Equal(t, "service", s.Dependencies[0].Key)
require.Equal(t, hash, s.Dependencies[0].Image)

require.Equal(t, DeployStatus{
Message: "Receiving service context...",
Type: DRunning,
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Service context received with success",
Type: DDonePositive,
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Building Docker image...",
Type: DRunning,
}, <-statuses)

require.Equal(t, DeployStatus{
Message: "Image built with success",
Type: DDonePositive,
}, <-statuses)

mc.AssertExpectations(t)
wg.Wait()
}

func TestInjectDefinitionWithConfig(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion utils/clierrors/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const (
cannotReachTheCore = "Cannot reach the Core"
startCore = "Please start the core by running: mesg-core start"
cannotReachDocker = "Cannot reach Docker"
installDocker = "Please make sure Docker is running.\nIf Docker is not installed on your machine you can install it here: https://store.docker.com/search?type=edition&offering=community"
installDocker = "Please make sure Docker is running\nIf Docker is not installed on your machine you can install it here: https://store.docker.com/search?type=edition&offering=community"
)

// ErrorMessage returns error description based on error type.
Expand Down

0 comments on commit 2c6651f

Please sign in to comment.