Skip to content

Commit

Permalink
Merge pull request runatlantis#167 from hootsuite/pegomock
Browse files Browse the repository at this point in the history
Update to latest version of pegomock library
  • Loading branch information
lkysow authored Oct 26, 2017
2 parents d5f2fc0 + f21331a commit 96be4e9
Show file tree
Hide file tree
Showing 16 changed files with 283 additions and 82 deletions.
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion server/events/event_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
)

//go:generate pegomock generate --use-experimental-model-gen --package mocks -o mocks/mock_event_parsing.go EventParsing
//go:generate sed -i "" -e "s#github.com/hootsuite/atlantis/vendor/github.com/google/go-github/github#github.com/google/go-github/github#" mocks/mock_event_parsing.go

type Command struct {
Name CommandName
Expand Down
2 changes: 1 addition & 1 deletion server/events/mocks/mock_event_parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package mocks

import (
github "github.com/google/go-github/github"
events "github.com/hootsuite/atlantis/server/events"
models "github.com/hootsuite/atlantis/server/events/models"
github "github.com/google/go-github/github"
pegomock "github.com/petergtz/pegomock"
"reflect"
)
Expand Down
24 changes: 12 additions & 12 deletions server/events/mocks/mock_project_config_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func NewMockProjectConfigReader() *MockProjectConfigReader {
return &MockProjectConfigReader{fail: pegomock.GlobalFailHandler}
}

func (mock *MockProjectConfigReader) Exists(execPath string) bool {
params := []pegomock.Param{execPath}
func (mock *MockProjectConfigReader) Exists(projectPath string) bool {
params := []pegomock.Param{projectPath}
result := pegomock.GetGenericMockFrom(mock).Invoke("Exists", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()})
var ret0 bool
if len(result) != 0 {
Expand All @@ -29,8 +29,8 @@ func (mock *MockProjectConfigReader) Exists(execPath string) bool {
return ret0
}

func (mock *MockProjectConfigReader) Read(execPath string) (events.ProjectConfig, error) {
params := []pegomock.Param{execPath}
func (mock *MockProjectConfigReader) Read(projectPath string) (events.ProjectConfig, error) {
params := []pegomock.Param{projectPath}
result := pegomock.GetGenericMockFrom(mock).Invoke("Read", params, []reflect.Type{reflect.TypeOf((*events.ProjectConfig)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 events.ProjectConfig
var ret1 error
Expand Down Expand Up @@ -63,8 +63,8 @@ type VerifierProjectConfigReader struct {
inOrderContext *pegomock.InOrderContext
}

func (verifier *VerifierProjectConfigReader) Exists(execPath string) *ProjectConfigReader_Exists_OngoingVerification {
params := []pegomock.Param{execPath}
func (verifier *VerifierProjectConfigReader) Exists(projectPath string) *ProjectConfigReader_Exists_OngoingVerification {
params := []pegomock.Param{projectPath}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Exists", params)
return &ProjectConfigReader_Exists_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
Expand All @@ -75,8 +75,8 @@ type ProjectConfigReader_Exists_OngoingVerification struct {
}

func (c *ProjectConfigReader_Exists_OngoingVerification) GetCapturedArguments() string {
execPath := c.GetAllCapturedArguments()
return execPath[len(execPath)-1]
projectPath := c.GetAllCapturedArguments()
return projectPath[len(projectPath)-1]
}

func (c *ProjectConfigReader_Exists_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
Expand All @@ -90,8 +90,8 @@ func (c *ProjectConfigReader_Exists_OngoingVerification) GetAllCapturedArguments
return
}

func (verifier *VerifierProjectConfigReader) Read(execPath string) *ProjectConfigReader_Read_OngoingVerification {
params := []pegomock.Param{execPath}
func (verifier *VerifierProjectConfigReader) Read(projectPath string) *ProjectConfigReader_Read_OngoingVerification {
params := []pegomock.Param{projectPath}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Read", params)
return &ProjectConfigReader_Read_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
Expand All @@ -102,8 +102,8 @@ type ProjectConfigReader_Read_OngoingVerification struct {
}

func (c *ProjectConfigReader_Read_OngoingVerification) GetCapturedArguments() string {
execPath := c.GetAllCapturedArguments()
return execPath[len(execPath)-1]
projectPath := c.GetAllCapturedArguments()
return projectPath[len(projectPath)-1]
}

func (c *ProjectConfigReader_Read_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
Expand Down
2 changes: 1 addition & 1 deletion server/events/run/mocks/mock_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package mocks

import (
logging "github.com/hootsuite/atlantis/server/logging"
go_version "github.com/hashicorp/go-version"
logging "github.com/hootsuite/atlantis/server/logging"
pegomock "github.com/petergtz/pegomock"
"reflect"
)
Expand Down
1 change: 0 additions & 1 deletion server/events/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
const inlineShebang = "#!/bin/sh -e"

//go:generate pegomock generate --use-experimental-model-gen --package mocks -o mocks/mock_runner.go Runner
//go:generate sed -i "" -e "s#go_version \"github.com/hootsuite/atlantis/vendor/github.com/hashicorp/go-version\"#go_version \"github.com/hashicorp/go-version\"#" mocks/mock_runner.go
type Runner interface {
Execute(log *logging.SimpleLogger, commands []string, path string, environment string, terraformVersion *version.Version, stage string) (string, error)
}
Expand Down
2 changes: 1 addition & 1 deletion server/events/terraform/mocks/mock_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package mocks

import (
logging "github.com/hootsuite/atlantis/server/logging"
go_version "github.com/hashicorp/go-version"
logging "github.com/hootsuite/atlantis/server/logging"
pegomock "github.com/petergtz/pegomock"
"reflect"
)
Expand Down
1 change: 0 additions & 1 deletion server/events/terraform/terraform_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
)

//go:generate pegomock generate --use-experimental-model-gen --package mocks -o mocks/mock_runner.go Runner
//go:generate sed -i "" -e "s#go_version \"github.com/hootsuite/atlantis/vendor/github.com/hashicorp/go-version\"#go_version \"github.com/hashicorp/go-version\"#" mocks/mock_runner.go
type Runner interface {
Version() *version.Version
RunCommandWithVersion(log *logging.SimpleLogger, path string, args []string, v *version.Version, env string) (string, error)
Expand Down
4 changes: 3 additions & 1 deletion vendor/github.com/petergtz/pegomock/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 57 additions & 8 deletions vendor/github.com/petergtz/pegomock/dsl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 96be4e9

Please sign in to comment.