Merge tag 'v0.8.3' into azure-devops

This commit is contained in:
David McPike
2019-07-12 23:27:43 -05:00
73 changed files with 1701 additions and 1499 deletions

View File

@@ -21,7 +21,7 @@ jobs:
# We do this instead of setting --default-tf-version because setting
# that flag starts the download asynchronously so we'd have a race
# condition.
TERRAFORM_VERSION: 0.12.1
TERRAFORM_VERSION: 0.12.3
steps:
- checkout
- run: make build-service

View File

@@ -1,3 +1,53 @@
# v0.8.3
## Description
This release contains an important security fix in addition to some fixes and
changes for Terraform Cloud/Enterprise users. It's highly recommended that all
Atlantis users upgrade to this release. See the Security
section below for more details.
## Security
* Additional arguments specified in Atlantis comments, ex. `atlantis plan -- -var=foo=bar`
are now escaped before being appended to the relevant Terraform command. (Fixes [#697](https://github.com/runatlantis/atlantis/pull/697)).
Previously, a comment like `atlantis plan -- -var=$(touch foo)` would execute
the `touch foo` command because the extra arguments weren't being escaped properly.
This means anyone with comment access to an Atlantis repo could execute arbitrary
code. Because of the severity of this issue, all users should upgrade to this version.
* Upgrade to latest version of Alpine Linux in our Docker image to mitigate
vulnerabilities found in libssh2. (Fixes [#687](https://github.com/runatlantis/atlantis/issues/687))
## Features
* Upgrade Terraform to 0.12.3 in our base Docker image.
* Additional arguments specified in Atlantis comments, ex. `atlantis plan -- -var=foo=bar`
are now available in custom run steps as the `COMMENT_ARGS` environment variable. (Fixes [#670](https://github.com/runatlantis/atlantis/issues/670))
* A new flag `--tfe-hostname` is available for specifying a Terraform Enterprise private installation's hostname
when using the remote backend integration. ([#706](https://github.com/runatlantis/atlantis/pull/706))
## Bugfixes
* Parse Bitbucket Cloud pull request rejected events properly. (Fixes [#676](https://github.com/runatlantis/atlantis/issues/676))
* Terraform >= 0.12.0 works with Terraform Cloud/Enterprise remote operations. (Fixes [#704](https://github.com/runatlantis/atlantis/issues/704))
## Backwards Incompatibilities / Notes:
* If you were previously relying on being able to execute code in the additional
arguments of comments, ex. `atlantis plan -- -var='foo=$(echo $SECRET)'` this
is no longer possible. Instead you will need to write a custom workflow with a
custom step or the extra_args config.
* If you're using the Atlantis Docker image and aren't setting the `--default-tf-version` flag
then the default version of Terraform will now be 0.12.3. Simply set the above
flag to your desired default version to avoid any issues.
## Downloads
* [atlantis_darwin_amd64.zip](https://github.com/runatlantis/atlantis/releases/download/v0.8.3/atlantis_darwin_amd64.zip)
* [atlantis_linux_386.zip](https://github.com/runatlantis/atlantis/releases/download/v0.8.3/atlantis_linux_386.zip)
* [atlantis_linux_amd64.zip](https://github.com/runatlantis/atlantis/releases/download/v0.8.3/atlantis_linux_amd64.zip)
* [atlantis_linux_arm.zip](https://github.com/runatlantis/atlantis/releases/download/v0.8.3/atlantis_linux_arm.zip)
## Docker
[`runatlantis/atlantis:v0.8.3`](https://hub.docker.com/r/runatlantis/atlantis/tags/)
## Diff v0.8.2..v0.8.3
https://github.com/runatlantis/atlantis/compare/v0.8.2...v0.8.3
# v0.8.2
## Description

View File

@@ -1,9 +1,9 @@
# The runatlantis/atlantis-base is created by docker-base/Dockerfile.
FROM runatlantis/atlantis-base:v3.0
FROM runatlantis/atlantis-base:v3.1
LABEL authors="Anubhav Mishra, Luke Kysow"
# install terraform binaries
ENV DEFAULT_TERRAFORM_VERSION=0.12.1
ENV DEFAULT_TERRAFORM_VERSION=0.12.3
# In the official Atlantis image we only have the latest of each Terrafrom version.
RUN AVAILABLE_TERRAFORM_VERSIONS="0.8.8 0.9.11 0.10.8 0.11.14 ${DEFAULT_TERRAFORM_VERSION}" && \

4
Gopkg.lock generated
View File

@@ -474,8 +474,8 @@
"internal/verify",
]
pruneopts = "UT"
revision = "cab79a9916fbfa874d47beb4ca9c1b3bb9a8e0cb"
version = "v2.1.0"
revision = "3821b977214496511e7e49a911307c68f0785ef9"
version = "v2.5.0"
[[projects]]
digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747"

View File

@@ -26,7 +26,7 @@
[[constraint]]
name = "github.com/petergtz/pegomock"
version = "v2.1.0"
version = "v2.5.0"
[[constraint]]
name = "github.com/boltdb/bolt"

View File

@@ -29,12 +29,12 @@ build-service: ## Build the main Go service
go-generate: ## Run go generate in all packages
go generate $(PKG)
#regen-mocks: ## Delete all mocks and matchers and then run go generate to regen them. This doesn't work anymore.
#find . -type f | grep mocks/mock_ | grep -v vendor | xargs rm
#find . -type f | grep mocks/matchers | grep -v vendor | xargs rm
#@# not using $(PKG) here because that it includes directories that have now
#@# been deleted, causing go generate to fail.
#echo "this doesn't work anymore: go generate \$\$(go list ./... | grep -v e2e | grep -v vendor | grep -v static)"
regen-mocks: ## Delete all mocks and matchers and then run go generate to regen them.
find . -type f | grep mocks/mock_ | grep -v vendor | xargs rm
find . -type f | grep mocks/matchers | grep -v vendor | xargs rm
@# not using $(PKG) here because that it includes directories that have now
@# been deleted, causing go generate to fail.
go list ./... | grep -v e2e | grep -v vendor | grep -v static | xargs go generate
test: ## Run tests
@go test -short $(PKG)

View File

@@ -75,9 +75,10 @@ const (
SlackTokenFlag = "slack-token"
SSLCertFileFlag = "ssl-cert-file"
SSLKeyFileFlag = "ssl-key-file"
TFEHostnameFlag = "tfe-hostname"
TFETokenFlag = "tfe-token"
// Flag defaults.
// NOTE: Must manually set these as defaults in the setDefaults function.
DefaultADBasicAuth = true
DefaultADBasicUser = ""
DefaultADBasicPassword = ""
@@ -88,6 +89,7 @@ const (
DefaultGitlabHostname = "gitlab.com"
DefaultLogLevel = "info"
DefaultPort = 4141
DefaultTFEHostname = "app.terraform.io"
)
var stringFlags = map[string]stringFlag{
@@ -213,9 +215,13 @@ var stringFlags = map[string]stringFlag{
SSLKeyFileFlag: {
description: fmt.Sprintf("File containing x509 private key matching --%s.", SSLCertFileFlag),
},
TFEHostnameFlag: {
description: "Hostname of your Terraform Enterprise installation. If using Terraform Cloud no need to set.",
defaultValue: DefaultTFEHostname,
},
TFETokenFlag: {
description: "API token for Terraform Enterprise. This will be used to generate a ~/.terraformrc file." +
" Only set if using TFE as a backend." +
description: "API token for Terraform Cloud/Enterprise. This will be used to generate a ~/.terraformrc file." +
" Only set if using TFC/E as a remote backend." +
" Should be specified via the ATLANTIS_TFE_TOKEN environment variable for security.",
},
DefaultTFVersionFlag: {
@@ -456,6 +462,9 @@ func (s *ServerCmd) setDefaults(c *server.UserConfig) {
if c.Port == 0 {
c.Port = DefaultPort
}
if c.TFEHostname == "" {
c.TFEHostname = DefaultTFEHostname
}
}
func (s *ServerCmd) validate(userConfig server.UserConfig) error {
@@ -526,6 +535,10 @@ func (s *ServerCmd) validate(userConfig server.UserConfig) error {
}
}
if userConfig.TFEHostname != DefaultTFEHostname && userConfig.TFEToken == "" {
return fmt.Errorf("if setting --%s, must set --%s", TFEHostnameFlag, TFETokenFlag)
}
return nil
}

View File

@@ -397,6 +397,7 @@ func TestExecute_Defaults(t *testing.T) {
Equals(t, "", passedConfig.SlackToken)
Equals(t, "", passedConfig.SSLCertFile)
Equals(t, "", passedConfig.SSLKeyFile)
Equals(t, "app.terraform.io", passedConfig.TFEHostname)
Equals(t, "", passedConfig.TFEToken)
}
@@ -501,6 +502,7 @@ func TestExecute_Flags(t *testing.T) {
cmd.SlackTokenFlag: "slack-token",
cmd.SSLCertFileFlag: "cert-file",
cmd.SSLKeyFileFlag: "key-file",
cmd.TFEHostnameFlag: "my-hostname",
cmd.TFETokenFlag: "my-token",
})
err := c.Execute()
@@ -534,6 +536,7 @@ func TestExecute_Flags(t *testing.T) {
Equals(t, "slack-token", passedConfig.SlackToken)
Equals(t, "cert-file", passedConfig.SSLCertFile)
Equals(t, "key-file", passedConfig.SSLKeyFile)
Equals(t, "my-hostname", passedConfig.TFEHostname)
Equals(t, "my-token", passedConfig.TFEToken)
}
@@ -568,6 +571,7 @@ require-mergeable: true
slack-token: slack-token
ssl-cert-file: cert-file
ssl-key-file: key-file
tfe-hostname: my-hostname
tfe-token: my-token
`)
defer os.Remove(tmpFile) // nolint: errcheck
@@ -605,6 +609,7 @@ tfe-token: my-token
Equals(t, "slack-token", passedConfig.SlackToken)
Equals(t, "cert-file", passedConfig.SSLCertFile)
Equals(t, "key-file", passedConfig.SSLKeyFile)
Equals(t, "my-hostname", passedConfig.TFEHostname)
Equals(t, "my-token", passedConfig.TFEToken)
}
@@ -638,6 +643,7 @@ require-approval: true
slack-token: slack-token
ssl-cert-file: cert-file
ssl-key-file: key-file
tfe-hostname: my-hostname
tfe-token: my-token
`)
defer os.Remove(tmpFile) // nolint: errcheck
@@ -672,6 +678,7 @@ tfe-token: my-token
"SLACK_TOKEN": "override-slack-token",
"SSL_CERT_FILE": "override-cert-file",
"SSL_KEY_FILE": "override-key-file",
"TFE_HOSTNAME": "override-my-hostname",
"TFE_TOKEN": "override-my-token",
} {
os.Setenv("ATLANTIS_"+name, value) // nolint: errcheck
@@ -709,6 +716,7 @@ tfe-token: my-token
Equals(t, "override-slack-token", passedConfig.SlackToken)
Equals(t, "override-cert-file", passedConfig.SSLCertFile)
Equals(t, "override-key-file", passedConfig.SSLKeyFile)
Equals(t, "override-my-hostname", passedConfig.TFEHostname)
Equals(t, "override-my-token", passedConfig.TFEToken)
}
@@ -743,6 +751,7 @@ require-mergeable: true
slack-token: slack-token
ssl-cert-file: cert-file
ssl-key-file: key-file
tfe-hostname: my-hostname
tfe-token: my-token
`)
@@ -776,6 +785,7 @@ tfe-token: my-token
cmd.SlackTokenFlag: "override-slack-token",
cmd.SSLCertFileFlag: "override-cert-file",
cmd.SSLKeyFileFlag: "override-key-file",
cmd.TFEHostnameFlag: "override-my-hostname",
cmd.TFETokenFlag: "override-my-token",
})
err := c.Execute()
@@ -807,6 +817,7 @@ tfe-token: my-token
Equals(t, "override-slack-token", passedConfig.SlackToken)
Equals(t, "override-cert-file", passedConfig.SSLCertFile)
Equals(t, "override-key-file", passedConfig.SSLKeyFile)
Equals(t, "override-my-hostname", passedConfig.TFEHostname)
Equals(t, "override-my-token", passedConfig.TFEToken)
}
@@ -843,6 +854,7 @@ func TestExecute_FlagEnvVarOverride(t *testing.T) {
"SLACK_TOKEN": "slack-token",
"SSL_CERT_FILE": "cert-file",
"SSL_KEY_FILE": "key-file",
"TFE_HOSTNAME": "my-hostname",
"TFE_TOKEN": "my-token",
}
for name, value := range envVars {
@@ -884,6 +896,7 @@ func TestExecute_FlagEnvVarOverride(t *testing.T) {
cmd.SlackTokenFlag: "override-slack-token",
cmd.SSLCertFileFlag: "override-cert-file",
cmd.SSLKeyFileFlag: "override-key-file",
cmd.TFEHostnameFlag: "override-my-hostname",
cmd.TFETokenFlag: "override-my-token",
})
err := c.Execute()
@@ -917,6 +930,7 @@ func TestExecute_FlagEnvVarOverride(t *testing.T) {
Equals(t, "override-slack-token", passedConfig.SlackToken)
Equals(t, "override-cert-file", passedConfig.SSLCertFile)
Equals(t, "override-key-file", passedConfig.SSLKeyFile)
Equals(t, "override-my-hostname", passedConfig.TFEHostname)
Equals(t, "override-my-token", passedConfig.TFEToken)
}
@@ -976,6 +990,18 @@ func TestExecute_RepoCfgFlags(t *testing.T) {
ErrEquals(t, "cannot use --repo-config and --repo-config-json at the same time", err)
}
// Can't use both --tfe-hostname flag without --tfe-token.
func TestExecute_TFEHostnameOnly(t *testing.T) {
c := setup(map[string]interface{}{
cmd.GHUserFlag: "user",
cmd.GHTokenFlag: "token",
cmd.RepoWhitelistFlag: "github.com",
cmd.TFEHostnameFlag: "not-app.terraform.io",
})
err := c.Execute()
ErrEquals(t, "if setting --tfe-hostname, must set --tfe-token", err)
}
func setup(flags map[string]interface{}) *cobra.Command {
vipr := viper.New()
for k, v := range flags {

View File

@@ -1,7 +1,7 @@
# This Dockerfile builds our base image with gosu, dumb-init and the atlantis
# user. We split this from the main Dockerfile because this base doesn't change
# and also because it kept breaking the build due to flakiness.
FROM alpine:3.9
FROM alpine:3.10
LABEL authors="Anubhav Mishra, Luke Kysow"
# We use gosu to step down from root and run as the atlantis user so we need

View File

@@ -20,7 +20,7 @@ import (
"github.com/spf13/viper"
)
const atlantisVersion = "0.8.2"
const atlantisVersion = "0.8.3"
func main() {
v := viper.New()

View File

@@ -322,6 +322,7 @@ Or a custom command
* `PULL_NUM` - Pull request number or ID, ex. `2`.
* `PULL_AUTHOR` - Username of the pull request author, ex. `acme-user`.
* `USER_NAME` - Username of the VCS user running command, ex. `acme-user`. During an autoplan, the user will be the Atlantis API user, ex. `atlantis`.
* `COMMENT_ARGS` - Any additional flags passed in the comment on the pull request separated by commas, ex. `atlantis plan -- arg1 arg2` will result in `COMMENT_ARGS=arg1,arg2`.
* A custom command will only terminate if all output file descriptors are closed.
Therefore a custom command can only be sent to the background (e.g. for an SSH tunnel during
the terraform run) when its output is redirected to a different location. For example, Atlantis

View File

@@ -385,6 +385,15 @@ Values are chosen in this order:
atlantis server --ssl-cert-file="/etc/ssl/private/my-cert.key"
```
File containing x509 private key matching `--ssl-cert-file`.
* ### `--tfe-hostname`
```bash
atlantis server --tfe-hostname="my-terraform-enterprise.company.com"
```
Hostname of your Terraform Enterprise installation to be used in conjunction with
`--tfe-token`. See [Terraform Cloud](terraform-cloud.html) for more details.
If using Terraform Cloud (i.e. you don't have your own Terraform Enterprise installation)
no need to set since it defaults to `app.terraform.io`.
* ### `--tfe-token`
```bash

View File

@@ -1,13 +1,14 @@
# Terraform Cloud
# Terraform Cloud/Enterprise
::: tip
Terraform Enterprise was [recently renamed](https://www.hashicorp.com/blog/introducing-terraform-cloud-remote-state-management) Terraform Cloud.
::: tip NOTE
Terraform Enterprise was [recently renamed](https://www.hashicorp.com/blog/introducing-terraform-cloud-remote-state-management) Terraform Cloud
and Private Terraform Enteprise was renamed Terraform Enterprise.
:::
Atlantis integrates seamlessly with Terraform Cloud, whether you're using:
Atlantis integrates seamlessly with Terraform Cloud and Terraform Enterprise, whether you're using:
* [Free Remote State Management](https://app.terraform.io/signup)
* Terraform Cloud Paid Tiers
* Private Terraform Enterprise
* A Private Installation of Terraform Enterprise
Read the docs below :point_down: depending on your use-case.
[[toc]]
@@ -16,20 +17,21 @@ Read the docs below :point_down: depending on your use-case.
To use Atlantis with Free Remote State Storage, you need to:
1. Migrate your state to Terraform Cloud. See [Getting Started with the Terraform Cloud Free Tier](https://www.terraform.io/docs/enterprise/free/index.html#enable-remote-state-in-terraform-configurations)
1. Update any projects that are referencing the state you migrated to use the new location
1. [Generate a Terraform Cloud Token](#generating-a-terraform-cloud-token)
1. [Generate a Terraform Cloud/Enterprise Token](#generating-a-terraform-cloud-enterprise-token)
1. [Pass the token to Atlantis](#passing-the-token-to-atlantis)
That's it! Atlantis will run as normal and your state will be stored in Terraform
Cloud.
## Using Atlantis With Terraform Cloud Paid Tiers
Atlantis integrates with the full version of Terraform Cloud via its [remote backend](https://www.terraform.io/docs/backends/types/remote.html).
## Using Atlantis With Terraform Cloud Remote Operations or Terraform Enterprise
Atlantis integrates with the full version of Terraform Cloud and Terraform Enterprise
via the [remote backend](https://www.terraform.io/docs/backends/types/remote.html).
Atlantis will run `terraform` commands as usual, however those commands will
actually be executed *remotely* in Terraform Cloud.
actually be executed *remotely* in Terraform Cloud or Terraform Enterprise.
### Why?
Using Atlantis with Terraform Cloud gives you access to features like:
Using Atlantis with Terraform Cloud or Terraform Enterprise gives you access to features like:
* Real-time streaming output
* Ability to cancel in-progress commands
* Secret variables
@@ -38,14 +40,14 @@ Using Atlantis with Terraform Cloud gives you access to features like:
**Without** having to change your pull request workflow.
### Getting Started
To use Atlantis with Terraform Cloud Paid Tiers, you need to:
1. Migrate your state to Terraform Cloud. See [Migrating State from Terraform Open Source](https://www.terraform.io/docs/enterprise/migrate/index.html)
To use Atlantis with Terraform Cloud Remote Operations or Terraform Enterprise, you need to:
1. Migrate your state to Terraform Cloud/Enterprise. See [Migrating State from Terraform Open Source](https://www.terraform.io/docs/enterprise/migrate/index.html)
1. Update any projects that are referencing the state you migrated to use the new location
1. [Generate a Terraform Cloud Token](#generating-a-terraform-cloud-token)
1. [Generate a Terraform Cloud/Enterprise Token](#generating-a-terraform-cloud-enterprise-token)
1. [Pass the token to Atlantis](#passing-the-token-to-atlantis)
## Generating a Terraform Cloud Token
Atlantis needs a Terraform Cloud Token that it will use to access the API.
## Generating a Terraform Cloud/Enterprise Token
Atlantis needs a Terraform Cloud/Enterprise Token that it will use to access the API.
Using a **Team Token is recommended**, however you can also use a User Token.
### Team Token
@@ -62,9 +64,18 @@ The token can be passed to Atlantis via the `ATLANTIS_TFE_TOKEN` environment var
You can also use the `--tfe-token` flag, however your token would then be easily
viewable in the process list.
That's it! Atlantis should be able to perform Terraform operations using Terraform Cloud's
If you're hosting your own Terraform Enterprise installation, set the `--tfe-hostname`
flag to its hostname.
That's it! Atlantis should be able to perform Terraform operations using Terraform Cloud/Enterprise's
remote state backend now.
:::warning
The Terraform Cloud/Enterprise integration only works with the built-in
`plan` and `apply` steps. It does not work with custom `run` steps that replace
plan or apply.
:::
:::tip NOTE
Under the hood, Atlantis is generating a `~/.terraformrc` file.
If you already had a `~/.terraformrc` file where Atlantis is running,

View File

@@ -21,7 +21,7 @@ import (
"regexp"
"strings"
shlex "github.com/flynn-archive/go-shlex"
"github.com/flynn-archive/go-shlex"
"github.com/runatlantis/atlantis/server/events/models"
"github.com/runatlantis/atlantis/server/events/yaml"
"github.com/spf13/pflag"
@@ -165,7 +165,6 @@ func (e *CommentParser) Parse(comment string, vcsHost models.VCSHostType) Commen
var dir string
var project string
var verbose bool
var extraArgs []string
var flagSet *pflag.FlagSet
var name models.CommandName
@@ -211,14 +210,9 @@ func (e *CommentParser) Parse(comment string, vcsHost models.VCSHostType) Commen
return CommentParseResult{CommentResponse: e.errMarkdown(fmt.Sprintf("unknown argument(s) %s", strings.Join(unusedArgs, " ")), command, flagSet)}
}
var extraArgs []string
if flagSet.ArgsLenAtDash() != -1 {
extraArgsUnsafe := flagSet.Args()[flagSet.ArgsLenAtDash():]
// Quote all extra args so there isn't a security issue when we append
// them to the terraform commands, ex. "; cat /etc/passwd"
for _, arg := range extraArgsUnsafe {
quotesEscaped := strings.Replace(arg, `"`, `\"`, -1)
extraArgs = append(extraArgs, fmt.Sprintf(`"%s"`, quotesEscaped))
}
extraArgs = flagSet.Args()[flagSet.ArgsLenAtDash():]
}
dir, err = e.validateDir(dir)

View File

@@ -418,7 +418,7 @@ func TestParse_Parsing(t *testing.T) {
"workspace",
"dir",
false,
"\"--verbose\"",
"--verbose",
"",
},
{
@@ -426,7 +426,7 @@ func TestParse_Parsing(t *testing.T) {
"workspace",
"",
false,
"\"-d\" \"dir\" \"--verbose\"",
"-d dir --verbose",
"",
},
// Test the extra args parsing.
@@ -438,21 +438,12 @@ func TestParse_Parsing(t *testing.T) {
"",
"",
},
// Test trying to escape quoting
{
"-- \";echo \"hi",
"",
"",
false,
`";echo hi"`,
"",
},
{
"-w workspace -d dir --verbose -- arg one -two --three &&",
"workspace",
"dir",
true,
"\"arg\" \"one\" \"-two\" \"--three\" \"&&\"",
"arg one -two --three &&",
"",
},
// Test whitespace.
@@ -461,7 +452,7 @@ func TestParse_Parsing(t *testing.T) {
"workspace",
"dir",
true,
"\"arg\" \"one\" \"-two\" \"--three\" \"&&\"",
"arg one -two --three &&",
"",
},
{
@@ -469,7 +460,7 @@ func TestParse_Parsing(t *testing.T) {
"workspace",
"dir",
true,
"\"arg\" \"one\" \"-two\" \"--three\" \"&&\"",
"arg one -two --three &&",
"",
},
// Test that the dir string is normalized.

View File

@@ -335,7 +335,7 @@ func (e *EventParser) parseCommonBitbucketCloudEventData(event bitbucketcloud.Co
prState = models.ClosedPullState
case "SUPERSEDED":
prState = models.ClosedPullState
case "DECLINE":
case "DECLINED":
prState = models.ClosedPullState
default:
err = fmt.Errorf("unable to determine pull request state from %qthis is a bug", *event.PullRequest.State)

View File

@@ -770,7 +770,7 @@ func TestParseBitbucketCloudCommentEvent_MultipleStates(t *testing.T) {
models.ClosedPullState,
},
{
"DECLINE",
"DECLINED",
models.ClosedPullState,
},
}
@@ -786,7 +786,7 @@ func TestParseBitbucketCloudCommentEvent_MultipleStates(t *testing.T) {
}
func TestParseBitbucketCloudPullEvent_ValidEvent(t *testing.T) {
path := filepath.Join("testdata", "bitbucket-cloud-pull-event-fulfilled.json")
path := filepath.Join("testdata", "bitbucket-cloud-pull-event-created.json")
bytes, err := ioutil.ReadFile(path)
if err != nil {
Ok(t, err)
@@ -806,13 +806,13 @@ func TestParseBitbucketCloudPullEvent_ValidEvent(t *testing.T) {
}
Equals(t, expBaseRepo, baseRepo)
Equals(t, models.PullRequest{
Num: 2,
HeadCommit: "e0624da46d3a",
URL: "https://bitbucket.org/lkysow/atlantis-example/pull-requests/2",
HeadBranch: "lkysow/maintf-edited-online-with-bitbucket-1532029690581",
Num: 16,
HeadCommit: "1e69a602caef",
URL: "https://bitbucket.org/lkysow/atlantis-example/pull-requests/16",
HeadBranch: "Luke/maintf-edited-online-with-bitbucket-1560433073473",
BaseBranch: "master",
Author: "lkysow",
State: models.ClosedPullState,
Author: "Luke",
State: models.OpenPullState,
BaseRepo: expBaseRepo,
}, pull)
Equals(t, models.Repo{
@@ -827,10 +827,39 @@ func TestParseBitbucketCloudPullEvent_ValidEvent(t *testing.T) {
},
}, headRepo)
Equals(t, models.User{
Username: "lkysow",
Username: "Luke",
}, user)
}
func TestParseBitbucketCloudPullEvent_States(t *testing.T) {
for _, c := range []struct {
JSON string
ExpState models.PullRequestState
}{
{
JSON: "bitbucket-cloud-pull-event-created.json",
ExpState: models.OpenPullState,
},
{
JSON: "bitbucket-cloud-pull-event-fulfilled.json",
ExpState: models.ClosedPullState,
},
{
JSON: "bitbucket-cloud-pull-event-rejected.json",
ExpState: models.ClosedPullState,
},
} {
path := filepath.Join("testdata", c.JSON)
bytes, err := ioutil.ReadFile(path)
if err != nil {
Ok(t, err)
}
pull, _, _, _, err := parser.ParseBitbucketCloudPullEvent(bytes)
Ok(t, err)
Equals(t, c.ExpState, pull.State)
}
}
func TestGetBitbucketCloudEventType(t *testing.T) {
cases := []struct {
header string

View File

@@ -124,60 +124,60 @@ func (mock *MockBackend) UnlockByPull(repoFullName string, pullNum int) ([]model
return ret0, ret1
}
func (mock *MockBackend) VerifyWasCalledOnce() *VerifierBackend {
return &VerifierBackend{
func (mock *MockBackend) VerifyWasCalledOnce() *VerifierMockBackend {
return &VerifierMockBackend{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockBackend) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierBackend {
return &VerifierBackend{
func (mock *MockBackend) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockBackend {
return &VerifierMockBackend{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockBackend) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierBackend {
return &VerifierBackend{
func (mock *MockBackend) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockBackend {
return &VerifierMockBackend{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockBackend) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierBackend {
return &VerifierBackend{
func (mock *MockBackend) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockBackend {
return &VerifierMockBackend{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierBackend struct {
type VerifierMockBackend struct {
mock *MockBackend
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierBackend) TryLock(lock models.ProjectLock) *Backend_TryLock_OngoingVerification {
func (verifier *VerifierMockBackend) TryLock(lock models.ProjectLock) *MockBackend_TryLock_OngoingVerification {
params := []pegomock.Param{lock}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout)
return &Backend_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockBackend_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Backend_TryLock_OngoingVerification struct {
type MockBackend_TryLock_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *Backend_TryLock_OngoingVerification) GetCapturedArguments() models.ProjectLock {
func (c *MockBackend_TryLock_OngoingVerification) GetCapturedArguments() models.ProjectLock {
lock := c.GetAllCapturedArguments()
return lock[len(lock)-1]
}
func (c *Backend_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectLock) {
func (c *MockBackend_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectLock) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.ProjectLock, len(params[0]))
@@ -188,23 +188,23 @@ func (c *Backend_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0
return
}
func (verifier *VerifierBackend) Unlock(project models.Project, workspace string) *Backend_Unlock_OngoingVerification {
func (verifier *VerifierMockBackend) Unlock(project models.Project, workspace string) *MockBackend_Unlock_OngoingVerification {
params := []pegomock.Param{project, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", params, verifier.timeout)
return &Backend_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockBackend_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Backend_Unlock_OngoingVerification struct {
type MockBackend_Unlock_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *Backend_Unlock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
func (c *MockBackend_Unlock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
project, workspace := c.GetAllCapturedArguments()
return project[len(project)-1], workspace[len(workspace)-1]
}
func (c *Backend_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
func (c *MockBackend_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Project, len(params[0]))
@@ -219,40 +219,40 @@ func (c *Backend_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0
return
}
func (verifier *VerifierBackend) List() *Backend_List_OngoingVerification {
func (verifier *VerifierMockBackend) List() *MockBackend_List_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "List", params, verifier.timeout)
return &Backend_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockBackend_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Backend_List_OngoingVerification struct {
type MockBackend_List_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *Backend_List_OngoingVerification) GetCapturedArguments() {
func (c *MockBackend_List_OngoingVerification) GetCapturedArguments() {
}
func (c *Backend_List_OngoingVerification) GetAllCapturedArguments() {
func (c *MockBackend_List_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierBackend) GetLock(project models.Project, workspace string) *Backend_GetLock_OngoingVerification {
func (verifier *VerifierMockBackend) GetLock(project models.Project, workspace string) *MockBackend_GetLock_OngoingVerification {
params := []pegomock.Param{project, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLock", params, verifier.timeout)
return &Backend_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockBackend_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Backend_GetLock_OngoingVerification struct {
type MockBackend_GetLock_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *Backend_GetLock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
func (c *MockBackend_GetLock_OngoingVerification) GetCapturedArguments() (models.Project, string) {
project, workspace := c.GetAllCapturedArguments()
return project[len(project)-1], workspace[len(workspace)-1]
}
func (c *Backend_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
func (c *MockBackend_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Project, len(params[0]))
@@ -267,23 +267,23 @@ func (c *Backend_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0
return
}
func (verifier *VerifierBackend) UnlockByPull(repoFullName string, pullNum int) *Backend_UnlockByPull_OngoingVerification {
func (verifier *VerifierMockBackend) UnlockByPull(repoFullName string, pullNum int) *MockBackend_UnlockByPull_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockByPull", params, verifier.timeout)
return &Backend_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockBackend_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Backend_UnlockByPull_OngoingVerification struct {
type MockBackend_UnlockByPull_OngoingVerification struct {
mock *MockBackend
methodInvocations []pegomock.MethodInvocation
}
func (c *Backend_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
func (c *MockBackend_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
}
func (c *Backend_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
func (c *MockBackend_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -121,60 +121,60 @@ func (mock *MockLocker) GetLock(key string) (*models.ProjectLock, error) {
return ret0, ret1
}
func (mock *MockLocker) VerifyWasCalledOnce() *VerifierLocker {
return &VerifierLocker{
func (mock *MockLocker) VerifyWasCalledOnce() *VerifierMockLocker {
return &VerifierMockLocker{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockLocker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierLocker {
return &VerifierLocker{
func (mock *MockLocker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockLocker {
return &VerifierMockLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierLocker {
return &VerifierLocker{
func (mock *MockLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockLocker {
return &VerifierMockLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierLocker {
return &VerifierLocker{
func (mock *MockLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockLocker {
return &VerifierMockLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierLocker struct {
type VerifierMockLocker struct {
mock *MockLocker
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierLocker) TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) *Locker_TryLock_OngoingVerification {
func (verifier *VerifierMockLocker) TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) *MockLocker_TryLock_OngoingVerification {
params := []pegomock.Param{p, workspace, pull, user}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout)
return &Locker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Locker_TryLock_OngoingVerification struct {
type MockLocker_TryLock_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *Locker_TryLock_OngoingVerification) GetCapturedArguments() (models.Project, string, models.PullRequest, models.User) {
func (c *MockLocker_TryLock_OngoingVerification) GetCapturedArguments() (models.Project, string, models.PullRequest, models.User) {
p, workspace, pull, user := c.GetAllCapturedArguments()
return p[len(p)-1], workspace[len(workspace)-1], pull[len(pull)-1], user[len(user)-1]
}
func (c *Locker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string, _param2 []models.PullRequest, _param3 []models.User) {
func (c *MockLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string, _param2 []models.PullRequest, _param3 []models.User) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Project, len(params[0]))
@@ -197,23 +197,23 @@ func (c *Locker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0
return
}
func (verifier *VerifierLocker) Unlock(key string) *Locker_Unlock_OngoingVerification {
func (verifier *VerifierMockLocker) Unlock(key string) *MockLocker_Unlock_OngoingVerification {
params := []pegomock.Param{key}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Unlock", params, verifier.timeout)
return &Locker_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockLocker_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Locker_Unlock_OngoingVerification struct {
type MockLocker_Unlock_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *Locker_Unlock_OngoingVerification) GetCapturedArguments() string {
func (c *MockLocker_Unlock_OngoingVerification) GetCapturedArguments() string {
key := c.GetAllCapturedArguments()
return key[len(key)-1]
}
func (c *Locker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -224,40 +224,40 @@ func (c *Locker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 [
return
}
func (verifier *VerifierLocker) List() *Locker_List_OngoingVerification {
func (verifier *VerifierMockLocker) List() *MockLocker_List_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "List", params, verifier.timeout)
return &Locker_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockLocker_List_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Locker_List_OngoingVerification struct {
type MockLocker_List_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *Locker_List_OngoingVerification) GetCapturedArguments() {
func (c *MockLocker_List_OngoingVerification) GetCapturedArguments() {
}
func (c *Locker_List_OngoingVerification) GetAllCapturedArguments() {
func (c *MockLocker_List_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierLocker) UnlockByPull(repoFullName string, pullNum int) *Locker_UnlockByPull_OngoingVerification {
func (verifier *VerifierMockLocker) UnlockByPull(repoFullName string, pullNum int) *MockLocker_UnlockByPull_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockByPull", params, verifier.timeout)
return &Locker_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockLocker_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Locker_UnlockByPull_OngoingVerification struct {
type MockLocker_UnlockByPull_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *Locker_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
func (c *MockLocker_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) {
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
}
func (c *Locker_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
func (c *MockLocker_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -272,23 +272,23 @@ func (c *Locker_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierLocker) GetLock(key string) *Locker_GetLock_OngoingVerification {
func (verifier *VerifierMockLocker) GetLock(key string) *MockLocker_GetLock_OngoingVerification {
params := []pegomock.Param{key}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLock", params, verifier.timeout)
return &Locker_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockLocker_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Locker_GetLock_OngoingVerification struct {
type MockLocker_GetLock_OngoingVerification struct {
mock *MockLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *Locker_GetLock_OngoingVerification) GetCapturedArguments() string {
func (c *MockLocker_GetLock_OngoingVerification) GetCapturedArguments() string {
key := c.GetAllCapturedArguments()
return key[len(key)-1]
}
func (c *Locker_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockLocker_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -114,60 +114,60 @@ func (mock *MockWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullReque
return ret0
}
func (mock *MockWorkingDir) VerifyWasCalledOnce() *VerifierWorkingDir {
return &VerifierWorkingDir{
func (mock *MockWorkingDir) VerifyWasCalledOnce() *VerifierMockWorkingDir {
return &VerifierMockWorkingDir{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockWorkingDir) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierWorkingDir {
return &VerifierWorkingDir{
func (mock *MockWorkingDir) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockWorkingDir {
return &VerifierMockWorkingDir{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockWorkingDir) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierWorkingDir {
return &VerifierWorkingDir{
func (mock *MockWorkingDir) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockWorkingDir {
return &VerifierMockWorkingDir{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockWorkingDir) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierWorkingDir {
return &VerifierWorkingDir{
func (mock *MockWorkingDir) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockWorkingDir {
return &VerifierMockWorkingDir{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierWorkingDir struct {
type VerifierMockWorkingDir struct {
mock *MockWorkingDir
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierWorkingDir) Clone(log *logging.SimpleLogger, baseRepo models.Repo, headRepo models.Repo, p models.PullRequest, workspace string) *WorkingDir_Clone_OngoingVerification {
func (verifier *VerifierMockWorkingDir) Clone(log *logging.SimpleLogger, baseRepo models.Repo, headRepo models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_Clone_OngoingVerification {
params := []pegomock.Param{log, baseRepo, headRepo, p, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Clone", params, verifier.timeout)
return &WorkingDir_Clone_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_Clone_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_Clone_OngoingVerification struct {
type MockWorkingDir_Clone_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_Clone_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, models.Repo, models.Repo, models.PullRequest, string) {
func (c *MockWorkingDir_Clone_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, models.Repo, models.Repo, models.PullRequest, string) {
log, baseRepo, headRepo, p, workspace := c.GetAllCapturedArguments()
return log[len(log)-1], baseRepo[len(baseRepo)-1], headRepo[len(headRepo)-1], p[len(p)-1], workspace[len(workspace)-1]
}
func (c *WorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []models.Repo, _param2 []models.Repo, _param3 []models.PullRequest, _param4 []string) {
func (c *MockWorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []models.Repo, _param2 []models.Repo, _param3 []models.PullRequest, _param4 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*logging.SimpleLogger, len(params[0]))
@@ -194,23 +194,23 @@ func (c *WorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param
return
}
func (verifier *VerifierWorkingDir) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) *WorkingDir_GetWorkingDir_OngoingVerification {
func (verifier *VerifierMockWorkingDir) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_GetWorkingDir_OngoingVerification {
params := []pegomock.Param{r, p, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetWorkingDir", params, verifier.timeout)
return &WorkingDir_GetWorkingDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_GetWorkingDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_GetWorkingDir_OngoingVerification struct {
type MockWorkingDir_GetWorkingDir_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_GetWorkingDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
r, p, workspace := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1]
}
func (c *WorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -229,23 +229,23 @@ func (c *WorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) *WorkingDir_GetPullDir_OngoingVerification {
func (verifier *VerifierMockWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) *MockWorkingDir_GetPullDir_OngoingVerification {
params := []pegomock.Param{r, p}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullDir", params, verifier.timeout)
return &WorkingDir_GetPullDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_GetPullDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_GetPullDir_OngoingVerification struct {
type MockWorkingDir_GetPullDir_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_GetPullDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
r, p := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1]
}
func (c *WorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -260,23 +260,23 @@ func (c *WorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_
return
}
func (verifier *VerifierWorkingDir) Delete(r models.Repo, p models.PullRequest) *WorkingDir_Delete_OngoingVerification {
func (verifier *VerifierMockWorkingDir) Delete(r models.Repo, p models.PullRequest) *MockWorkingDir_Delete_OngoingVerification {
params := []pegomock.Param{r, p}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Delete", params, verifier.timeout)
return &WorkingDir_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_Delete_OngoingVerification struct {
type MockWorkingDir_Delete_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_Delete_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockWorkingDir_Delete_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
r, p := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1]
}
func (c *WorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockWorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -291,23 +291,23 @@ func (c *WorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_para
return
}
func (verifier *VerifierWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) *WorkingDir_DeleteForWorkspace_OngoingVerification {
func (verifier *VerifierMockWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_DeleteForWorkspace_OngoingVerification {
params := []pegomock.Param{r, p, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeleteForWorkspace", params, verifier.timeout)
return &WorkingDir_DeleteForWorkspace_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_DeleteForWorkspace_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_DeleteForWorkspace_OngoingVerification struct {
type MockWorkingDir_DeleteForWorkspace_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_DeleteForWorkspace_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
r, p, workspace := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1]
}
func (c *WorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))

View File

@@ -1,20 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/models"
"reflect"
)
func AnyEventsCommandName() models.CommandName {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.CommandName))(nil)).Elem()))
var nullValue models.CommandName
return nullValue
}
func EqEventsCommandName(value models.CommandName) models.CommandName {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue models.CommandName
return nullValue
}

View File

@@ -1,20 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
events "github.com/runatlantis/atlantis/server/events"
)
func AnyEventsCommandResult() events.CommandResult {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(events.CommandResult))(nil)).Elem()))
var nullValue events.CommandResult
return nullValue
}
func EqEventsCommandResult(value events.CommandResult) events.CommandResult {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue events.CommandResult
return nullValue
}

View File

@@ -1,20 +0,0 @@
// Code generated by pegomock. DO NOT EDIT.
package matchers
import (
"github.com/petergtz/pegomock"
"github.com/runatlantis/atlantis/server/events/models"
"reflect"
)
func AnyEventsProjectResult() models.ProjectResult {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.ProjectResult))(nil)).Elem()))
var nullValue models.ProjectResult
return nullValue
}
func EqEventsProjectResult(value models.ProjectResult) models.ProjectResult {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue models.ProjectResult
return nullValue
}

View File

@@ -42,60 +42,60 @@ func (mock *MockCommandRunner) RunAutoplanCommand(baseRepo models.Repo, headRepo
pegomock.GetGenericMockFrom(mock).Invoke("RunAutoplanCommand", params, []reflect.Type{})
}
func (mock *MockCommandRunner) VerifyWasCalledOnce() *VerifierCommandRunner {
return &VerifierCommandRunner{
func (mock *MockCommandRunner) VerifyWasCalledOnce() *VerifierMockCommandRunner {
return &VerifierMockCommandRunner{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockCommandRunner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierCommandRunner {
return &VerifierCommandRunner{
func (mock *MockCommandRunner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockCommandRunner {
return &VerifierMockCommandRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockCommandRunner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierCommandRunner {
return &VerifierCommandRunner{
func (mock *MockCommandRunner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockCommandRunner {
return &VerifierMockCommandRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockCommandRunner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierCommandRunner {
return &VerifierCommandRunner{
func (mock *MockCommandRunner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockCommandRunner {
return &VerifierMockCommandRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierCommandRunner struct {
type VerifierMockCommandRunner struct {
mock *MockCommandRunner
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierCommandRunner) RunCommentCommand(baseRepo models.Repo, maybeHeadRepo *models.Repo, maybePull *models.PullRequest, user models.User, pullNum int, cmd *events.CommentCommand) *CommandRunner_RunCommentCommand_OngoingVerification {
func (verifier *VerifierMockCommandRunner) RunCommentCommand(baseRepo models.Repo, maybeHeadRepo *models.Repo, maybePull *models.PullRequest, user models.User, pullNum int, cmd *events.CommentCommand) *MockCommandRunner_RunCommentCommand_OngoingVerification {
params := []pegomock.Param{baseRepo, maybeHeadRepo, maybePull, user, pullNum, cmd}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunCommentCommand", params, verifier.timeout)
return &CommandRunner_RunCommentCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCommandRunner_RunCommentCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type CommandRunner_RunCommentCommand_OngoingVerification struct {
type MockCommandRunner_RunCommentCommand_OngoingVerification struct {
mock *MockCommandRunner
methodInvocations []pegomock.MethodInvocation
}
func (c *CommandRunner_RunCommentCommand_OngoingVerification) GetCapturedArguments() (models.Repo, *models.Repo, *models.PullRequest, models.User, int, *events.CommentCommand) {
func (c *MockCommandRunner_RunCommentCommand_OngoingVerification) GetCapturedArguments() (models.Repo, *models.Repo, *models.PullRequest, models.User, int, *events.CommentCommand) {
baseRepo, maybeHeadRepo, maybePull, user, pullNum, cmd := c.GetAllCapturedArguments()
return baseRepo[len(baseRepo)-1], maybeHeadRepo[len(maybeHeadRepo)-1], maybePull[len(maybePull)-1], user[len(user)-1], pullNum[len(pullNum)-1], cmd[len(cmd)-1]
}
func (c *CommandRunner_RunCommentCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []*models.Repo, _param2 []*models.PullRequest, _param3 []models.User, _param4 []int, _param5 []*events.CommentCommand) {
func (c *MockCommandRunner_RunCommentCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []*models.Repo, _param2 []*models.PullRequest, _param3 []models.User, _param4 []int, _param5 []*events.CommentCommand) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -126,23 +126,23 @@ func (c *CommandRunner_RunCommentCommand_OngoingVerification) GetAllCapturedArgu
return
}
func (verifier *VerifierCommandRunner) RunAutoplanCommand(baseRepo models.Repo, headRepo models.Repo, pull models.PullRequest, user models.User) *CommandRunner_RunAutoplanCommand_OngoingVerification {
func (verifier *VerifierMockCommandRunner) RunAutoplanCommand(baseRepo models.Repo, headRepo models.Repo, pull models.PullRequest, user models.User) *MockCommandRunner_RunAutoplanCommand_OngoingVerification {
params := []pegomock.Param{baseRepo, headRepo, pull, user}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunAutoplanCommand", params, verifier.timeout)
return &CommandRunner_RunAutoplanCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCommandRunner_RunAutoplanCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type CommandRunner_RunAutoplanCommand_OngoingVerification struct {
type MockCommandRunner_RunAutoplanCommand_OngoingVerification struct {
mock *MockCommandRunner
methodInvocations []pegomock.MethodInvocation
}
func (c *CommandRunner_RunAutoplanCommand_OngoingVerification) GetCapturedArguments() (models.Repo, models.Repo, models.PullRequest, models.User) {
func (c *MockCommandRunner_RunAutoplanCommand_OngoingVerification) GetCapturedArguments() (models.Repo, models.Repo, models.PullRequest, models.User) {
baseRepo, headRepo, pull, user := c.GetAllCapturedArguments()
return baseRepo[len(baseRepo)-1], headRepo[len(headRepo)-1], pull[len(pull)-1], user[len(user)-1]
}
func (c *CommandRunner_RunAutoplanCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.Repo, _param2 []models.PullRequest, _param3 []models.User) {
func (c *MockCommandRunner_RunAutoplanCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.Repo, _param2 []models.PullRequest, _param3 []models.User) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))

View File

@@ -41,60 +41,60 @@ func (mock *MockCommentParsing) Parse(comment string, vcsHost models.VCSHostType
return ret0
}
func (mock *MockCommentParsing) VerifyWasCalledOnce() *VerifierCommentParsing {
return &VerifierCommentParsing{
func (mock *MockCommentParsing) VerifyWasCalledOnce() *VerifierMockCommentParsing {
return &VerifierMockCommentParsing{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockCommentParsing) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierCommentParsing {
return &VerifierCommentParsing{
func (mock *MockCommentParsing) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockCommentParsing {
return &VerifierMockCommentParsing{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockCommentParsing) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierCommentParsing {
return &VerifierCommentParsing{
func (mock *MockCommentParsing) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockCommentParsing {
return &VerifierMockCommentParsing{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockCommentParsing) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierCommentParsing {
return &VerifierCommentParsing{
func (mock *MockCommentParsing) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockCommentParsing {
return &VerifierMockCommentParsing{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierCommentParsing struct {
type VerifierMockCommentParsing struct {
mock *MockCommentParsing
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierCommentParsing) Parse(comment string, vcsHost models.VCSHostType) *CommentParsing_Parse_OngoingVerification {
func (verifier *VerifierMockCommentParsing) Parse(comment string, vcsHost models.VCSHostType) *MockCommentParsing_Parse_OngoingVerification {
params := []pegomock.Param{comment, vcsHost}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Parse", params, verifier.timeout)
return &CommentParsing_Parse_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCommentParsing_Parse_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type CommentParsing_Parse_OngoingVerification struct {
type MockCommentParsing_Parse_OngoingVerification struct {
mock *MockCommentParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *CommentParsing_Parse_OngoingVerification) GetCapturedArguments() (string, models.VCSHostType) {
func (c *MockCommentParsing_Parse_OngoingVerification) GetCapturedArguments() (string, models.VCSHostType) {
comment, vcsHost := c.GetAllCapturedArguments()
return comment[len(comment)-1], vcsHost[len(vcsHost)-1]
}
func (c *CommentParsing_Parse_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []models.VCSHostType) {
func (c *MockCommentParsing_Parse_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []models.VCSHostType) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -70,60 +70,60 @@ func (mock *MockCommitStatusUpdater) UpdateProject(ctx models.ProjectCommandCont
return ret0
}
func (mock *MockCommitStatusUpdater) VerifyWasCalledOnce() *VerifierCommitStatusUpdater {
return &VerifierCommitStatusUpdater{
func (mock *MockCommitStatusUpdater) VerifyWasCalledOnce() *VerifierMockCommitStatusUpdater {
return &VerifierMockCommitStatusUpdater{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockCommitStatusUpdater) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierCommitStatusUpdater {
return &VerifierCommitStatusUpdater{
func (mock *MockCommitStatusUpdater) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockCommitStatusUpdater {
return &VerifierMockCommitStatusUpdater{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockCommitStatusUpdater) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierCommitStatusUpdater {
return &VerifierCommitStatusUpdater{
func (mock *MockCommitStatusUpdater) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockCommitStatusUpdater {
return &VerifierMockCommitStatusUpdater{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockCommitStatusUpdater) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierCommitStatusUpdater {
return &VerifierCommitStatusUpdater{
func (mock *MockCommitStatusUpdater) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockCommitStatusUpdater {
return &VerifierMockCommitStatusUpdater{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierCommitStatusUpdater struct {
type VerifierMockCommitStatusUpdater struct {
mock *MockCommitStatusUpdater
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierCommitStatusUpdater) UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, command models.CommandName) *CommitStatusUpdater_UpdateCombined_OngoingVerification {
func (verifier *VerifierMockCommitStatusUpdater) UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, command models.CommandName) *MockCommitStatusUpdater_UpdateCombined_OngoingVerification {
params := []pegomock.Param{repo, pull, status, command}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateCombined", params, verifier.timeout)
return &CommitStatusUpdater_UpdateCombined_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCommitStatusUpdater_UpdateCombined_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type CommitStatusUpdater_UpdateCombined_OngoingVerification struct {
type MockCommitStatusUpdater_UpdateCombined_OngoingVerification struct {
mock *MockCommitStatusUpdater
methodInvocations []pegomock.MethodInvocation
}
func (c *CommitStatusUpdater_UpdateCombined_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, models.CommandName) {
func (c *MockCommitStatusUpdater_UpdateCombined_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, models.CommandName) {
repo, pull, status, command := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1], status[len(status)-1], command[len(command)-1]
}
func (c *CommitStatusUpdater_UpdateCombined_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []models.CommandName) {
func (c *MockCommitStatusUpdater_UpdateCombined_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []models.CommandName) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -146,23 +146,23 @@ func (c *CommitStatusUpdater_UpdateCombined_OngoingVerification) GetAllCapturedA
return
}
func (verifier *VerifierCommitStatusUpdater) UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, command models.CommandName, numSuccess int, numTotal int) *CommitStatusUpdater_UpdateCombinedCount_OngoingVerification {
func (verifier *VerifierMockCommitStatusUpdater) UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, command models.CommandName, numSuccess int, numTotal int) *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification {
params := []pegomock.Param{repo, pull, status, command, numSuccess, numTotal}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateCombinedCount", params, verifier.timeout)
return &CommitStatusUpdater_UpdateCombinedCount_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type CommitStatusUpdater_UpdateCombinedCount_OngoingVerification struct {
type MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification struct {
mock *MockCommitStatusUpdater
methodInvocations []pegomock.MethodInvocation
}
func (c *CommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, models.CommandName, int, int) {
func (c *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, models.CommandName, int, int) {
repo, pull, status, command, numSuccess, numTotal := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1], status[len(status)-1], command[len(command)-1], numSuccess[len(numSuccess)-1], numTotal[len(numTotal)-1]
}
func (c *CommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []models.CommandName, _param4 []int, _param5 []int) {
func (c *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []models.CommandName, _param4 []int, _param5 []int) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -193,23 +193,23 @@ func (c *CommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetAllCapt
return
}
func (verifier *VerifierCommitStatusUpdater) UpdateProject(ctx models.ProjectCommandContext, cmdName models.CommandName, status models.CommitStatus, url string) *CommitStatusUpdater_UpdateProject_OngoingVerification {
func (verifier *VerifierMockCommitStatusUpdater) UpdateProject(ctx models.ProjectCommandContext, cmdName models.CommandName, status models.CommitStatus, url string) *MockCommitStatusUpdater_UpdateProject_OngoingVerification {
params := []pegomock.Param{ctx, cmdName, status, url}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateProject", params, verifier.timeout)
return &CommitStatusUpdater_UpdateProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCommitStatusUpdater_UpdateProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type CommitStatusUpdater_UpdateProject_OngoingVerification struct {
type MockCommitStatusUpdater_UpdateProject_OngoingVerification struct {
mock *MockCommitStatusUpdater
methodInvocations []pegomock.MethodInvocation
}
func (c *CommitStatusUpdater_UpdateProject_OngoingVerification) GetCapturedArguments() (models.ProjectCommandContext, models.CommandName, models.CommitStatus, string) {
func (c *MockCommitStatusUpdater_UpdateProject_OngoingVerification) GetCapturedArguments() (models.ProjectCommandContext, models.CommandName, models.CommitStatus, string) {
ctx, cmdName, status, url := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], cmdName[len(cmdName)-1], status[len(status)-1], url[len(url)-1]
}
func (c *CommitStatusUpdater_UpdateProject_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext, _param1 []models.CommandName, _param2 []models.CommitStatus, _param3 []string) {
func (c *MockCommitStatusUpdater_UpdateProject_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext, _param1 []models.CommandName, _param2 []models.CommitStatus, _param3 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.ProjectCommandContext, len(params[0]))

View File

@@ -44,60 +44,60 @@ func (mock *MockCustomStepRunner) Run(ctx models.ProjectCommandContext, cmd stri
return ret0, ret1
}
func (mock *MockCustomStepRunner) VerifyWasCalledOnce() *VerifierCustomStepRunner {
return &VerifierCustomStepRunner{
func (mock *MockCustomStepRunner) VerifyWasCalledOnce() *VerifierMockCustomStepRunner {
return &VerifierMockCustomStepRunner{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockCustomStepRunner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierCustomStepRunner {
return &VerifierCustomStepRunner{
func (mock *MockCustomStepRunner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockCustomStepRunner {
return &VerifierMockCustomStepRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockCustomStepRunner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierCustomStepRunner {
return &VerifierCustomStepRunner{
func (mock *MockCustomStepRunner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockCustomStepRunner {
return &VerifierMockCustomStepRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockCustomStepRunner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierCustomStepRunner {
return &VerifierCustomStepRunner{
func (mock *MockCustomStepRunner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockCustomStepRunner {
return &VerifierMockCustomStepRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierCustomStepRunner struct {
type VerifierMockCustomStepRunner struct {
mock *MockCustomStepRunner
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierCustomStepRunner) Run(ctx models.ProjectCommandContext, cmd string, path string) *CustomStepRunner_Run_OngoingVerification {
func (verifier *VerifierMockCustomStepRunner) Run(ctx models.ProjectCommandContext, cmd string, path string) *MockCustomStepRunner_Run_OngoingVerification {
params := []pegomock.Param{ctx, cmd, path}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout)
return &CustomStepRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockCustomStepRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type CustomStepRunner_Run_OngoingVerification struct {
type MockCustomStepRunner_Run_OngoingVerification struct {
mock *MockCustomStepRunner
methodInvocations []pegomock.MethodInvocation
}
func (c *CustomStepRunner_Run_OngoingVerification) GetCapturedArguments() (models.ProjectCommandContext, string, string) {
func (c *MockCustomStepRunner_Run_OngoingVerification) GetCapturedArguments() (models.ProjectCommandContext, string, string) {
ctx, cmd, path := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], cmd[len(cmd)-1], path[len(path)-1]
}
func (c *CustomStepRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext, _param1 []string, _param2 []string) {
func (c *MockCustomStepRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext, _param1 []string, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.ProjectCommandContext, len(params[0]))

View File

@@ -374,60 +374,60 @@ func (mock *MockEventParsing) GetBitbucketServerPullEventType(eventTypeHeader st
return ret0
}
func (mock *MockEventParsing) VerifyWasCalledOnce() *VerifierEventParsing {
return &VerifierEventParsing{
func (mock *MockEventParsing) VerifyWasCalledOnce() *VerifierMockEventParsing {
return &VerifierMockEventParsing{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockEventParsing) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierEventParsing {
return &VerifierEventParsing{
func (mock *MockEventParsing) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockEventParsing {
return &VerifierMockEventParsing{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockEventParsing) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierEventParsing {
return &VerifierEventParsing{
func (mock *MockEventParsing) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockEventParsing {
return &VerifierMockEventParsing{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockEventParsing) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierEventParsing {
return &VerifierEventParsing{
func (mock *MockEventParsing) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockEventParsing {
return &VerifierMockEventParsing{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierEventParsing struct {
type VerifierMockEventParsing struct {
mock *MockEventParsing
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierEventParsing) ParseGithubIssueCommentEvent(comment *github.IssueCommentEvent) *EventParsing_ParseGithubIssueCommentEvent_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseGithubIssueCommentEvent(comment *github.IssueCommentEvent) *MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification {
params := []pegomock.Param{comment}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseGithubIssueCommentEvent", params, verifier.timeout)
return &EventParsing_ParseGithubIssueCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseGithubIssueCommentEvent_OngoingVerification struct {
type MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseGithubIssueCommentEvent_OngoingVerification) GetCapturedArguments() *github.IssueCommentEvent {
func (c *MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification) GetCapturedArguments() *github.IssueCommentEvent {
comment := c.GetAllCapturedArguments()
return comment[len(comment)-1]
}
func (c *EventParsing_ParseGithubIssueCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.IssueCommentEvent) {
func (c *MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.IssueCommentEvent) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*github.IssueCommentEvent, len(params[0]))
@@ -438,23 +438,23 @@ func (c *EventParsing_ParseGithubIssueCommentEvent_OngoingVerification) GetAllCa
return
}
func (verifier *VerifierEventParsing) ParseGithubPull(ghPull *github.PullRequest) *EventParsing_ParseGithubPull_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseGithubPull(ghPull *github.PullRequest) *MockEventParsing_ParseGithubPull_OngoingVerification {
params := []pegomock.Param{ghPull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseGithubPull", params, verifier.timeout)
return &EventParsing_ParseGithubPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseGithubPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseGithubPull_OngoingVerification struct {
type MockEventParsing_ParseGithubPull_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseGithubPull_OngoingVerification) GetCapturedArguments() *github.PullRequest {
func (c *MockEventParsing_ParseGithubPull_OngoingVerification) GetCapturedArguments() *github.PullRequest {
ghPull := c.GetAllCapturedArguments()
return ghPull[len(ghPull)-1]
}
func (c *EventParsing_ParseGithubPull_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.PullRequest) {
func (c *MockEventParsing_ParseGithubPull_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*github.PullRequest, len(params[0]))
@@ -465,23 +465,23 @@ func (c *EventParsing_ParseGithubPull_OngoingVerification) GetAllCapturedArgumen
return
}
func (verifier *VerifierEventParsing) ParseGithubPullEvent(pullEvent *github.PullRequestEvent) *EventParsing_ParseGithubPullEvent_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseGithubPullEvent(pullEvent *github.PullRequestEvent) *MockEventParsing_ParseGithubPullEvent_OngoingVerification {
params := []pegomock.Param{pullEvent}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseGithubPullEvent", params, verifier.timeout)
return &EventParsing_ParseGithubPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseGithubPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseGithubPullEvent_OngoingVerification struct {
type MockEventParsing_ParseGithubPullEvent_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseGithubPullEvent_OngoingVerification) GetCapturedArguments() *github.PullRequestEvent {
func (c *MockEventParsing_ParseGithubPullEvent_OngoingVerification) GetCapturedArguments() *github.PullRequestEvent {
pullEvent := c.GetAllCapturedArguments()
return pullEvent[len(pullEvent)-1]
}
func (c *EventParsing_ParseGithubPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.PullRequestEvent) {
func (c *MockEventParsing_ParseGithubPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.PullRequestEvent) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*github.PullRequestEvent, len(params[0]))
@@ -492,23 +492,23 @@ func (c *EventParsing_ParseGithubPullEvent_OngoingVerification) GetAllCapturedAr
return
}
func (verifier *VerifierEventParsing) ParseGithubRepo(ghRepo *github.Repository) *EventParsing_ParseGithubRepo_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseGithubRepo(ghRepo *github.Repository) *MockEventParsing_ParseGithubRepo_OngoingVerification {
params := []pegomock.Param{ghRepo}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseGithubRepo", params, verifier.timeout)
return &EventParsing_ParseGithubRepo_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseGithubRepo_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseGithubRepo_OngoingVerification struct {
type MockEventParsing_ParseGithubRepo_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseGithubRepo_OngoingVerification) GetCapturedArguments() *github.Repository {
func (c *MockEventParsing_ParseGithubRepo_OngoingVerification) GetCapturedArguments() *github.Repository {
ghRepo := c.GetAllCapturedArguments()
return ghRepo[len(ghRepo)-1]
}
func (c *EventParsing_ParseGithubRepo_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.Repository) {
func (c *MockEventParsing_ParseGithubRepo_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.Repository) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*github.Repository, len(params[0]))
@@ -519,23 +519,23 @@ func (c *EventParsing_ParseGithubRepo_OngoingVerification) GetAllCapturedArgumen
return
}
func (verifier *VerifierEventParsing) ParseGitlabMergeRequestEvent(event go_gitlab.MergeEvent) *EventParsing_ParseGitlabMergeRequestEvent_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseGitlabMergeRequestEvent(event go_gitlab.MergeEvent) *MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification {
params := []pegomock.Param{event}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseGitlabMergeRequestEvent", params, verifier.timeout)
return &EventParsing_ParseGitlabMergeRequestEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseGitlabMergeRequestEvent_OngoingVerification struct {
type MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseGitlabMergeRequestEvent_OngoingVerification) GetCapturedArguments() go_gitlab.MergeEvent {
func (c *MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification) GetCapturedArguments() go_gitlab.MergeEvent {
event := c.GetAllCapturedArguments()
return event[len(event)-1]
}
func (c *EventParsing_ParseGitlabMergeRequestEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []go_gitlab.MergeEvent) {
func (c *MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []go_gitlab.MergeEvent) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]go_gitlab.MergeEvent, len(params[0]))
@@ -546,23 +546,23 @@ func (c *EventParsing_ParseGitlabMergeRequestEvent_OngoingVerification) GetAllCa
return
}
func (verifier *VerifierEventParsing) ParseGitlabMergeRequestCommentEvent(event go_gitlab.MergeCommentEvent) *EventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseGitlabMergeRequestCommentEvent(event go_gitlab.MergeCommentEvent) *MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification {
params := []pegomock.Param{event}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseGitlabMergeRequestCommentEvent", params, verifier.timeout)
return &EventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification struct {
type MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification) GetCapturedArguments() go_gitlab.MergeCommentEvent {
func (c *MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification) GetCapturedArguments() go_gitlab.MergeCommentEvent {
event := c.GetAllCapturedArguments()
return event[len(event)-1]
}
func (c *EventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []go_gitlab.MergeCommentEvent) {
func (c *MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []go_gitlab.MergeCommentEvent) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]go_gitlab.MergeCommentEvent, len(params[0]))
@@ -573,23 +573,23 @@ func (c *EventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification) G
return
}
func (verifier *VerifierEventParsing) ParseGitlabMergeRequest(mr *go_gitlab.MergeRequest, baseRepo models.Repo) *EventParsing_ParseGitlabMergeRequest_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseGitlabMergeRequest(mr *go_gitlab.MergeRequest, baseRepo models.Repo) *MockEventParsing_ParseGitlabMergeRequest_OngoingVerification {
params := []pegomock.Param{mr, baseRepo}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseGitlabMergeRequest", params, verifier.timeout)
return &EventParsing_ParseGitlabMergeRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseGitlabMergeRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseGitlabMergeRequest_OngoingVerification struct {
type MockEventParsing_ParseGitlabMergeRequest_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseGitlabMergeRequest_OngoingVerification) GetCapturedArguments() (*go_gitlab.MergeRequest, models.Repo) {
func (c *MockEventParsing_ParseGitlabMergeRequest_OngoingVerification) GetCapturedArguments() (*go_gitlab.MergeRequest, models.Repo) {
mr, baseRepo := c.GetAllCapturedArguments()
return mr[len(mr)-1], baseRepo[len(baseRepo)-1]
}
func (c *EventParsing_ParseGitlabMergeRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []*go_gitlab.MergeRequest, _param1 []models.Repo) {
func (c *MockEventParsing_ParseGitlabMergeRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []*go_gitlab.MergeRequest, _param1 []models.Repo) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*go_gitlab.MergeRequest, len(params[0]))
@@ -604,23 +604,23 @@ func (c *EventParsing_ParseGitlabMergeRequest_OngoingVerification) GetAllCapture
return
}
func (verifier *VerifierEventParsing) ParseBitbucketCloudPullEvent(body []byte) *EventParsing_ParseBitbucketCloudPullEvent_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseBitbucketCloudPullEvent(body []byte) *MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification {
params := []pegomock.Param{body}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseBitbucketCloudPullEvent", params, verifier.timeout)
return &EventParsing_ParseBitbucketCloudPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseBitbucketCloudPullEvent_OngoingVerification struct {
type MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseBitbucketCloudPullEvent_OngoingVerification) GetCapturedArguments() []byte {
func (c *MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification) GetCapturedArguments() []byte {
body := c.GetAllCapturedArguments()
return body[len(body)-1]
}
func (c *EventParsing_ParseBitbucketCloudPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) {
func (c *MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([][]byte, len(params[0]))
@@ -631,23 +631,23 @@ func (c *EventParsing_ParseBitbucketCloudPullEvent_OngoingVerification) GetAllCa
return
}
func (verifier *VerifierEventParsing) ParseBitbucketCloudPullCommentEvent(body []byte) *EventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseBitbucketCloudPullCommentEvent(body []byte) *MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification {
params := []pegomock.Param{body}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseBitbucketCloudPullCommentEvent", params, verifier.timeout)
return &EventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification struct {
type MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification) GetCapturedArguments() []byte {
func (c *MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification) GetCapturedArguments() []byte {
body := c.GetAllCapturedArguments()
return body[len(body)-1]
}
func (c *EventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) {
func (c *MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([][]byte, len(params[0]))
@@ -658,23 +658,23 @@ func (c *EventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification) G
return
}
func (verifier *VerifierEventParsing) GetBitbucketCloudPullEventType(eventTypeHeader string) *EventParsing_GetBitbucketCloudPullEventType_OngoingVerification {
func (verifier *VerifierMockEventParsing) GetBitbucketCloudPullEventType(eventTypeHeader string) *MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification {
params := []pegomock.Param{eventTypeHeader}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetBitbucketCloudPullEventType", params, verifier.timeout)
return &EventParsing_GetBitbucketCloudPullEventType_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_GetBitbucketCloudPullEventType_OngoingVerification struct {
type MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_GetBitbucketCloudPullEventType_OngoingVerification) GetCapturedArguments() string {
func (c *MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification) GetCapturedArguments() string {
eventTypeHeader := c.GetAllCapturedArguments()
return eventTypeHeader[len(eventTypeHeader)-1]
}
func (c *EventParsing_GetBitbucketCloudPullEventType_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -685,23 +685,23 @@ func (c *EventParsing_GetBitbucketCloudPullEventType_OngoingVerification) GetAll
return
}
func (verifier *VerifierEventParsing) ParseBitbucketServerPullEvent(body []byte) *EventParsing_ParseBitbucketServerPullEvent_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseBitbucketServerPullEvent(body []byte) *MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification {
params := []pegomock.Param{body}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseBitbucketServerPullEvent", params, verifier.timeout)
return &EventParsing_ParseBitbucketServerPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseBitbucketServerPullEvent_OngoingVerification struct {
type MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseBitbucketServerPullEvent_OngoingVerification) GetCapturedArguments() []byte {
func (c *MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification) GetCapturedArguments() []byte {
body := c.GetAllCapturedArguments()
return body[len(body)-1]
}
func (c *EventParsing_ParseBitbucketServerPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) {
func (c *MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([][]byte, len(params[0]))
@@ -712,23 +712,23 @@ func (c *EventParsing_ParseBitbucketServerPullEvent_OngoingVerification) GetAllC
return
}
func (verifier *VerifierEventParsing) ParseBitbucketServerPullCommentEvent(body []byte) *EventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification {
func (verifier *VerifierMockEventParsing) ParseBitbucketServerPullCommentEvent(body []byte) *MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification {
params := []pegomock.Param{body}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseBitbucketServerPullCommentEvent", params, verifier.timeout)
return &EventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification struct {
type MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification) GetCapturedArguments() []byte {
func (c *MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification) GetCapturedArguments() []byte {
body := c.GetAllCapturedArguments()
return body[len(body)-1]
}
func (c *EventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) {
func (c *MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([][]byte, len(params[0]))
@@ -739,23 +739,23 @@ func (c *EventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification)
return
}
func (verifier *VerifierEventParsing) GetBitbucketServerPullEventType(eventTypeHeader string) *EventParsing_GetBitbucketServerPullEventType_OngoingVerification {
func (verifier *VerifierMockEventParsing) GetBitbucketServerPullEventType(eventTypeHeader string) *MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification {
params := []pegomock.Param{eventTypeHeader}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetBitbucketServerPullEventType", params, verifier.timeout)
return &EventParsing_GetBitbucketServerPullEventType_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type EventParsing_GetBitbucketServerPullEventType_OngoingVerification struct {
type MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification struct {
mock *MockEventParsing
methodInvocations []pegomock.MethodInvocation
}
func (c *EventParsing_GetBitbucketServerPullEventType_OngoingVerification) GetCapturedArguments() string {
func (c *MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification) GetCapturedArguments() string {
eventTypeHeader := c.GetAllCapturedArguments()
return eventTypeHeader[len(eventTypeHeader)-1]
}
func (c *EventParsing_GetBitbucketServerPullEventType_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -45,60 +45,60 @@ func (mock *MockGithubPullGetter) GetPullRequest(repo models.Repo, pullNum int)
return ret0, ret1
}
func (mock *MockGithubPullGetter) VerifyWasCalledOnce() *VerifierGithubPullGetter {
return &VerifierGithubPullGetter{
func (mock *MockGithubPullGetter) VerifyWasCalledOnce() *VerifierMockGithubPullGetter {
return &VerifierMockGithubPullGetter{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockGithubPullGetter) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierGithubPullGetter {
return &VerifierGithubPullGetter{
func (mock *MockGithubPullGetter) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockGithubPullGetter {
return &VerifierMockGithubPullGetter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockGithubPullGetter) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierGithubPullGetter {
return &VerifierGithubPullGetter{
func (mock *MockGithubPullGetter) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockGithubPullGetter {
return &VerifierMockGithubPullGetter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockGithubPullGetter) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierGithubPullGetter {
return &VerifierGithubPullGetter{
func (mock *MockGithubPullGetter) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockGithubPullGetter {
return &VerifierMockGithubPullGetter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierGithubPullGetter struct {
type VerifierMockGithubPullGetter struct {
mock *MockGithubPullGetter
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierGithubPullGetter) GetPullRequest(repo models.Repo, pullNum int) *GithubPullGetter_GetPullRequest_OngoingVerification {
func (verifier *VerifierMockGithubPullGetter) GetPullRequest(repo models.Repo, pullNum int) *MockGithubPullGetter_GetPullRequest_OngoingVerification {
params := []pegomock.Param{repo, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullRequest", params, verifier.timeout)
return &GithubPullGetter_GetPullRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockGithubPullGetter_GetPullRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type GithubPullGetter_GetPullRequest_OngoingVerification struct {
type MockGithubPullGetter_GetPullRequest_OngoingVerification struct {
mock *MockGithubPullGetter
methodInvocations []pegomock.MethodInvocation
}
func (c *GithubPullGetter_GetPullRequest_OngoingVerification) GetCapturedArguments() (models.Repo, int) {
func (c *MockGithubPullGetter_GetPullRequest_OngoingVerification) GetCapturedArguments() (models.Repo, int) {
repo, pullNum := c.GetAllCapturedArguments()
return repo[len(repo)-1], pullNum[len(pullNum)-1]
}
func (c *GithubPullGetter_GetPullRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int) {
func (c *MockGithubPullGetter_GetPullRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))

View File

@@ -44,60 +44,60 @@ func (mock *MockGitlabMergeRequestGetter) GetMergeRequest(repoFullName string, p
return ret0, ret1
}
func (mock *MockGitlabMergeRequestGetter) VerifyWasCalledOnce() *VerifierGitlabMergeRequestGetter {
return &VerifierGitlabMergeRequestGetter{
func (mock *MockGitlabMergeRequestGetter) VerifyWasCalledOnce() *VerifierMockGitlabMergeRequestGetter {
return &VerifierMockGitlabMergeRequestGetter{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockGitlabMergeRequestGetter) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierGitlabMergeRequestGetter {
return &VerifierGitlabMergeRequestGetter{
func (mock *MockGitlabMergeRequestGetter) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockGitlabMergeRequestGetter {
return &VerifierMockGitlabMergeRequestGetter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockGitlabMergeRequestGetter) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierGitlabMergeRequestGetter {
return &VerifierGitlabMergeRequestGetter{
func (mock *MockGitlabMergeRequestGetter) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockGitlabMergeRequestGetter {
return &VerifierMockGitlabMergeRequestGetter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockGitlabMergeRequestGetter) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierGitlabMergeRequestGetter {
return &VerifierGitlabMergeRequestGetter{
func (mock *MockGitlabMergeRequestGetter) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockGitlabMergeRequestGetter {
return &VerifierMockGitlabMergeRequestGetter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierGitlabMergeRequestGetter struct {
type VerifierMockGitlabMergeRequestGetter struct {
mock *MockGitlabMergeRequestGetter
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierGitlabMergeRequestGetter) GetMergeRequest(repoFullName string, pullNum int) *GitlabMergeRequestGetter_GetMergeRequest_OngoingVerification {
func (verifier *VerifierMockGitlabMergeRequestGetter) GetMergeRequest(repoFullName string, pullNum int) *MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetMergeRequest", params, verifier.timeout)
return &GitlabMergeRequestGetter_GetMergeRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type GitlabMergeRequestGetter_GetMergeRequest_OngoingVerification struct {
type MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification struct {
mock *MockGitlabMergeRequestGetter
methodInvocations []pegomock.MethodInvocation
}
func (c *GitlabMergeRequestGetter_GetMergeRequest_OngoingVerification) GetCapturedArguments() (string, int) {
func (c *MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification) GetCapturedArguments() (string, int) {
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
}
func (c *GitlabMergeRequestGetter_GetMergeRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
func (c *MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -39,60 +39,60 @@ func (mock *MockLockURLGenerator) GenerateLockURL(lockID string) string {
return ret0
}
func (mock *MockLockURLGenerator) VerifyWasCalledOnce() *VerifierLockURLGenerator {
return &VerifierLockURLGenerator{
func (mock *MockLockURLGenerator) VerifyWasCalledOnce() *VerifierMockLockURLGenerator {
return &VerifierMockLockURLGenerator{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockLockURLGenerator) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierLockURLGenerator {
return &VerifierLockURLGenerator{
func (mock *MockLockURLGenerator) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockLockURLGenerator {
return &VerifierMockLockURLGenerator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockLockURLGenerator) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierLockURLGenerator {
return &VerifierLockURLGenerator{
func (mock *MockLockURLGenerator) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockLockURLGenerator {
return &VerifierMockLockURLGenerator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockLockURLGenerator) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierLockURLGenerator {
return &VerifierLockURLGenerator{
func (mock *MockLockURLGenerator) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockLockURLGenerator {
return &VerifierMockLockURLGenerator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierLockURLGenerator struct {
type VerifierMockLockURLGenerator struct {
mock *MockLockURLGenerator
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierLockURLGenerator) GenerateLockURL(lockID string) *LockURLGenerator_GenerateLockURL_OngoingVerification {
func (verifier *VerifierMockLockURLGenerator) GenerateLockURL(lockID string) *MockLockURLGenerator_GenerateLockURL_OngoingVerification {
params := []pegomock.Param{lockID}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GenerateLockURL", params, verifier.timeout)
return &LockURLGenerator_GenerateLockURL_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockLockURLGenerator_GenerateLockURL_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type LockURLGenerator_GenerateLockURL_OngoingVerification struct {
type MockLockURLGenerator_GenerateLockURL_OngoingVerification struct {
mock *MockLockURLGenerator
methodInvocations []pegomock.MethodInvocation
}
func (c *LockURLGenerator_GenerateLockURL_OngoingVerification) GetCapturedArguments() string {
func (c *MockLockURLGenerator_GenerateLockURL_OngoingVerification) GetCapturedArguments() string {
lockID := c.GetAllCapturedArguments()
return lockID[len(lockID)-1]
}
func (c *LockURLGenerator_GenerateLockURL_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockLockURLGenerator_GenerateLockURL_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -59,60 +59,60 @@ func (mock *MockPendingPlanFinder) DeletePlans(pullDir string) error {
return ret0
}
func (mock *MockPendingPlanFinder) VerifyWasCalledOnce() *VerifierPendingPlanFinder {
return &VerifierPendingPlanFinder{
func (mock *MockPendingPlanFinder) VerifyWasCalledOnce() *VerifierMockPendingPlanFinder {
return &VerifierMockPendingPlanFinder{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockPendingPlanFinder) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierPendingPlanFinder {
return &VerifierPendingPlanFinder{
func (mock *MockPendingPlanFinder) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockPendingPlanFinder {
return &VerifierMockPendingPlanFinder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockPendingPlanFinder) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierPendingPlanFinder {
return &VerifierPendingPlanFinder{
func (mock *MockPendingPlanFinder) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockPendingPlanFinder {
return &VerifierMockPendingPlanFinder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockPendingPlanFinder) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierPendingPlanFinder {
return &VerifierPendingPlanFinder{
func (mock *MockPendingPlanFinder) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockPendingPlanFinder {
return &VerifierMockPendingPlanFinder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierPendingPlanFinder struct {
type VerifierMockPendingPlanFinder struct {
mock *MockPendingPlanFinder
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierPendingPlanFinder) Find(pullDir string) *PendingPlanFinder_Find_OngoingVerification {
func (verifier *VerifierMockPendingPlanFinder) Find(pullDir string) *MockPendingPlanFinder_Find_OngoingVerification {
params := []pegomock.Param{pullDir}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Find", params, verifier.timeout)
return &PendingPlanFinder_Find_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockPendingPlanFinder_Find_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type PendingPlanFinder_Find_OngoingVerification struct {
type MockPendingPlanFinder_Find_OngoingVerification struct {
mock *MockPendingPlanFinder
methodInvocations []pegomock.MethodInvocation
}
func (c *PendingPlanFinder_Find_OngoingVerification) GetCapturedArguments() string {
func (c *MockPendingPlanFinder_Find_OngoingVerification) GetCapturedArguments() string {
pullDir := c.GetAllCapturedArguments()
return pullDir[len(pullDir)-1]
}
func (c *PendingPlanFinder_Find_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockPendingPlanFinder_Find_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -123,23 +123,23 @@ func (c *PendingPlanFinder_Find_OngoingVerification) GetAllCapturedArguments() (
return
}
func (verifier *VerifierPendingPlanFinder) DeletePlans(pullDir string) *PendingPlanFinder_DeletePlans_OngoingVerification {
func (verifier *VerifierMockPendingPlanFinder) DeletePlans(pullDir string) *MockPendingPlanFinder_DeletePlans_OngoingVerification {
params := []pegomock.Param{pullDir}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeletePlans", params, verifier.timeout)
return &PendingPlanFinder_DeletePlans_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockPendingPlanFinder_DeletePlans_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type PendingPlanFinder_DeletePlans_OngoingVerification struct {
type MockPendingPlanFinder_DeletePlans_OngoingVerification struct {
mock *MockPendingPlanFinder
methodInvocations []pegomock.MethodInvocation
}
func (c *PendingPlanFinder_DeletePlans_OngoingVerification) GetCapturedArguments() string {
func (c *MockPendingPlanFinder_DeletePlans_OngoingVerification) GetCapturedArguments() string {
pullDir := c.GetAllCapturedArguments()
return pullDir[len(pullDir)-1]
}
func (c *PendingPlanFinder_DeletePlans_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockPendingPlanFinder_DeletePlans_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -45,11 +45,11 @@ func (mock *MockProjectCommandBuilder) BuildAutoplanCommands(ctx *events.Command
return ret0, ret1
}
func (mock *MockProjectCommandBuilder) BuildPlanCommands(ctx *events.CommandContext, commentCommand *events.CommentCommand) ([]models.ProjectCommandContext, error) {
func (mock *MockProjectCommandBuilder) BuildPlanCommands(ctx *events.CommandContext, comment *events.CommentCommand) ([]models.ProjectCommandContext, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().")
}
params := []pegomock.Param{ctx, commentCommand}
params := []pegomock.Param{ctx, comment}
result := pegomock.GetGenericMockFrom(mock).Invoke("BuildPlanCommands", params, []reflect.Type{reflect.TypeOf((*[]models.ProjectCommandContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []models.ProjectCommandContext
var ret1 error
@@ -64,11 +64,11 @@ func (mock *MockProjectCommandBuilder) BuildPlanCommands(ctx *events.CommandCont
return ret0, ret1
}
func (mock *MockProjectCommandBuilder) BuildApplyCommands(ctx *events.CommandContext, commentCommand *events.CommentCommand) ([]models.ProjectCommandContext, error) {
func (mock *MockProjectCommandBuilder) BuildApplyCommands(ctx *events.CommandContext, comment *events.CommentCommand) ([]models.ProjectCommandContext, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().")
}
params := []pegomock.Param{ctx, commentCommand}
params := []pegomock.Param{ctx, comment}
result := pegomock.GetGenericMockFrom(mock).Invoke("BuildApplyCommands", params, []reflect.Type{reflect.TypeOf((*[]models.ProjectCommandContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()})
var ret0 []models.ProjectCommandContext
var ret1 error
@@ -83,60 +83,60 @@ func (mock *MockProjectCommandBuilder) BuildApplyCommands(ctx *events.CommandCon
return ret0, ret1
}
func (mock *MockProjectCommandBuilder) VerifyWasCalledOnce() *VerifierProjectCommandBuilder {
return &VerifierProjectCommandBuilder{
func (mock *MockProjectCommandBuilder) VerifyWasCalledOnce() *VerifierMockProjectCommandBuilder {
return &VerifierMockProjectCommandBuilder{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockProjectCommandBuilder) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierProjectCommandBuilder {
return &VerifierProjectCommandBuilder{
func (mock *MockProjectCommandBuilder) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockProjectCommandBuilder {
return &VerifierMockProjectCommandBuilder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockProjectCommandBuilder) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierProjectCommandBuilder {
return &VerifierProjectCommandBuilder{
func (mock *MockProjectCommandBuilder) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockProjectCommandBuilder {
return &VerifierMockProjectCommandBuilder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockProjectCommandBuilder) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierProjectCommandBuilder {
return &VerifierProjectCommandBuilder{
func (mock *MockProjectCommandBuilder) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockProjectCommandBuilder {
return &VerifierMockProjectCommandBuilder{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierProjectCommandBuilder struct {
type VerifierMockProjectCommandBuilder struct {
mock *MockProjectCommandBuilder
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierProjectCommandBuilder) BuildAutoplanCommands(ctx *events.CommandContext) *ProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification {
func (verifier *VerifierMockProjectCommandBuilder) BuildAutoplanCommands(ctx *events.CommandContext) *MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification {
params := []pegomock.Param{ctx}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildAutoplanCommands", params, verifier.timeout)
return &ProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification struct {
type MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification struct {
mock *MockProjectCommandBuilder
methodInvocations []pegomock.MethodInvocation
}
func (c *ProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification) GetCapturedArguments() *events.CommandContext {
func (c *MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification) GetCapturedArguments() *events.CommandContext {
ctx := c.GetAllCapturedArguments()
return ctx[len(ctx)-1]
}
func (c *ProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*events.CommandContext) {
func (c *MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*events.CommandContext) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*events.CommandContext, len(params[0]))
@@ -147,23 +147,23 @@ func (c *ProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification) GetAll
return
}
func (verifier *VerifierProjectCommandBuilder) BuildPlanCommands(ctx *events.CommandContext, commentCommand *events.CommentCommand) *ProjectCommandBuilder_BuildPlanCommands_OngoingVerification {
params := []pegomock.Param{ctx, commentCommand}
func (verifier *VerifierMockProjectCommandBuilder) BuildPlanCommands(ctx *events.CommandContext, comment *events.CommentCommand) *MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification {
params := []pegomock.Param{ctx, comment}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildPlanCommands", params, verifier.timeout)
return &ProjectCommandBuilder_BuildPlanCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ProjectCommandBuilder_BuildPlanCommands_OngoingVerification struct {
type MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification struct {
mock *MockProjectCommandBuilder
methodInvocations []pegomock.MethodInvocation
}
func (c *ProjectCommandBuilder_BuildPlanCommands_OngoingVerification) GetCapturedArguments() (*events.CommandContext, *events.CommentCommand) {
ctx, commentCommand := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], commentCommand[len(commentCommand)-1]
func (c *MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification) GetCapturedArguments() (*events.CommandContext, *events.CommentCommand) {
ctx, comment := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], comment[len(comment)-1]
}
func (c *ProjectCommandBuilder_BuildPlanCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*events.CommandContext, _param1 []*events.CommentCommand) {
func (c *MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*events.CommandContext, _param1 []*events.CommentCommand) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*events.CommandContext, len(params[0]))
@@ -178,23 +178,23 @@ func (c *ProjectCommandBuilder_BuildPlanCommands_OngoingVerification) GetAllCapt
return
}
func (verifier *VerifierProjectCommandBuilder) BuildApplyCommands(ctx *events.CommandContext, commentCommand *events.CommentCommand) *ProjectCommandBuilder_BuildApplyCommands_OngoingVerification {
params := []pegomock.Param{ctx, commentCommand}
func (verifier *VerifierMockProjectCommandBuilder) BuildApplyCommands(ctx *events.CommandContext, comment *events.CommentCommand) *MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification {
params := []pegomock.Param{ctx, comment}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildApplyCommands", params, verifier.timeout)
return &ProjectCommandBuilder_BuildApplyCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ProjectCommandBuilder_BuildApplyCommands_OngoingVerification struct {
type MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification struct {
mock *MockProjectCommandBuilder
methodInvocations []pegomock.MethodInvocation
}
func (c *ProjectCommandBuilder_BuildApplyCommands_OngoingVerification) GetCapturedArguments() (*events.CommandContext, *events.CommentCommand) {
ctx, commentCommand := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], commentCommand[len(commentCommand)-1]
func (c *MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification) GetCapturedArguments() (*events.CommandContext, *events.CommentCommand) {
ctx, comment := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], comment[len(comment)-1]
}
func (c *ProjectCommandBuilder_BuildApplyCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*events.CommandContext, _param1 []*events.CommentCommand) {
func (c *MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*events.CommandContext, _param1 []*events.CommentCommand) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*events.CommandContext, len(params[0]))

View File

@@ -55,60 +55,60 @@ func (mock *MockProjectCommandRunner) Apply(ctx models.ProjectCommandContext) mo
return ret0
}
func (mock *MockProjectCommandRunner) VerifyWasCalledOnce() *VerifierProjectCommandRunner {
return &VerifierProjectCommandRunner{
func (mock *MockProjectCommandRunner) VerifyWasCalledOnce() *VerifierMockProjectCommandRunner {
return &VerifierMockProjectCommandRunner{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockProjectCommandRunner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierProjectCommandRunner {
return &VerifierProjectCommandRunner{
func (mock *MockProjectCommandRunner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockProjectCommandRunner {
return &VerifierMockProjectCommandRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockProjectCommandRunner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierProjectCommandRunner {
return &VerifierProjectCommandRunner{
func (mock *MockProjectCommandRunner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockProjectCommandRunner {
return &VerifierMockProjectCommandRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockProjectCommandRunner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierProjectCommandRunner {
return &VerifierProjectCommandRunner{
func (mock *MockProjectCommandRunner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockProjectCommandRunner {
return &VerifierMockProjectCommandRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierProjectCommandRunner struct {
type VerifierMockProjectCommandRunner struct {
mock *MockProjectCommandRunner
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierProjectCommandRunner) Plan(ctx models.ProjectCommandContext) *ProjectCommandRunner_Plan_OngoingVerification {
func (verifier *VerifierMockProjectCommandRunner) Plan(ctx models.ProjectCommandContext) *MockProjectCommandRunner_Plan_OngoingVerification {
params := []pegomock.Param{ctx}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Plan", params, verifier.timeout)
return &ProjectCommandRunner_Plan_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockProjectCommandRunner_Plan_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ProjectCommandRunner_Plan_OngoingVerification struct {
type MockProjectCommandRunner_Plan_OngoingVerification struct {
mock *MockProjectCommandRunner
methodInvocations []pegomock.MethodInvocation
}
func (c *ProjectCommandRunner_Plan_OngoingVerification) GetCapturedArguments() models.ProjectCommandContext {
func (c *MockProjectCommandRunner_Plan_OngoingVerification) GetCapturedArguments() models.ProjectCommandContext {
ctx := c.GetAllCapturedArguments()
return ctx[len(ctx)-1]
}
func (c *ProjectCommandRunner_Plan_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext) {
func (c *MockProjectCommandRunner_Plan_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.ProjectCommandContext, len(params[0]))
@@ -119,23 +119,23 @@ func (c *ProjectCommandRunner_Plan_OngoingVerification) GetAllCapturedArguments(
return
}
func (verifier *VerifierProjectCommandRunner) Apply(ctx models.ProjectCommandContext) *ProjectCommandRunner_Apply_OngoingVerification {
func (verifier *VerifierMockProjectCommandRunner) Apply(ctx models.ProjectCommandContext) *MockProjectCommandRunner_Apply_OngoingVerification {
params := []pegomock.Param{ctx}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Apply", params, verifier.timeout)
return &ProjectCommandRunner_Apply_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockProjectCommandRunner_Apply_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ProjectCommandRunner_Apply_OngoingVerification struct {
type MockProjectCommandRunner_Apply_OngoingVerification struct {
mock *MockProjectCommandRunner
methodInvocations []pegomock.MethodInvocation
}
func (c *ProjectCommandRunner_Apply_OngoingVerification) GetCapturedArguments() models.ProjectCommandContext {
func (c *MockProjectCommandRunner_Apply_OngoingVerification) GetCapturedArguments() models.ProjectCommandContext {
ctx := c.GetAllCapturedArguments()
return ctx[len(ctx)-1]
}
func (c *ProjectCommandRunner_Apply_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext) {
func (c *MockProjectCommandRunner_Apply_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.ProjectCommandContext, len(params[0]))

View File

@@ -46,60 +46,60 @@ func (mock *MockProjectLocker) TryLock(log *logging.SimpleLogger, pull models.Pu
return ret0, ret1
}
func (mock *MockProjectLocker) VerifyWasCalledOnce() *VerifierProjectLocker {
return &VerifierProjectLocker{
func (mock *MockProjectLocker) VerifyWasCalledOnce() *VerifierMockProjectLocker {
return &VerifierMockProjectLocker{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockProjectLocker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierProjectLocker {
return &VerifierProjectLocker{
func (mock *MockProjectLocker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockProjectLocker {
return &VerifierMockProjectLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockProjectLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierProjectLocker {
return &VerifierProjectLocker{
func (mock *MockProjectLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockProjectLocker {
return &VerifierMockProjectLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockProjectLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierProjectLocker {
return &VerifierProjectLocker{
func (mock *MockProjectLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockProjectLocker {
return &VerifierMockProjectLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierProjectLocker struct {
type VerifierMockProjectLocker struct {
mock *MockProjectLocker
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierProjectLocker) TryLock(log *logging.SimpleLogger, pull models.PullRequest, user models.User, workspace string, project models.Project) *ProjectLocker_TryLock_OngoingVerification {
func (verifier *VerifierMockProjectLocker) TryLock(log *logging.SimpleLogger, pull models.PullRequest, user models.User, workspace string, project models.Project) *MockProjectLocker_TryLock_OngoingVerification {
params := []pegomock.Param{log, pull, user, workspace, project}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout)
return &ProjectLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockProjectLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type ProjectLocker_TryLock_OngoingVerification struct {
type MockProjectLocker_TryLock_OngoingVerification struct {
mock *MockProjectLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *ProjectLocker_TryLock_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, models.PullRequest, models.User, string, models.Project) {
func (c *MockProjectLocker_TryLock_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, models.PullRequest, models.User, string, models.Project) {
log, pull, user, workspace, project := c.GetAllCapturedArguments()
return log[len(log)-1], pull[len(pull)-1], user[len(user)-1], workspace[len(workspace)-1], project[len(project)-1]
}
func (c *ProjectLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []models.PullRequest, _param2 []models.User, _param3 []string, _param4 []models.Project) {
func (c *MockProjectLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []models.PullRequest, _param2 []models.User, _param3 []string, _param4 []models.Project) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*logging.SimpleLogger, len(params[0]))

View File

@@ -40,60 +40,60 @@ func (mock *MockPullCleaner) CleanUpPull(repo models.Repo, pull models.PullReque
return ret0
}
func (mock *MockPullCleaner) VerifyWasCalledOnce() *VerifierPullCleaner {
return &VerifierPullCleaner{
func (mock *MockPullCleaner) VerifyWasCalledOnce() *VerifierMockPullCleaner {
return &VerifierMockPullCleaner{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockPullCleaner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierPullCleaner {
return &VerifierPullCleaner{
func (mock *MockPullCleaner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockPullCleaner {
return &VerifierMockPullCleaner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockPullCleaner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierPullCleaner {
return &VerifierPullCleaner{
func (mock *MockPullCleaner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockPullCleaner {
return &VerifierMockPullCleaner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockPullCleaner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierPullCleaner {
return &VerifierPullCleaner{
func (mock *MockPullCleaner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockPullCleaner {
return &VerifierMockPullCleaner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierPullCleaner struct {
type VerifierMockPullCleaner struct {
mock *MockPullCleaner
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierPullCleaner) CleanUpPull(repo models.Repo, pull models.PullRequest) *PullCleaner_CleanUpPull_OngoingVerification {
func (verifier *VerifierMockPullCleaner) CleanUpPull(repo models.Repo, pull models.PullRequest) *MockPullCleaner_CleanUpPull_OngoingVerification {
params := []pegomock.Param{repo, pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CleanUpPull", params, verifier.timeout)
return &PullCleaner_CleanUpPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockPullCleaner_CleanUpPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type PullCleaner_CleanUpPull_OngoingVerification struct {
type MockPullCleaner_CleanUpPull_OngoingVerification struct {
mock *MockPullCleaner
methodInvocations []pegomock.MethodInvocation
}
func (c *PullCleaner_CleanUpPull_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockPullCleaner_CleanUpPull_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
repo, pull := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1]
}
func (c *PullCleaner_CleanUpPull_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockPullCleaner_CleanUpPull_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))

View File

@@ -44,60 +44,60 @@ func (mock *MockStepRunner) Run(ctx models.ProjectCommandContext, extraArgs []st
return ret0, ret1
}
func (mock *MockStepRunner) VerifyWasCalledOnce() *VerifierStepRunner {
return &VerifierStepRunner{
func (mock *MockStepRunner) VerifyWasCalledOnce() *VerifierMockStepRunner {
return &VerifierMockStepRunner{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockStepRunner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierStepRunner {
return &VerifierStepRunner{
func (mock *MockStepRunner) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockStepRunner {
return &VerifierMockStepRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockStepRunner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierStepRunner {
return &VerifierStepRunner{
func (mock *MockStepRunner) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockStepRunner {
return &VerifierMockStepRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockStepRunner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierStepRunner {
return &VerifierStepRunner{
func (mock *MockStepRunner) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockStepRunner {
return &VerifierMockStepRunner{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierStepRunner struct {
type VerifierMockStepRunner struct {
mock *MockStepRunner
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierStepRunner) Run(ctx models.ProjectCommandContext, extraArgs []string, path string) *StepRunner_Run_OngoingVerification {
func (verifier *VerifierMockStepRunner) Run(ctx models.ProjectCommandContext, extraArgs []string, path string) *MockStepRunner_Run_OngoingVerification {
params := []pegomock.Param{ctx, extraArgs, path}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout)
return &StepRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockStepRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type StepRunner_Run_OngoingVerification struct {
type MockStepRunner_Run_OngoingVerification struct {
mock *MockStepRunner
methodInvocations []pegomock.MethodInvocation
}
func (c *StepRunner_Run_OngoingVerification) GetCapturedArguments() (models.ProjectCommandContext, []string, string) {
func (c *MockStepRunner_Run_OngoingVerification) GetCapturedArguments() (models.ProjectCommandContext, []string, string) {
ctx, extraArgs, path := c.GetAllCapturedArguments()
return ctx[len(ctx)-1], extraArgs[len(extraArgs)-1], path[len(path)-1]
}
func (c *StepRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext, _param1 [][]string, _param2 []string) {
func (c *MockStepRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectCommandContext, _param1 [][]string, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.ProjectCommandContext, len(params[0]))

View File

@@ -41,60 +41,60 @@ func (mock *MockWebhooksSender) Send(log *logging.SimpleLogger, res webhooks.App
return ret0
}
func (mock *MockWebhooksSender) VerifyWasCalledOnce() *VerifierWebhooksSender {
return &VerifierWebhooksSender{
func (mock *MockWebhooksSender) VerifyWasCalledOnce() *VerifierMockWebhooksSender {
return &VerifierMockWebhooksSender{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockWebhooksSender) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierWebhooksSender {
return &VerifierWebhooksSender{
func (mock *MockWebhooksSender) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockWebhooksSender {
return &VerifierMockWebhooksSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockWebhooksSender) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierWebhooksSender {
return &VerifierWebhooksSender{
func (mock *MockWebhooksSender) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockWebhooksSender {
return &VerifierMockWebhooksSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockWebhooksSender) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierWebhooksSender {
return &VerifierWebhooksSender{
func (mock *MockWebhooksSender) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockWebhooksSender {
return &VerifierMockWebhooksSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierWebhooksSender struct {
type VerifierMockWebhooksSender struct {
mock *MockWebhooksSender
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierWebhooksSender) Send(log *logging.SimpleLogger, res webhooks.ApplyResult) *WebhooksSender_Send_OngoingVerification {
func (verifier *VerifierMockWebhooksSender) Send(log *logging.SimpleLogger, res webhooks.ApplyResult) *MockWebhooksSender_Send_OngoingVerification {
params := []pegomock.Param{log, res}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Send", params, verifier.timeout)
return &WebhooksSender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWebhooksSender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WebhooksSender_Send_OngoingVerification struct {
type MockWebhooksSender_Send_OngoingVerification struct {
mock *MockWebhooksSender
methodInvocations []pegomock.MethodInvocation
}
func (c *WebhooksSender_Send_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, webhooks.ApplyResult) {
func (c *MockWebhooksSender_Send_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, webhooks.ApplyResult) {
log, res := c.GetAllCapturedArguments()
return log[len(log)-1], res[len(res)-1]
}
func (c *WebhooksSender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []webhooks.ApplyResult) {
func (c *MockWebhooksSender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []webhooks.ApplyResult) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*logging.SimpleLogger, len(params[0]))

View File

@@ -113,60 +113,60 @@ func (mock *MockWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullReque
return ret0
}
func (mock *MockWorkingDir) VerifyWasCalledOnce() *VerifierWorkingDir {
return &VerifierWorkingDir{
func (mock *MockWorkingDir) VerifyWasCalledOnce() *VerifierMockWorkingDir {
return &VerifierMockWorkingDir{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockWorkingDir) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierWorkingDir {
return &VerifierWorkingDir{
func (mock *MockWorkingDir) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockWorkingDir {
return &VerifierMockWorkingDir{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockWorkingDir) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierWorkingDir {
return &VerifierWorkingDir{
func (mock *MockWorkingDir) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockWorkingDir {
return &VerifierMockWorkingDir{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockWorkingDir) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierWorkingDir {
return &VerifierWorkingDir{
func (mock *MockWorkingDir) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockWorkingDir {
return &VerifierMockWorkingDir{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierWorkingDir struct {
type VerifierMockWorkingDir struct {
mock *MockWorkingDir
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierWorkingDir) Clone(log *logging.SimpleLogger, baseRepo models.Repo, headRepo models.Repo, p models.PullRequest, workspace string) *WorkingDir_Clone_OngoingVerification {
func (verifier *VerifierMockWorkingDir) Clone(log *logging.SimpleLogger, baseRepo models.Repo, headRepo models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_Clone_OngoingVerification {
params := []pegomock.Param{log, baseRepo, headRepo, p, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Clone", params, verifier.timeout)
return &WorkingDir_Clone_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_Clone_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_Clone_OngoingVerification struct {
type MockWorkingDir_Clone_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_Clone_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, models.Repo, models.Repo, models.PullRequest, string) {
func (c *MockWorkingDir_Clone_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, models.Repo, models.Repo, models.PullRequest, string) {
log, baseRepo, headRepo, p, workspace := c.GetAllCapturedArguments()
return log[len(log)-1], baseRepo[len(baseRepo)-1], headRepo[len(headRepo)-1], p[len(p)-1], workspace[len(workspace)-1]
}
func (c *WorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []models.Repo, _param2 []models.Repo, _param3 []models.PullRequest, _param4 []string) {
func (c *MockWorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []models.Repo, _param2 []models.Repo, _param3 []models.PullRequest, _param4 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*logging.SimpleLogger, len(params[0]))
@@ -193,23 +193,23 @@ func (c *WorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param
return
}
func (verifier *VerifierWorkingDir) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) *WorkingDir_GetWorkingDir_OngoingVerification {
func (verifier *VerifierMockWorkingDir) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_GetWorkingDir_OngoingVerification {
params := []pegomock.Param{r, p, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetWorkingDir", params, verifier.timeout)
return &WorkingDir_GetWorkingDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_GetWorkingDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_GetWorkingDir_OngoingVerification struct {
type MockWorkingDir_GetWorkingDir_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_GetWorkingDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
r, p, workspace := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1]
}
func (c *WorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -228,23 +228,23 @@ func (c *WorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) *WorkingDir_GetPullDir_OngoingVerification {
func (verifier *VerifierMockWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) *MockWorkingDir_GetPullDir_OngoingVerification {
params := []pegomock.Param{r, p}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullDir", params, verifier.timeout)
return &WorkingDir_GetPullDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_GetPullDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_GetPullDir_OngoingVerification struct {
type MockWorkingDir_GetPullDir_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_GetPullDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
r, p := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1]
}
func (c *WorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -259,23 +259,23 @@ func (c *WorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_
return
}
func (verifier *VerifierWorkingDir) Delete(r models.Repo, p models.PullRequest) *WorkingDir_Delete_OngoingVerification {
func (verifier *VerifierMockWorkingDir) Delete(r models.Repo, p models.PullRequest) *MockWorkingDir_Delete_OngoingVerification {
params := []pegomock.Param{r, p}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Delete", params, verifier.timeout)
return &WorkingDir_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_Delete_OngoingVerification struct {
type MockWorkingDir_Delete_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_Delete_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockWorkingDir_Delete_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
r, p := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1]
}
func (c *WorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockWorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -290,23 +290,23 @@ func (c *WorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_para
return
}
func (verifier *VerifierWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) *WorkingDir_DeleteForWorkspace_OngoingVerification {
func (verifier *VerifierMockWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_DeleteForWorkspace_OngoingVerification {
params := []pegomock.Param{r, p, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeleteForWorkspace", params, verifier.timeout)
return &WorkingDir_DeleteForWorkspace_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDir_DeleteForWorkspace_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDir_DeleteForWorkspace_OngoingVerification struct {
type MockWorkingDir_DeleteForWorkspace_OngoingVerification struct {
mock *MockWorkingDir
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDir_DeleteForWorkspace_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) {
r, p, workspace := c.GetAllCapturedArguments()
return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1]
}
func (c *WorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))

View File

@@ -62,60 +62,60 @@ func (mock *MockWorkingDirLocker) TryLockPull(repoFullName string, pullNum int)
return ret0, ret1
}
func (mock *MockWorkingDirLocker) VerifyWasCalledOnce() *VerifierWorkingDirLocker {
return &VerifierWorkingDirLocker{
func (mock *MockWorkingDirLocker) VerifyWasCalledOnce() *VerifierMockWorkingDirLocker {
return &VerifierMockWorkingDirLocker{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockWorkingDirLocker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierWorkingDirLocker {
return &VerifierWorkingDirLocker{
func (mock *MockWorkingDirLocker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockWorkingDirLocker {
return &VerifierMockWorkingDirLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockWorkingDirLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierWorkingDirLocker {
return &VerifierWorkingDirLocker{
func (mock *MockWorkingDirLocker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockWorkingDirLocker {
return &VerifierMockWorkingDirLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockWorkingDirLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierWorkingDirLocker {
return &VerifierWorkingDirLocker{
func (mock *MockWorkingDirLocker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockWorkingDirLocker {
return &VerifierMockWorkingDirLocker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierWorkingDirLocker struct {
type VerifierMockWorkingDirLocker struct {
mock *MockWorkingDirLocker
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierWorkingDirLocker) TryLock(repoFullName string, pullNum int, workspace string) *WorkingDirLocker_TryLock_OngoingVerification {
func (verifier *VerifierMockWorkingDirLocker) TryLock(repoFullName string, pullNum int, workspace string) *MockWorkingDirLocker_TryLock_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout)
return &WorkingDirLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDirLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDirLocker_TryLock_OngoingVerification struct {
type MockWorkingDirLocker_TryLock_OngoingVerification struct {
mock *MockWorkingDirLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDirLocker_TryLock_OngoingVerification) GetCapturedArguments() (string, int, string) {
func (c *MockWorkingDirLocker_TryLock_OngoingVerification) GetCapturedArguments() (string, int, string) {
repoFullName, pullNum, workspace := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1], workspace[len(workspace)-1]
}
func (c *WorkingDirLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int, _param2 []string) {
func (c *MockWorkingDirLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -134,23 +134,23 @@ func (c *WorkingDirLocker_TryLock_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierWorkingDirLocker) TryLockPull(repoFullName string, pullNum int) *WorkingDirLocker_TryLockPull_OngoingVerification {
func (verifier *VerifierMockWorkingDirLocker) TryLockPull(repoFullName string, pullNum int) *MockWorkingDirLocker_TryLockPull_OngoingVerification {
params := []pegomock.Param{repoFullName, pullNum}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLockPull", params, verifier.timeout)
return &WorkingDirLocker_TryLockPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockWorkingDirLocker_TryLockPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type WorkingDirLocker_TryLockPull_OngoingVerification struct {
type MockWorkingDirLocker_TryLockPull_OngoingVerification struct {
mock *MockWorkingDirLocker
methodInvocations []pegomock.MethodInvocation
}
func (c *WorkingDirLocker_TryLockPull_OngoingVerification) GetCapturedArguments() (string, int) {
func (c *MockWorkingDirLocker_TryLockPull_OngoingVerification) GetCapturedArguments() (string, int) {
repoFullName, pullNum := c.GetAllCapturedArguments()
return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1]
}
func (c *WorkingDirLocker_TryLockPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
func (c *MockWorkingDirLocker_TryLockPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -334,9 +334,11 @@ type ProjectCommandContext struct {
AutoplanEnabled bool
// BaseRepo is the repository that the pull request will be merged into.
BaseRepo Repo
// CommentArgs are the extra arguments appended to comment,
// ex. atlantis plan -- -target=resource
CommentArgs []string
// EscapedCommentArgs are the extra arguments that were added to the atlantis
// command, ex. atlantis plan -- -target=resource. We then escape them
// by adding a \ before each character so that they can be used within
// sh -c safely, i.e. sh -c "terraform plan $(touch bad)".
EscapedCommentArgs []string
// HeadRepo is the repository that is getting merged into the BaseRepo.
// If the pull request branch is from the same repository then HeadRepo will
// be the same as BaseRepo.

View File

@@ -382,24 +382,36 @@ func (p *DefaultProjectCommandBuilder) buildCtx(ctx *CommandContext,
}
return models.ProjectCommandContext{
ApplyCmd: p.CommentBuilder.BuildApplyComment(projCfg.RepoRelDir, projCfg.Workspace, projCfg.Name),
BaseRepo: ctx.BaseRepo,
CommentArgs: commentArgs,
AutomergeEnabled: automergeEnabled,
AutoplanEnabled: projCfg.AutoplanEnabled,
Steps: steps,
HeadRepo: ctx.HeadRepo,
Log: ctx.Log,
PullMergeable: ctx.PullMergeable,
Pull: ctx.Pull,
ProjectName: projCfg.Name,
ApplyRequirements: projCfg.ApplyRequirements,
RePlanCmd: p.CommentBuilder.BuildPlanComment(projCfg.RepoRelDir, projCfg.Workspace, projCfg.Name, commentArgs),
RepoRelDir: projCfg.RepoRelDir,
RepoConfigVersion: projCfg.RepoCfgVersion,
TerraformVersion: projCfg.TerraformVersion,
User: ctx.User,
Verbose: verbose,
Workspace: projCfg.Workspace,
ApplyCmd: p.CommentBuilder.BuildApplyComment(projCfg.RepoRelDir, projCfg.Workspace, projCfg.Name),
BaseRepo: ctx.BaseRepo,
EscapedCommentArgs: p.escapeArgs(commentArgs),
AutomergeEnabled: automergeEnabled,
AutoplanEnabled: projCfg.AutoplanEnabled,
Steps: steps,
HeadRepo: ctx.HeadRepo,
Log: ctx.Log,
PullMergeable: ctx.PullMergeable,
Pull: ctx.Pull,
ProjectName: projCfg.Name,
ApplyRequirements: projCfg.ApplyRequirements,
RePlanCmd: p.CommentBuilder.BuildPlanComment(projCfg.RepoRelDir, projCfg.Workspace, projCfg.Name, commentArgs),
RepoRelDir: projCfg.RepoRelDir,
RepoConfigVersion: projCfg.RepoCfgVersion,
TerraformVersion: projCfg.TerraformVersion,
User: ctx.User,
Verbose: verbose,
Workspace: projCfg.Workspace,
}
}
func (p *DefaultProjectCommandBuilder) escapeArgs(args []string) []string {
var escaped []string
for _, arg := range args {
var escapedArg string
for i := range arg {
escapedArg += "\\" + string(arg[i])
}
escaped = append(escaped, escapedArg)
}
return escaped
}

View File

@@ -49,22 +49,22 @@ workflows:
- apply`,
repoCfg: "",
expCtx: models.ProjectCommandContext{
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
CommentArgs: []string{"flag"},
AutomergeEnabled: false,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
EscapedCommentArgs: []string{`\f\l\a\g`},
AutomergeEnabled: false,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
},
expPlanSteps: []string{"init", "plan"},
expApplySteps: []string{"apply"},
@@ -98,24 +98,24 @@ projects:
terraform_version: v10.0
`,
expCtx: models.ProjectCommandContext{
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
CommentArgs: []string{"flag"},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
EscapedCommentArgs: []string{`\f\l\a\g`},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
},
expPlanSteps: []string{"init", "plan"},
expApplySteps: []string{"apply"},
@@ -149,24 +149,24 @@ projects:
terraform_version: v10.0
`,
expCtx: models.ProjectCommandContext{
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
CommentArgs: []string{"flag"},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{"approved", "mergeable"},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
EscapedCommentArgs: []string{`\f\l\a\g`},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{"approved", "mergeable"},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
},
expPlanSteps: []string{"init", "plan"},
expApplySteps: []string{"apply"},
@@ -208,24 +208,24 @@ projects:
terraform_version: v10.0
`,
expCtx: models.ProjectCommandContext{
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
CommentArgs: []string{"flag"},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{"approved"},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
EscapedCommentArgs: []string{`\f\l\a\g`},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{"approved"},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
},
expPlanSteps: []string{"plan"},
expApplySteps: []string{},
@@ -354,24 +354,24 @@ workflows:
- apply
`,
expCtx: models.ProjectCommandContext{
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
CommentArgs: []string{"flag"},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
EscapedCommentArgs: []string{`\f\l\a\g`},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
},
expPlanSteps: []string{"plan"},
expApplySteps: []string{"apply"},
@@ -409,24 +409,24 @@ projects:
workflow: custom
`,
expCtx: models.ProjectCommandContext{
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
CommentArgs: []string{"flag"},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
EscapedCommentArgs: []string{`\f\l\a\g`},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
},
expPlanSteps: []string{"plan"},
expApplySteps: []string{"apply"},
@@ -467,24 +467,24 @@ workflows:
steps: []
`,
expCtx: models.ProjectCommandContext{
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
CommentArgs: []string{"flag"},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
EscapedCommentArgs: []string{`\f\l\a\g`},
AutomergeEnabled: true,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
TerraformVersion: mustVersion("10.0"),
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
},
expPlanSteps: []string{},
expApplySteps: []string{},
@@ -509,23 +509,23 @@ projects:
workspace: myworkspace
`,
expCtx: models.ProjectCommandContext{
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
CommentArgs: []string{"flag"},
AutomergeEnabled: false,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{"approved"},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
ApplyCmd: "atlantis apply -d project1 -w myworkspace",
BaseRepo: baseRepo,
EscapedCommentArgs: []string{`\f\l\a\g`},
AutomergeEnabled: false,
AutoplanEnabled: true,
HeadRepo: models.Repo{},
Log: nil,
PullMergeable: true,
Pull: models.PullRequest{},
ProjectName: "",
ApplyRequirements: []string{"approved"},
RepoConfigVersion: 3,
RePlanCmd: "atlantis plan -d project1 -w myworkspace -- flag",
RepoRelDir: "project1",
User: models.User{},
Verbose: true,
Workspace: "myworkspace",
},
expPlanSteps: []string{"plan"},
expApplySteps: []string{"apply"},

View File

@@ -3,6 +3,7 @@ package events_test
import (
"io/ioutil"
"path/filepath"
"strings"
"testing"
. "github.com/petergtz/pegomock"
@@ -180,7 +181,7 @@ func TestDefaultProjectCommandBuilder_BuildSinglePlanApplyCommand(t *testing.T)
Workspace: "myworkspace",
},
AtlantisYAML: "",
ExpCommentArgs: []string{"commentarg"},
ExpCommentArgs: []string{`\c\o\m\m\e\n\t\a\r\g`},
ExpWorkspace: "myworkspace",
ExpDir: ".",
ExpApplyReqs: []string{},
@@ -382,7 +383,7 @@ projects:
actCtx := actCtxs[0]
Equals(t, c.ExpDir, actCtx.RepoRelDir)
Equals(t, c.ExpWorkspace, actCtx.Workspace)
Equals(t, c.ExpCommentArgs, actCtx.CommentArgs)
Equals(t, c.ExpCommentArgs, actCtx.EscapedCommentArgs)
Equals(t, c.ExpProjectName, actCtx.ProjectName)
Equals(t, c.ExpApplyReqs, actCtx.ApplyRequirements)
})
@@ -654,3 +655,64 @@ projects:
})
ErrEquals(t, "running commands in workspace \"notconfigured\" is not allowed because this directory is only configured for the following workspaces: default, staging", err)
}
// Test that extra comment args are escaped.
func TestDefaultProjectCommandBuilder_EscapeArgs(t *testing.T) {
cases := []struct {
ExtraArgs []string
ExpEscapedArgs []string
}{
{
ExtraArgs: []string{"arg1", "arg2"},
ExpEscapedArgs: []string{`\a\r\g\1`, `\a\r\g\2`},
},
{
ExtraArgs: []string{"-var=$(touch bad)"},
ExpEscapedArgs: []string{`\-\v\a\r\=\$\(\t\o\u\c\h\ \b\a\d\)`},
},
{
ExtraArgs: []string{"-- ;echo bad"},
ExpEscapedArgs: []string{`\-\-\ \;\e\c\h\o\ \b\a\d`},
},
}
for _, c := range cases {
t.Run(strings.Join(c.ExtraArgs, " "), func(t *testing.T) {
RegisterMockTestingT(t)
tmpDir, cleanup := DirStructure(t, map[string]interface{}{
"main.tf": nil,
})
defer cleanup()
workingDir := mocks.NewMockWorkingDir()
When(workingDir.Clone(matchers.AnyPtrToLoggingSimpleLogger(), matchers.AnyModelsRepo(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, nil)
When(workingDir.GetWorkingDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, nil)
vcsClient := vcsmocks.NewMockClient()
When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"main.tf"}, nil)
builder := &events.DefaultProjectCommandBuilder{
WorkingDirLocker: events.NewDefaultWorkingDirLocker(),
WorkingDir: workingDir,
ParserValidator: &yaml.ParserValidator{},
VCSClient: vcsClient,
ProjectFinder: &events.DefaultProjectFinder{},
CommentBuilder: &events.CommentParser{},
GlobalCfg: valid.NewGlobalCfg(true, false, false),
}
var actCtxs []models.ProjectCommandContext
var err error
actCtxs, err = builder.BuildPlanCommands(&events.CommandContext{}, &events.CommentCommand{
RepoRelDir: ".",
Flags: c.ExtraArgs,
Name: models.PlanCommand,
Verbose: false,
Workspace: "default",
})
Ok(t, err)
Equals(t, 1, len(actCtxs))
actCtx := actCtxs[0]
Equals(t, c.ExpEscapedArgs, actCtx.EscapedCommentArgs)
})
}
}

View File

@@ -38,7 +38,7 @@ func (a *ApplyStepRunner) Run(ctx models.ProjectCommandContext, extraArgs []stri
var out string
if a.isRemotePlan(contents) {
args := append(append(append([]string{"apply", "-input=false", "-no-color"}, extraArgs...), ctx.CommentArgs...))
args := append(append(append([]string{"apply", "-input=false", "-no-color"}, extraArgs...), ctx.EscapedCommentArgs...))
out, err = a.runRemoteApply(ctx, args, path, planPath, ctx.TerraformVersion)
if err == nil {
out = a.cleanRemoteApplyOutput(out)
@@ -46,7 +46,7 @@ func (a *ApplyStepRunner) Run(ctx models.ProjectCommandContext, extraArgs []stri
} else {
// NOTE: we need to quote the plan path because Bitbucket Server can
// have spaces in its repo owner names which is part of the path.
args := append(append(append([]string{"apply", "-input=false", "-no-color"}, extraArgs...), ctx.CommentArgs...), fmt.Sprintf("%q", planPath))
args := append(append(append([]string{"apply", "-input=false", "-no-color"}, extraArgs...), ctx.EscapedCommentArgs...), fmt.Sprintf("%q", planPath))
out, err = a.TerraformExecutor.RunCommandWithVersion(ctx.Log, path, args, ctx.TerraformVersion, ctx.Workspace)
}
@@ -78,7 +78,7 @@ func (a *ApplyStepRunner) hasTargetFlag(ctx models.ProjectCommandContext, extraA
return split[0] == "-target"
}
for _, arg := range ctx.CommentArgs {
for _, arg := range ctx.EscapedCommentArgs {
if isTargetFlag(arg) {
return true
}

View File

@@ -63,9 +63,9 @@ func TestRun_Success(t *testing.T) {
When(terraform.RunCommandWithVersion(matchers.AnyPtrToLoggingSimpleLogger(), AnyString(), AnyStringSlice(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := o.Run(models.ProjectCommandContext{
Workspace: "workspace",
RepoRelDir: ".",
CommentArgs: []string{"comment", "args"},
Workspace: "workspace",
RepoRelDir: ".",
EscapedCommentArgs: []string{"comment", "args"},
}, []string{"extra", "args"}, tmpDir)
Ok(t, err)
Equals(t, "output", output)
@@ -91,10 +91,10 @@ func TestRun_AppliesCorrectProjectPlan(t *testing.T) {
When(terraform.RunCommandWithVersion(matchers.AnyPtrToLoggingSimpleLogger(), AnyString(), AnyStringSlice(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := o.Run(models.ProjectCommandContext{
Workspace: "default",
RepoRelDir: ".",
ProjectName: "projectname",
CommentArgs: []string{"comment", "args"},
Workspace: "default",
RepoRelDir: ".",
ProjectName: "projectname",
EscapedCommentArgs: []string{"comment", "args"},
}, []string{"extra", "args"}, tmpDir)
Ok(t, err)
Equals(t, "output", output)
@@ -120,10 +120,10 @@ func TestRun_UsesConfiguredTFVersion(t *testing.T) {
When(terraform.RunCommandWithVersion(matchers.AnyPtrToLoggingSimpleLogger(), AnyString(), AnyStringSlice(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := o.Run(models.ProjectCommandContext{
Workspace: "workspace",
RepoRelDir: ".",
CommentArgs: []string{"comment", "args"},
TerraformVersion: tfVersion,
Workspace: "workspace",
RepoRelDir: ".",
EscapedCommentArgs: []string{"comment", "args"},
TerraformVersion: tfVersion,
}, []string{"extra", "args"}, tmpDir)
Ok(t, err)
Equals(t, "output", output)
@@ -197,9 +197,9 @@ func TestRun_UsingTarget(t *testing.T) {
}
output, err := step.Run(models.ProjectCommandContext{
Workspace: "workspace",
RepoRelDir: ".",
CommentArgs: c.commentFlags,
Workspace: "workspace",
RepoRelDir: ".",
EscapedCommentArgs: c.commentFlags,
}, c.extraArgs, tmpDir)
Equals(t, "", output)
if c.expErr {
@@ -240,11 +240,11 @@ Plan: 0 to add, 0 to change, 1 to destroy.`
}
tfVersion, _ := version.NewVersion("0.11.0")
ctx := models.ProjectCommandContext{
Log: logging.NewSimpleLogger("testing", false, logging.Debug),
Workspace: "workspace",
RepoRelDir: ".",
CommentArgs: []string{"comment", "args"},
TerraformVersion: tfVersion,
Log: logging.NewSimpleLogger("testing", false, logging.Debug),
Workspace: "workspace",
RepoRelDir: ".",
EscapedCommentArgs: []string{"comment", "args"},
TerraformVersion: tfVersion,
}
output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir)
<-tfExec.DoneCh
@@ -302,11 +302,11 @@ Plan: 0 to add, 0 to change, 1 to destroy.`
tfVersion, _ := version.NewVersion("0.11.0")
output, err := o.Run(models.ProjectCommandContext{
Log: logging.NewSimpleLogger("testing", false, logging.Debug),
Workspace: "workspace",
RepoRelDir: ".",
CommentArgs: []string{"comment", "args"},
TerraformVersion: tfVersion,
Log: logging.NewSimpleLogger("testing", false, logging.Debug),
Workspace: "workspace",
RepoRelDir: ".",
EscapedCommentArgs: []string{"comment", "args"},
TerraformVersion: tfVersion,
}, []string{"extra", "args"}, tmpDir)
<-tfExec.DoneCh
ErrEquals(t, `Plan generated during apply phase did not match plan generated during plan phase.

View File

@@ -44,60 +44,60 @@ func (mock *MockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull m
return ret0, ret1
}
func (mock *MockPullApprovedChecker) VerifyWasCalledOnce() *VerifierPullApprovedChecker {
return &VerifierPullApprovedChecker{
func (mock *MockPullApprovedChecker) VerifyWasCalledOnce() *VerifierMockPullApprovedChecker {
return &VerifierMockPullApprovedChecker{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockPullApprovedChecker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierPullApprovedChecker {
return &VerifierPullApprovedChecker{
func (mock *MockPullApprovedChecker) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockPullApprovedChecker {
return &VerifierMockPullApprovedChecker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockPullApprovedChecker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierPullApprovedChecker {
return &VerifierPullApprovedChecker{
func (mock *MockPullApprovedChecker) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockPullApprovedChecker {
return &VerifierMockPullApprovedChecker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockPullApprovedChecker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierPullApprovedChecker {
return &VerifierPullApprovedChecker{
func (mock *MockPullApprovedChecker) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockPullApprovedChecker {
return &VerifierMockPullApprovedChecker{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierPullApprovedChecker struct {
type VerifierMockPullApprovedChecker struct {
mock *MockPullApprovedChecker
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) *PullApprovedChecker_PullIsApproved_OngoingVerification {
func (verifier *VerifierMockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) *MockPullApprovedChecker_PullIsApproved_OngoingVerification {
params := []pegomock.Param{baseRepo, pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsApproved", params, verifier.timeout)
return &PullApprovedChecker_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockPullApprovedChecker_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type PullApprovedChecker_PullIsApproved_OngoingVerification struct {
type MockPullApprovedChecker_PullIsApproved_OngoingVerification struct {
mock *MockPullApprovedChecker
methodInvocations []pegomock.MethodInvocation
}
func (c *PullApprovedChecker_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
baseRepo, pull := c.GetAllCapturedArguments()
return baseRepo[len(baseRepo)-1], pull[len(pull)-1]
}
func (c *PullApprovedChecker_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))

View File

@@ -64,7 +64,7 @@ func (p *PlanStepRunner) isRemoteOpsErr(output string, err error) bool {
if err == nil {
return false
}
return strings.Contains(output, remoteOpsErr)
return strings.Contains(output, remoteOpsErr01114) || strings.Contains(output, remoteOpsErr012)
}
// remotePlan runs a terraform plan command compatible with TFE remote
@@ -73,7 +73,7 @@ func (p *PlanStepRunner) remotePlan(ctx models.ProjectCommandContext, extraArgs
argList := [][]string{
{"plan", "-input=false", "-refresh", "-no-color"},
extraArgs,
ctx.CommentArgs,
ctx.EscapedCommentArgs,
}
args := p.flatten(argList)
output, err := p.runRemotePlan(ctx, args, path, tfVersion)
@@ -174,7 +174,7 @@ func (p *PlanStepRunner) buildPlanCmd(ctx models.ProjectCommandContext, extraArg
{"plan", "-input=false", "-refresh", "-no-color", "-out", fmt.Sprintf("%q", planFile)},
tfVars,
extraArgs,
ctx.CommentArgs,
ctx.EscapedCommentArgs,
envFileArgs,
}
@@ -298,15 +298,25 @@ func (p *PlanStepRunner) runRemotePlan(
var vTwelveAndUp = MustConstraint(">=0.12-a")
// remoteOpsErr is the error terraform plan will return if this project is
// using TFE remote operations.
var remoteOpsErr = `Error: Saving a generated plan is currently not supported!
// remoteOpsErr01114 is the error terraform plan will return if this project is
// using TFE remote operations in TF 0.11.14.
var remoteOpsErr01114 = `Error: Saving a generated plan is currently not supported!
The "remote" backend does not support saving the generated execution
plan locally at this time.
`
// remoteOpsErr012 is the error terraform plan will return if this project is
// using TFE remote operations in TF 0.12.{0-4}. Later versions haven't been
// released yet at this time.
var remoteOpsErr012 = `Error: Saving a generated plan is currently not supported
The "remote" backend does not support saving the generated execution plan
locally at this time.
`
// remoteOpsHeader is the header we add to the planfile if this plan was
// generated using TFE remote operations.
var remoteOpsHeader = "Atlantis: this plan was created by remote ops\n"

View File

@@ -8,7 +8,7 @@ import (
"strings"
"testing"
version "github.com/hashicorp/go-version"
"github.com/hashicorp/go-version"
mocks2 "github.com/runatlantis/atlantis/server/events/mocks"
"github.com/runatlantis/atlantis/server/events/terraform"
@@ -39,11 +39,11 @@ func TestRun_NoWorkspaceIn08(t *testing.T) {
When(terraform.RunCommandWithVersion(matchers.AnyPtrToLoggingSimpleLogger(), AnyString(), AnyStringSlice(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := s.Run(models.ProjectCommandContext{
Log: logger,
CommentArgs: []string{"comment", "args"},
Workspace: workspace,
RepoRelDir: ".",
User: models.User{Username: "username"},
Log: logger,
EscapedCommentArgs: []string{"comment", "args"},
Workspace: workspace,
RepoRelDir: ".",
User: models.User{Username: "username"},
Pull: models.PullRequest{
Num: 2,
},
@@ -166,11 +166,11 @@ func TestRun_SwitchesWorkspace(t *testing.T) {
When(terraform.RunCommandWithVersion(matchers.AnyPtrToLoggingSimpleLogger(), AnyString(), AnyStringSlice(), matchers2.AnyPtrToGoVersionVersion(), AnyString())).
ThenReturn("output", nil)
output, err := s.Run(models.ProjectCommandContext{
Log: logger,
Workspace: "workspace",
RepoRelDir: ".",
User: models.User{Username: "username"},
CommentArgs: []string{"comment", "args"},
Log: logger,
Workspace: "workspace",
RepoRelDir: ".",
User: models.User{Username: "username"},
EscapedCommentArgs: []string{"comment", "args"},
Pull: models.PullRequest{
Num: 2,
},
@@ -286,11 +286,11 @@ func TestRun_CreatesWorkspace(t *testing.T) {
When(terraform.RunCommandWithVersion(logger, "/path", expPlanArgs, tfVersion, "workspace")).ThenReturn("output", nil)
output, err := s.Run(models.ProjectCommandContext{
Log: logger,
Workspace: "workspace",
RepoRelDir: ".",
User: models.User{Username: "username"},
CommentArgs: []string{"comment", "args"},
Log: logger,
Workspace: "workspace",
RepoRelDir: ".",
User: models.User{Username: "username"},
EscapedCommentArgs: []string{"comment", "args"},
Pull: models.PullRequest{
Num: 2,
},
@@ -346,11 +346,11 @@ func TestRun_NoWorkspaceSwitchIfNotNecessary(t *testing.T) {
When(terraform.RunCommandWithVersion(logger, "/path", expPlanArgs, tfVersion, "workspace")).ThenReturn("output", nil)
output, err := s.Run(models.ProjectCommandContext{
Log: logger,
Workspace: "workspace",
RepoRelDir: ".",
User: models.User{Username: "username"},
CommentArgs: []string{"comment", "args"},
Log: logger,
Workspace: "workspace",
RepoRelDir: ".",
User: models.User{Username: "username"},
EscapedCommentArgs: []string{"comment", "args"},
Pull: models.PullRequest{
Num: 2,
},
@@ -417,11 +417,11 @@ func TestRun_AddsEnvVarFile(t *testing.T) {
When(terraform.RunCommandWithVersion(logger, tmpDir, expPlanArgs, tfVersion, "workspace")).ThenReturn("output", nil)
output, err := s.Run(models.ProjectCommandContext{
Log: logger,
Workspace: "workspace",
RepoRelDir: ".",
User: models.User{Username: "username"},
CommentArgs: []string{"comment", "args"},
Log: logger,
Workspace: "workspace",
RepoRelDir: ".",
User: models.User{Username: "username"},
EscapedCommentArgs: []string{"comment", "args"},
Pull: models.PullRequest{
Num: 2,
},
@@ -476,12 +476,12 @@ func TestRun_UsesDiffPathForProject(t *testing.T) {
When(terraform.RunCommandWithVersion(logger, "/path", expPlanArgs, tfVersion, "default")).ThenReturn("output", nil)
output, err := s.Run(models.ProjectCommandContext{
Log: logger,
Workspace: "default",
RepoRelDir: ".",
User: models.User{Username: "username"},
CommentArgs: []string{"comment", "args"},
ProjectName: "projectname",
Log: logger,
Workspace: "default",
RepoRelDir: ".",
User: models.User{Username: "username"},
EscapedCommentArgs: []string{"comment", "args"},
ProjectName: "projectname",
Pull: models.PullRequest{
Num: 2,
},
@@ -627,10 +627,10 @@ func TestRun_NoOptionalVarsIn012(t *testing.T) {
AnyString())).ThenReturn("output", nil)
output, err := s.Run(models.ProjectCommandContext{
Workspace: "default",
RepoRelDir: ".",
User: models.User{Username: "username"},
CommentArgs: []string{"comment", "args"},
Workspace: "default",
RepoRelDir: ".",
User: models.User{Username: "username"},
EscapedCommentArgs: []string{"comment", "args"},
Pull: models.PullRequest{
Num: 2,
},
@@ -659,82 +659,93 @@ func TestRun_NoOptionalVarsIn012(t *testing.T) {
// Test plans if using remote ops.
func TestRun_RemoteOps(t *testing.T) {
RegisterMockTestingT(t)
terraform := mocks.NewMockClient()
asyncTf := &remotePlanMock{}
tfVersion, _ := version.NewVersion("0.11.12")
updater := mocks2.NewMockCommitStatusUpdater()
s := runtime.PlanStepRunner{
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
AsyncTFExec: asyncTf,
CommitStatusUpdater: updater,
}
absProjectPath, cleanup := TempDir(t)
defer cleanup()
// First, terraform workspace gets run.
When(terraform.RunCommandWithVersion(
nil,
absProjectPath,
[]string{"workspace", "show"},
tfVersion,
"default")).ThenReturn("default\n", nil)
// Then the first call to terraform plan should return the remote ops error.
expPlanArgs := []string{"plan",
"-input=false",
"-refresh",
"-no-color",
"-out",
fmt.Sprintf("%q", filepath.Join(absProjectPath, "default.tfplan")),
"-var",
"atlantis_user=\"username\"",
"-var",
"atlantis_repo=\"owner/repo\"",
"-var",
"atlantis_repo_name=\"repo\"",
"-var",
"atlantis_repo_owner=\"owner\"",
"-var",
"atlantis_pull_num=2",
"extra",
"args",
"comment",
"args",
}
planErr := errors.New("exit status 1: err")
planOutput := `
Error: Saving a generated plan is currently not supported!
cases := map[string]string{
"0.11.14 error": `Error: Saving a generated plan is currently not supported!
The "remote" backend does not support saving the generated execution
plan locally at this time.
`
asyncTf.LinesToSend = remotePlanOutput
When(terraform.RunCommandWithVersion(nil, absProjectPath, expPlanArgs, tfVersion, "default")).
ThenReturn(planOutput, planErr)
`,
"0.12.* error": `Error: Saving a generated plan is currently not supported
// Now that mocking is set up, we're ready to run the plan.
ctx := models.ProjectCommandContext{
Workspace: "default",
RepoRelDir: ".",
User: models.User{Username: "username"},
CommentArgs: []string{"comment", "args"},
Pull: models.PullRequest{
Num: 2,
},
BaseRepo: models.Repo{
FullName: "owner/repo",
Owner: "owner",
Name: "repo",
},
The "remote" backend does not support saving the generated execution plan
locally at this time.
`,
}
output, err := s.Run(ctx, []string{"extra", "args"}, absProjectPath)
Ok(t, err)
Equals(t, `
for name, remoteOpsErr := range cases {
t.Run(name, func(t *testing.T) {
RegisterMockTestingT(t)
terraform := mocks.NewMockClient()
asyncTf := &remotePlanMock{}
tfVersion, _ := version.NewVersion("0.11.12")
updater := mocks2.NewMockCommitStatusUpdater()
s := runtime.PlanStepRunner{
TerraformExecutor: terraform,
DefaultTFVersion: tfVersion,
AsyncTFExec: asyncTf,
CommitStatusUpdater: updater,
}
absProjectPath, cleanup := TempDir(t)
defer cleanup()
// First, terraform workspace gets run.
When(terraform.RunCommandWithVersion(
nil,
absProjectPath,
[]string{"workspace", "show"},
tfVersion,
"default")).ThenReturn("default\n", nil)
// Then the first call to terraform plan should return the remote ops error.
expPlanArgs := []string{"plan",
"-input=false",
"-refresh",
"-no-color",
"-out",
fmt.Sprintf("%q", filepath.Join(absProjectPath, "default.tfplan")),
"-var",
"atlantis_user=\"username\"",
"-var",
"atlantis_repo=\"owner/repo\"",
"-var",
"atlantis_repo_name=\"repo\"",
"-var",
"atlantis_repo_owner=\"owner\"",
"-var",
"atlantis_pull_num=2",
"extra",
"args",
"comment",
"args",
}
planErr := errors.New("exit status 1: err")
planOutput := "\n" + remoteOpsErr
asyncTf.LinesToSend = remotePlanOutput
When(terraform.RunCommandWithVersion(nil, absProjectPath, expPlanArgs, tfVersion, "default")).
ThenReturn(planOutput, planErr)
// Now that mocking is set up, we're ready to run the plan.
ctx := models.ProjectCommandContext{
Workspace: "default",
RepoRelDir: ".",
User: models.User{Username: "username"},
EscapedCommentArgs: []string{"comment", "args"},
Pull: models.PullRequest{
Num: 2,
},
BaseRepo: models.Repo{
FullName: "owner/repo",
Owner: "owner",
Name: "repo",
},
}
output, err := s.Run(ctx, []string{"extra", "args"}, absProjectPath)
Ok(t, err)
Equals(t, `
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
- destroy
@@ -746,13 +757,13 @@ Terraform will perform the following actions:
Plan: 0 to add, 0 to change, 1 to destroy.`, output)
expRemotePlanArgs := []string{"plan", "-input=false", "-refresh", "-no-color", "extra", "args", "comment", "args"}
Equals(t, expRemotePlanArgs, asyncTf.CalledArgs)
expRemotePlanArgs := []string{"plan", "-input=false", "-refresh", "-no-color", "extra", "args", "comment", "args"}
Equals(t, expRemotePlanArgs, asyncTf.CalledArgs)
// Verify that the fake plan file we write has the correct contents.
bytes, err := ioutil.ReadFile(filepath.Join(absProjectPath, "default.tfplan"))
Ok(t, err)
Equals(t, `Atlantis: this plan was created by remote ops
// Verify that the fake plan file we write has the correct contents.
bytes, err := ioutil.ReadFile(filepath.Join(absProjectPath, "default.tfplan"))
Ok(t, err)
Equals(t, `Atlantis: this plan was created by remote ops
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
@@ -765,10 +776,12 @@ Terraform will perform the following actions:
Plan: 0 to add, 0 to change, 1 to destroy.`, string(bytes))
// Ensure that the status was updated with the runURL.
runURL := "https://app.terraform.io/app/lkysow-enterprises/atlantis-tfe-test/runs/run-is4oVvJfrkud1KvE"
updater.VerifyWasCalledOnce().UpdateProject(ctx, models.PlanCommand, models.PendingCommitStatus, runURL)
updater.VerifyWasCalledOnce().UpdateProject(ctx, models.PlanCommand, models.SuccessCommitStatus, runURL)
// Ensure that the status was updated with the runURL.
runURL := "https://app.terraform.io/app/lkysow-enterprises/atlantis-tfe-test/runs/run-is4oVvJfrkud1KvE"
updater.VerifyWasCalledOnce().UpdateProject(ctx, models.PlanCommand, models.PendingCommitStatus, runURL)
updater.VerifyWasCalledOnce().UpdateProject(ctx, models.PlanCommand, models.SuccessCommitStatus, runURL)
})
}
}
type remotePlanMock struct {

View File

@@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"
version "github.com/hashicorp/go-version"
"github.com/runatlantis/atlantis/server/events/models"
@@ -28,6 +29,7 @@ func (r *RunStepRunner) Run(ctx models.ProjectCommandContext, command string, pa
"BASE_BRANCH_NAME": ctx.Pull.BaseBranch,
"BASE_REPO_NAME": ctx.BaseRepo.Name,
"BASE_REPO_OWNER": ctx.BaseRepo.Owner,
"COMMENT_ARGS": strings.Join(ctx.EscapedCommentArgs, ","),
"DIR": path,
"HEAD_BRANCH_NAME": ctx.Pull.HeadBranch,
"HEAD_REPO_NAME": ctx.HeadRepo.Name,

View File

@@ -63,6 +63,10 @@ func TestRunStepRunner_Run(t *testing.T) {
Command: "echo user_name=$USER_NAME",
ExpOut: "user_name=acme-user\n",
},
{
Command: "echo args=$COMMENT_ARGS",
ExpOut: "args=-target=resource1,-target=resource2\n",
},
}
projVersion, err := version.NewVersion("v0.11.0")
@@ -93,11 +97,12 @@ func TestRunStepRunner_Run(t *testing.T) {
User: models.User{
Username: "acme-user",
},
Log: logging.NewNoopLogger(),
Workspace: "myworkspace",
RepoRelDir: "mydir",
TerraformVersion: projVersion,
ProjectName: c.ProjectName,
Log: logging.NewNoopLogger(),
Workspace: "myworkspace",
RepoRelDir: "mydir",
TerraformVersion: projVersion,
ProjectName: c.ProjectName,
EscapedCommentArgs: []string{"-target=resource1", "-target=resource2"},
}
out, err := r.Run(ctx, c.Command, tmpDir)
if c.ExpErr != "" {

View File

@@ -43,63 +43,63 @@ func (mock *MockDownloader) GetFile(dst string, src string, opts ...go_getter.Cl
return ret0
}
func (mock *MockDownloader) VerifyWasCalledOnce() *VerifierDownloader {
return &VerifierDownloader{
func (mock *MockDownloader) VerifyWasCalledOnce() *VerifierMockDownloader {
return &VerifierMockDownloader{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockDownloader) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierDownloader {
return &VerifierDownloader{
func (mock *MockDownloader) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockDownloader {
return &VerifierMockDownloader{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockDownloader) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierDownloader {
return &VerifierDownloader{
func (mock *MockDownloader) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockDownloader {
return &VerifierMockDownloader{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockDownloader) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierDownloader {
return &VerifierDownloader{
func (mock *MockDownloader) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockDownloader {
return &VerifierMockDownloader{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierDownloader struct {
type VerifierMockDownloader struct {
mock *MockDownloader
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierDownloader) GetFile(dst string, src string, opts ...go_getter.ClientOption) *Downloader_GetFile_OngoingVerification {
func (verifier *VerifierMockDownloader) GetFile(dst string, src string, opts ...go_getter.ClientOption) *MockDownloader_GetFile_OngoingVerification {
params := []pegomock.Param{dst, src}
for _, param := range opts {
params = append(params, param)
}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetFile", params, verifier.timeout)
return &Downloader_GetFile_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockDownloader_GetFile_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Downloader_GetFile_OngoingVerification struct {
type MockDownloader_GetFile_OngoingVerification struct {
mock *MockDownloader
methodInvocations []pegomock.MethodInvocation
}
func (c *Downloader_GetFile_OngoingVerification) GetCapturedArguments() (string, string, []go_getter.ClientOption) {
func (c *MockDownloader_GetFile_OngoingVerification) GetCapturedArguments() (string, string, []go_getter.ClientOption) {
dst, src, opts := c.GetAllCapturedArguments()
return dst[len(dst)-1], src[len(src)-1], opts[len(opts)-1]
}
func (c *Downloader_GetFile_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 [][]go_getter.ClientOption) {
func (c *MockDownloader_GetFile_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 [][]go_getter.ClientOption) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -26,21 +26,6 @@ func NewMockClient(options ...pegomock.Option) *MockClient {
func (mock *MockClient) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh }
func (mock *MockClient) FailHandler() pegomock.FailHandler { return mock.fail }
func (mock *MockClient) Version() *go_version.Version {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockClient().")
}
params := []pegomock.Param{}
result := pegomock.GetGenericMockFrom(mock).Invoke("DefaultVersion", params, []reflect.Type{reflect.TypeOf((**go_version.Version)(nil)).Elem()})
var ret0 *go_version.Version
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(*go_version.Version)
}
}
return ret0
}
func (mock *MockClient) RunCommandWithVersion(log *logging.SimpleLogger, path string, args []string, v *go_version.Version, workspace string) (string, error) {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockClient().")
@@ -60,77 +45,60 @@ func (mock *MockClient) RunCommandWithVersion(log *logging.SimpleLogger, path st
return ret0, ret1
}
func (mock *MockClient) VerifyWasCalledOnce() *VerifierClient {
return &VerifierClient{
func (mock *MockClient) VerifyWasCalledOnce() *VerifierMockClient {
return &VerifierMockClient{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierClient {
return &VerifierClient{
func (mock *MockClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockClient {
return &VerifierMockClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierClient {
return &VerifierClient{
func (mock *MockClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockClient {
return &VerifierMockClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockClient) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierClient {
return &VerifierClient{
func (mock *MockClient) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockClient {
return &VerifierMockClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierClient struct {
type VerifierMockClient struct {
mock *MockClient
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierClient) Version() *Client_Version_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DefaultVersion", params, verifier.timeout)
return &Client_Version_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_Version_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_Version_OngoingVerification) GetCapturedArguments() {
}
func (c *Client_Version_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierClient) RunCommandWithVersion(log *logging.SimpleLogger, path string, args []string, v *go_version.Version, workspace string) *Client_RunCommandWithVersion_OngoingVerification {
func (verifier *VerifierMockClient) RunCommandWithVersion(log *logging.SimpleLogger, path string, args []string, v *go_version.Version, workspace string) *MockClient_RunCommandWithVersion_OngoingVerification {
params := []pegomock.Param{log, path, args, v, workspace}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunCommandWithVersion", params, verifier.timeout)
return &Client_RunCommandWithVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClient_RunCommandWithVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_RunCommandWithVersion_OngoingVerification struct {
type MockClient_RunCommandWithVersion_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_RunCommandWithVersion_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, string, []string, *go_version.Version, string) {
func (c *MockClient_RunCommandWithVersion_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, string, []string, *go_version.Version, string) {
log, path, args, v, workspace := c.GetAllCapturedArguments()
return log[len(log)-1], path[len(path)-1], args[len(args)-1], v[len(v)-1], workspace[len(workspace)-1]
}
func (c *Client_RunCommandWithVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []string, _param2 [][]string, _param3 []*go_version.Version, _param4 []string) {
func (c *MockClient_RunCommandWithVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []string, _param2 [][]string, _param3 []*go_version.Version, _param4 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*logging.SimpleLogger, len(params[0]))

View File

@@ -97,7 +97,14 @@ var versionRegex = regexp.MustCompile("Terraform v(.*?)(\\s.*)?\n")
// version.
// tfDownloader is used to download terraform versions.
// Will asynchronously download the required version if it doesn't exist already.
func NewClient(log *logging.SimpleLogger, dataDir string, tfeToken string, defaultVersionStr string, defaultVersionFlagName string, tfDownloader Downloader) (*DefaultClient, error) {
func NewClient(
log *logging.SimpleLogger,
dataDir string,
tfeToken string,
tfeHostname string,
defaultVersionStr string,
defaultVersionFlagName string,
tfDownloader Downloader) (*DefaultClient, error) {
var finalDefaultVersion *version.Version
var localVersion *version.Version
versions := make(map[string]string)
@@ -149,7 +156,7 @@ func NewClient(log *logging.SimpleLogger, dataDir string, tfeToken string, defau
if err != nil {
return nil, errors.Wrap(err, "getting home dir to write ~/.terraformrc file")
}
if err := generateRCFile(tfeToken, home); err != nil {
if err := generateRCFile(tfeToken, tfeHostname, home); err != nil {
return nil, err
}
}
@@ -383,12 +390,13 @@ func ensureVersion(log *logging.SimpleLogger, dl Downloader, versions map[string
return dest, nil
}
// generateRCFile generates a .terraformrc file containing config for tfeToken.
// generateRCFile generates a .terraformrc file containing config for tfeToken
// and hostname tfeHostname.
// It will create the file in home/.terraformrc.
func generateRCFile(tfeToken string, home string) error {
func generateRCFile(tfeToken string, tfeHostname string, home string) error {
const rcFilename = ".terraformrc"
rcFile := filepath.Join(home, rcFilename)
config := fmt.Sprintf(rcFileContents, tfeToken)
config := fmt.Sprintf(rcFileContents, tfeHostname, tfeToken)
// If there is already a .terraformrc file and its contents aren't exactly
// what we would have written to it, then we error out because we don't
@@ -428,7 +436,7 @@ func getVersion(tfBinary string) (*version.Version, error) {
// rcFileContents is a format string to be used with Sprintf that can be used
// to generate the contents of a ~/.terraformrc file for authenticating with
// Terraform Enterprise.
var rcFileContents = `credentials "app.terraform.io" {
var rcFileContents = `credentials "%s" {
token = %q
}`

View File

@@ -18,10 +18,10 @@ func TestGenerateRCFile_WritesFile(t *testing.T) {
tmp, cleanup := TempDir(t)
defer cleanup()
err := generateRCFile("token", tmp)
err := generateRCFile("token", "hostname", tmp)
Ok(t, err)
expContents := `credentials "app.terraform.io" {
expContents := `credentials "hostname" {
token = "token"
}`
actContents, err := ioutil.ReadFile(filepath.Join(tmp, ".terraformrc"))
@@ -39,7 +39,7 @@ func TestGenerateRCFile_WillNotOverwrite(t *testing.T) {
err := ioutil.WriteFile(rcFile, []byte("contents"), 0600)
Ok(t, err)
actErr := generateRCFile("token", tmp)
actErr := generateRCFile("token", "hostname", tmp)
expErr := fmt.Sprintf("can't write TFE token to %s because that file has contents that would be overwritten", tmp+"/.terraformrc")
ErrEquals(t, expErr, actErr)
}
@@ -57,7 +57,7 @@ func TestGenerateRCFile_NoErrIfContentsSame(t *testing.T) {
err := ioutil.WriteFile(rcFile, []byte(contents), 0600)
Ok(t, err)
err = generateRCFile("token", tmp)
err = generateRCFile("token", "app.terraform.io", tmp)
Ok(t, err)
}
@@ -72,7 +72,7 @@ func TestGenerateRCFile_ErrIfCannotRead(t *testing.T) {
Ok(t, err)
expErr := fmt.Sprintf("trying to read %s to ensure we're not overwriting it: open %s: permission denied", rcFile, rcFile)
actErr := generateRCFile("token", tmp)
actErr := generateRCFile("token", "hostname", tmp)
ErrEquals(t, expErr, actErr)
}
@@ -80,7 +80,7 @@ func TestGenerateRCFile_ErrIfCannotRead(t *testing.T) {
func TestGenerateRCFile_ErrIfCannotWrite(t *testing.T) {
rcFile := "/this/dir/does/not/exist/.terraformrc"
expErr := fmt.Sprintf("writing generated .terraformrc file with TFE token to %s: open %s: no such file or directory", rcFile, rcFile)
actErr := generateRCFile("token", "/this/dir/does/not/exist")
actErr := generateRCFile("token", "hostname", "/this/dir/does/not/exist")
ErrEquals(t, expErr, actErr)
}

View File

@@ -67,7 +67,7 @@ is 0.11.13. You can update by downloading from www.terraform.io/downloads.html
Ok(t, err)
defer tempSetEnv(t, "PATH", fmt.Sprintf("%s:%s", tmp, os.Getenv("PATH")))()
c, err := terraform.NewClient(nil, tmp, "", "", cmd.DefaultTFVersionFlag, nil)
c, err := terraform.NewClient(nil, tmp, "", "", "", cmd.DefaultTFVersionFlag, nil)
Ok(t, err)
Ok(t, err)
@@ -95,7 +95,7 @@ is 0.11.13. You can update by downloading from www.terraform.io/downloads.html
Ok(t, err)
defer tempSetEnv(t, "PATH", fmt.Sprintf("%s:%s", tmp, os.Getenv("PATH")))()
c, err := terraform.NewClient(nil, tmp, "", "0.11.10", cmd.DefaultTFVersionFlag, nil)
c, err := terraform.NewClient(nil, tmp, "", "", "0.11.10", cmd.DefaultTFVersionFlag, nil)
Ok(t, err)
Ok(t, err)
@@ -115,7 +115,7 @@ func TestNewClient_NoTF(t *testing.T) {
// Set PATH to only include our empty directory.
defer tempSetEnv(t, "PATH", tmp)()
_, err := terraform.NewClient(nil, tmp, "", "", cmd.DefaultTFVersionFlag, nil)
_, err := terraform.NewClient(nil, tmp, "", "", "", cmd.DefaultTFVersionFlag, nil)
ErrEquals(t, "terraform not found in $PATH. Set --default-tf-version or download terraform from https://www.terraform.io/downloads.html", err)
}
@@ -132,7 +132,7 @@ func TestNewClient_DefaultTFFlagInPath(t *testing.T) {
Ok(t, err)
defer tempSetEnv(t, "PATH", fmt.Sprintf("%s:%s", tmp, os.Getenv("PATH")))()
c, err := terraform.NewClient(nil, tmp, "", "0.11.10", cmd.DefaultTFVersionFlag, nil)
c, err := terraform.NewClient(nil, tmp, "", "", "0.11.10", cmd.DefaultTFVersionFlag, nil)
Ok(t, err)
Ok(t, err)
@@ -156,7 +156,7 @@ func TestNewClient_DefaultTFFlagInBinDir(t *testing.T) {
Ok(t, err)
defer tempSetEnv(t, "PATH", fmt.Sprintf("%s:%s", tmp, os.Getenv("PATH")))()
c, err := terraform.NewClient(nil, tmp, "", "0.11.10", cmd.DefaultTFVersionFlag, nil)
c, err := terraform.NewClient(nil, tmp, "", "", "0.11.10", cmd.DefaultTFVersionFlag, nil)
Ok(t, err)
Ok(t, err)
@@ -182,7 +182,7 @@ func TestNewClient_DefaultTFFlagDownload(t *testing.T) {
err := ioutil.WriteFile(params[0].(string), []byte("#!/bin/sh\necho '\nTerraform v0.11.10\n'"), 0755)
return []pegomock.ReturnValue{err}
})
c, err := terraform.NewClient(nil, tmp, "", "0.11.10", cmd.DefaultTFVersionFlag, mockDownloader)
c, err := terraform.NewClient(nil, tmp, "", "", "0.11.10", cmd.DefaultTFVersionFlag, mockDownloader)
Ok(t, err)
Ok(t, err)
@@ -206,7 +206,7 @@ func TestNewClient_DefaultTFFlagDownload(t *testing.T) {
func TestNewClient_BadVersion(t *testing.T) {
tmp, cleanup := TempDir(t)
defer cleanup()
_, err := terraform.NewClient(nil, tmp, "", "malformed", cmd.DefaultTFVersionFlag, nil)
_, err := terraform.NewClient(nil, tmp, "", "", "malformed", cmd.DefaultTFVersionFlag, nil)
ErrEquals(t, "Malformed version: malformed", err)
}
@@ -229,7 +229,7 @@ func TestRunCommandWithVersion_DLsTF(t *testing.T) {
return []pegomock.ReturnValue{err}
})
c, err := terraform.NewClient(nil, tmp, "", "0.11.10", cmd.DefaultTFVersionFlag, mockDownloader)
c, err := terraform.NewClient(nil, tmp, "", "", "0.11.10", cmd.DefaultTFVersionFlag, mockDownloader)
Ok(t, err)
Equals(t, "0.11.10", c.DefaultVersion().String())

View File

@@ -1,59 +1,71 @@
{
"pullrequest": {
"rendered": {
"description": {
"raw": "main.tf edited online with Bitbucket",
"markup": "markdown",
"html": "<p>main.tf edited online with Bitbucket</p>",
"type": "rendered"
},
"title": {
"raw": "main.tf edited online with Bitbucket",
"markup": "markdown",
"html": "<p>main.tf edited online with Bitbucket</p>",
"type": "rendered"
}
},
"type": "pullrequest",
"description": "main.tf edited online with Bitbucket",
"links": {
"decline": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/decline"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/decline"
},
"commits": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/commits"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/commits"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16"
},
"comments": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/comments"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/comments"
},
"merge": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/merge"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/merge"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/pull-requests/2"
"href": "https://bitbucket.org/lkysow/atlantis-example/pull-requests/16"
},
"activity": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/activity"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/activity"
},
"diff": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/diff"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/diff"
},
"approve": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/approve"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/approve"
},
"statuses": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/statuses"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/statuses"
}
},
"title": "main.tf edited online with Bitbucket",
"close_source_branch": true,
"reviewers": [],
"id": 2,
"id": 16,
"destination": {
"commit": {
"hash": "1ed8205eec00",
"hash": "1d1f6d3216f1",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/1ed8205eec00"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/1d1f6d3216f1"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/commits/1d1f6d3216f1"
}
}
},
"branch": {
"name": "master"
},
"repository": {
"full_name": "lkysow/atlantis-example",
"type": "repository",
"name": "atlantis-example",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example"
@@ -65,10 +77,16 @@
"href": "https://bytebucket.org/ravatar/%7B94189367-116b-436a-9f77-2314b97a6067%7D?ts=default"
}
},
"type": "repository",
"name": "atlantis-example",
"full_name": "lkysow/atlantis-example",
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"branch": {
"name": "master"
}
},
"comment_count": 0,
"created_on": "2019-06-13T13:37:58.036928+00:00",
"summary": {
"raw": "main.tf edited online with Bitbucket",
"markup": "markdown",
@@ -77,78 +95,64 @@
},
"source": {
"commit": {
"hash": "e0624da46d3a",
"hash": "1e69a602caef",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/e0624da46d3a"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow-fork/atlantis-example/commit/1e69a602caef"
},
"html": {
"href": "https://bitbucket.org/lkysow-fork/atlantis-example/commits/1e69a602caef"
}
}
},
"branch": {
"name": "lkysow/maintf-edited-online-with-bitbucket-1532029690581"
},
"repository": {
"full_name": "lkysow/atlantis-example",
"type": "repository",
"name": "atlantis-example",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow-fork/atlantis-example"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example"
"href": "https://bitbucket.org/lkysow-fork/atlantis-example"
},
"avatar": {
"href": "https://bytebucket.org/ravatar/%7B94189367-116b-436a-9f77-2314b97a6067%7D?ts=default"
}
},
"type": "repository",
"name": "atlantis-example",
"full_name": "lkysow-fork/atlantis-example",
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"branch": {
"name": "Luke/maintf-edited-online-with-bitbucket-1560433073473"
}
},
"comment_count": 0,
"state": "OPEN",
"task_count": 0,
"participants": [],
"reason": "",
"updated_on": "2019-06-13T13:37:58.128400+00:00",
"author": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"created_on": "2018-07-19T19:48:14.228611+00:00",
"participants": [],
"reason": "",
"updated_on": "2018-07-19T19:48:14.283739+00:00",
"merge_commit": null,
"closed_by": null,
"task_count": 0
},
"actor": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
}
},
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
"closed_by": null
},
"repository": {
"scm": "git",
@@ -167,25 +171,43 @@
},
"full_name": "lkysow/atlantis-example",
"owner": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"type": "repository",
"is_private": false,
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"actor": {
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
}
}
}

View File

@@ -1,59 +1,71 @@
{
"pullrequest": {
"rendered": {
"description": {
"raw": "main.tf edited online with Bitbucket",
"markup": "markdown",
"html": "<p>main.tf edited online with Bitbucket</p>",
"type": "rendered"
},
"title": {
"raw": "main.tf edited online with Bitbucket",
"markup": "markdown",
"html": "<p>main.tf edited online with Bitbucket</p>",
"type": "rendered"
}
},
"type": "pullrequest",
"description": "main.tf edited online with Bitbucket",
"links": {
"decline": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/decline"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/decline"
},
"commits": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/commits"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/commits"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16"
},
"comments": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/comments"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/comments"
},
"merge": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/merge"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/merge"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/pull-requests/2"
"href": "https://bitbucket.org/lkysow/atlantis-example/pull-requests/16"
},
"activity": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/activity"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/activity"
},
"diff": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/diff"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/diff"
},
"approve": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/approve"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/approve"
},
"statuses": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/2/statuses"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/16/statuses"
}
},
"title": "main.tf edited online with Bitbucket",
"close_source_branch": true,
"reviewers": [],
"id": 2,
"id": 16,
"destination": {
"commit": {
"hash": "1ed8205eec00",
"hash": "1d1f6d3216f1",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/1ed8205eec00"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/1d1f6d3216f1"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/commits/1d1f6d3216f1"
}
}
},
"branch": {
"name": "master"
},
"repository": {
"full_name": "lkysow/atlantis-example",
"type": "repository",
"name": "atlantis-example",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example"
@@ -65,10 +77,16 @@
"href": "https://bytebucket.org/ravatar/%7B94189367-116b-436a-9f77-2314b97a6067%7D?ts=default"
}
},
"type": "repository",
"name": "atlantis-example",
"full_name": "lkysow/atlantis-example",
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"branch": {
"name": "master"
}
},
"comment_count": 9,
"created_on": "2019-06-13T13:37:58.036928+00:00",
"summary": {
"raw": "main.tf edited online with Bitbucket",
"markup": "markdown",
@@ -77,128 +95,92 @@
},
"source": {
"commit": {
"hash": "e0624da46d3a",
"hash": "1e69a602caef",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow-fork/atlantis-example/commit/e0624da46d3a"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/1e69a602caef"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/commits/1e69a602caef"
}
}
},
"branch": {
"name": "lkysow/maintf-edited-online-with-bitbucket-1532029690581"
},
"repository": {
"full_name": "lkysow-fork/atlantis-example",
"type": "repository",
"name": "atlantis-example",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow-fork/atlantis-example"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example"
},
"html": {
"href": "https://bitbucket.org/lkysow-fork/atlantis-example"
"href": "https://bitbucket.org/lkysow/atlantis-example"
},
"avatar": {
"href": "https://bytebucket.org/ravatar/%7B94189367-116b-436a-9f77-2314b97a6067%7D?ts=default"
}
},
"type": "repository",
"name": "atlantis-example",
"full_name": "lkysow/atlantis-example",
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"branch": {
"name": "Luke/maintf-edited-online-with-bitbucket-1560433073473"
}
},
"comment_count": 0,
"state": "MERGED",
"task_count": 0,
"participants": [],
"reason": "",
"updated_on": "2019-06-13T13:38:38.142188+00:00",
"author": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"created_on": "2018-07-19T19:48:14.228611+00:00",
"participants": [
{
"type": "participant",
"user": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
}
},
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"role": "PARTICIPANT",
"approved": true,
"participated_on": "2018-07-19T19:51:24.190902+00:00"
}
],
"reason": "",
"updated_on": "2018-07-19T19:51:49.774941+00:00",
"merge_commit": {
"hash": "c21506eeea5f",
"hash": "981c4a02003b",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/c21506eeea5f"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/981c4a02003b"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/commits/981c4a02003b"
}
}
},
"closed_by": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"task_count": 0
},
"actor": {
"username": "lkysow",
"nickname": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
}
},
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
}
},
"repository": {
"scm": "git",
@@ -217,25 +199,43 @@
},
"full_name": "lkysow/atlantis-example",
"owner": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"type": "repository",
"is_private": false,
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"actor": {
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
}
}

View File

@@ -1,58 +1,71 @@
{
"pullrequest": {
"merge_commit": null,
"description": "main.tf edited online with Bitbucket",
"links": {
"decline": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3/decline"
"rendered": {
"description": {
"raw": "",
"markup": "markdown",
"html": "",
"type": "rendered"
},
"commits": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3/commits"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3"
},
"comments": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3/comments"
},
"merge": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3/merge"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/pull-requests/3"
},
"activity": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3/activity"
},
"diff": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3/diff"
},
"approve": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3/approve"
},
"statuses": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/3/statuses"
"title": {
"raw": "testtest",
"markup": "markdown",
"html": "<p>testtest</p>",
"type": "rendered"
}
},
"title": "main.tf edited online with Bitbucket",
"type": "pullrequest",
"description": "",
"links": {
"decline": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13/decline"
},
"commits": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13/commits"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13"
},
"comments": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13/comments"
},
"merge": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13/merge"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/pull-requests/13"
},
"activity": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13/activity"
},
"diff": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13/diff"
},
"approve": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13/approve"
},
"statuses": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/pullrequests/13/statuses"
}
},
"title": "testtest",
"close_source_branch": false,
"reviewers": [],
"id": 13,
"destination": {
"commit": {
"hash": "c21506eeea5f",
"hash": "1d1f6d3216f1",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/c21506eeea5f"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/1d1f6d3216f1"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/commits/1d1f6d3216f1"
}
}
},
"branch": {
"name": "master"
},
"repository": {
"full_name": "lkysow/atlantis-example",
"type": "repository",
"name": "atlantis-example",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example"
@@ -64,50 +77,36 @@
"href": "https://bytebucket.org/ravatar/%7B94189367-116b-436a-9f77-2314b97a6067%7D?ts=default"
}
},
"type": "repository",
"name": "atlantis-example",
"full_name": "lkysow/atlantis-example",
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"branch": {
"name": "master"
}
},
"comment_count": 1,
"closed_by": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
}
},
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"created_on": "2019-02-12T16:54:45.891127+00:00",
"summary": {
"raw": "main.tf edited online with Bitbucket",
"raw": "",
"markup": "markdown",
"html": "<p>main.tf edited online with Bitbucket</p>",
"html": "",
"type": "rendered"
},
"source": {
"commit": {
"hash": "ff06f4002ff8",
"hash": "0adf41d7f4cc",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/ff06f4002ff8"
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example/commit/0adf41d7f4cc"
},
"html": {
"href": "https://bitbucket.org/lkysow/atlantis-example/commits/0adf41d7f4cc"
}
}
},
"branch": {
"name": "lkysow/maintf-edited-online-with-bitbucket-1532029760658"
},
"repository": {
"full_name": "lkysow/atlantis-example",
"type": "repository",
"name": "atlantis-example",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/lkysow/atlantis-example"
@@ -119,78 +118,107 @@
"href": "https://bytebucket.org/ravatar/%7B94189367-116b-436a-9f77-2314b97a6067%7D?ts=default"
}
},
"type": "repository",
"name": "atlantis-example",
"full_name": "lkysow/atlantis-example",
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"branch": {
"name": "test"
}
},
"created_on": "2018-07-19T19:49:24.172710+00:00",
"comment_count": 4,
"state": "DECLINED",
"task_count": 0,
"participants": [
{
"role": "PARTICIPANT",
"participated_on": "2019-06-12T11:10:44.054840+00:00",
"type": "participant",
"user": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"approved": false
},
{
"role": "PARTICIPANT",
"approved": false,
"participated_on": "2018-07-19T19:49:29.565800+00:00"
"participated_on": "2019-06-12T11:10:47.208597+00:00",
"type": "participant",
"user": {
"display_name": "Atlantisbot",
"account_id": "5b5097035488b9140c078f7f",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/%7B73686412-4495-426f-89a7-c69ff1c8d7b8%7D"
},
"html": {
"href": "https://bitbucket.org/%7B73686412-4495-426f-89a7-c69ff1c8d7b8%7D/"
},
"avatar": {
"href": "https://avatar-cdn.atlassian.com/5b5097035488b9140c078f7f?by=id&sg=vyisLdHfYH10sFOuFCvPgHKn6ds%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FA-1.png"
}
},
"nickname": "atlantis-bot",
"type": "user",
"uuid": "{73686412-4495-426f-89a7-c69ff1c8d7b8}"
},
"approved": false
}
],
"reason": "Declined",
"updated_on": "2018-07-21T21:06:38.096401+00:00",
"reason": "",
"updated_on": "2019-06-13T13:29:24.538120+00:00",
"author": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"type": "pullrequest",
"id": 3
},
"actor": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"merge_commit": null,
"closed_by": {
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"html": {
"href": "https://bitbucket.org/lkysow/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
}
},
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
}
},
"repository": {
"scm": "git",
@@ -209,25 +237,43 @@
},
"full_name": "lkysow/atlantis-example",
"owner": {
"username": "lkysow",
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/lkysow"
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/lkysow/"
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://bitbucket.org/account/lkysow/avatar/"
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
},
"type": "repository",
"is_private": false,
"uuid": "{94189367-116b-436a-9f77-2314b97a6067}"
},
"actor": {
"display_name": "Luke",
"account_id": "557058:dc3817de-68b5-45cd-b81c-5c39d2560090",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/users/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D"
},
"html": {
"href": "https://bitbucket.org/%7Bbf34a99b-8a11-452c-8fbc-bdffc340e584%7D/"
},
"avatar": {
"href": "https://avatar-cdn.atlassian.com/557058%3Adc3817de-68b5-45cd-b81c-5c39d2560090?by=id&sg=TUDovBcAEFksW8FiPnLjf1IV73Y%3D&d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FL-1.svg"
}
},
"nickname": "Luke",
"type": "user",
"uuid": "{bf34a99b-8a11-452c-8fbc-bdffc340e584}"
}
}
}

View File

@@ -1,20 +0,0 @@
package matchers
import (
"reflect"
"github.com/petergtz/pegomock"
models "github.com/runatlantis/atlantis/server/events/models"
)
func AnyVcsCommitStatus() models.CommitStatus {
pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.CommitStatus))(nil)).Elem()))
var nullValue models.CommitStatus
return nullValue
}
func EqVcsCommitStatus(value models.CommitStatus) models.CommitStatus {
pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value})
var nullValue models.CommitStatus
return nullValue
}

View File

@@ -127,60 +127,60 @@ func (mock *MockClient) MergePull(pull models.PullRequest) error {
return ret0
}
func (mock *MockClient) VerifyWasCalledOnce() *VerifierClient {
return &VerifierClient{
func (mock *MockClient) VerifyWasCalledOnce() *VerifierMockClient {
return &VerifierMockClient{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierClient {
return &VerifierClient{
func (mock *MockClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockClient {
return &VerifierMockClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierClient {
return &VerifierClient{
func (mock *MockClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockClient {
return &VerifierMockClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockClient) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierClient {
return &VerifierClient{
func (mock *MockClient) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockClient {
return &VerifierMockClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierClient struct {
type VerifierMockClient struct {
mock *MockClient
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) *Client_GetModifiedFiles_OngoingVerification {
func (verifier *VerifierMockClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) *MockClient_GetModifiedFiles_OngoingVerification {
params := []pegomock.Param{repo, pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetModifiedFiles", params, verifier.timeout)
return &Client_GetModifiedFiles_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClient_GetModifiedFiles_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_GetModifiedFiles_OngoingVerification struct {
type MockClient_GetModifiedFiles_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_GetModifiedFiles_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockClient_GetModifiedFiles_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
repo, pull := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1]
}
func (c *Client_GetModifiedFiles_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockClient_GetModifiedFiles_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -195,23 +195,23 @@ func (c *Client_GetModifiedFiles_OngoingVerification) GetAllCapturedArguments()
return
}
func (verifier *VerifierClient) CreateComment(repo models.Repo, pullNum int, comment string) *Client_CreateComment_OngoingVerification {
func (verifier *VerifierMockClient) CreateComment(repo models.Repo, pullNum int, comment string) *MockClient_CreateComment_OngoingVerification {
params := []pegomock.Param{repo, pullNum, comment}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CreateComment", params, verifier.timeout)
return &Client_CreateComment_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClient_CreateComment_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_CreateComment_OngoingVerification struct {
type MockClient_CreateComment_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_CreateComment_OngoingVerification) GetCapturedArguments() (models.Repo, int, string) {
func (c *MockClient_CreateComment_OngoingVerification) GetCapturedArguments() (models.Repo, int, string) {
repo, pullNum, comment := c.GetAllCapturedArguments()
return repo[len(repo)-1], pullNum[len(pullNum)-1], comment[len(comment)-1]
}
func (c *Client_CreateComment_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int, _param2 []string) {
func (c *MockClient_CreateComment_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -230,23 +230,23 @@ func (c *Client_CreateComment_OngoingVerification) GetAllCapturedArguments() (_p
return
}
func (verifier *VerifierClient) PullIsApproved(repo models.Repo, pull models.PullRequest) *Client_PullIsApproved_OngoingVerification {
func (verifier *VerifierMockClient) PullIsApproved(repo models.Repo, pull models.PullRequest) *MockClient_PullIsApproved_OngoingVerification {
params := []pegomock.Param{repo, pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsApproved", params, verifier.timeout)
return &Client_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClient_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_PullIsApproved_OngoingVerification struct {
type MockClient_PullIsApproved_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockClient_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
repo, pull := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1]
}
func (c *Client_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockClient_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -261,23 +261,23 @@ func (c *Client_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_
return
}
func (verifier *VerifierClient) PullIsMergeable(repo models.Repo, pull models.PullRequest) *Client_PullIsMergeable_OngoingVerification {
func (verifier *VerifierMockClient) PullIsMergeable(repo models.Repo, pull models.PullRequest) *MockClient_PullIsMergeable_OngoingVerification {
params := []pegomock.Param{repo, pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsMergeable", params, verifier.timeout)
return &Client_PullIsMergeable_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClient_PullIsMergeable_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_PullIsMergeable_OngoingVerification struct {
type MockClient_PullIsMergeable_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_PullIsMergeable_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
func (c *MockClient_PullIsMergeable_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) {
repo, pull := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1]
}
func (c *Client_PullIsMergeable_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
func (c *MockClient_PullIsMergeable_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -292,23 +292,23 @@ func (c *Client_PullIsMergeable_OngoingVerification) GetAllCapturedArguments() (
return
}
func (verifier *VerifierClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) *Client_UpdateStatus_OngoingVerification {
func (verifier *VerifierMockClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) *MockClient_UpdateStatus_OngoingVerification {
params := []pegomock.Param{repo, pull, state, src, description, url}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateStatus", params, verifier.timeout)
return &Client_UpdateStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClient_UpdateStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_UpdateStatus_OngoingVerification struct {
type MockClient_UpdateStatus_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_UpdateStatus_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, string, string, string) {
func (c *MockClient_UpdateStatus_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, string, string, string) {
repo, pull, state, src, description, url := c.GetAllCapturedArguments()
return repo[len(repo)-1], pull[len(pull)-1], state[len(state)-1], src[len(src)-1], description[len(description)-1], url[len(url)-1]
}
func (c *Client_UpdateStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []string, _param4 []string, _param5 []string) {
func (c *MockClient_UpdateStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []string, _param4 []string, _param5 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.Repo, len(params[0]))
@@ -339,23 +339,23 @@ func (c *Client_UpdateStatus_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierClient) MergePull(pull models.PullRequest) *Client_MergePull_OngoingVerification {
func (verifier *VerifierMockClient) MergePull(pull models.PullRequest) *MockClient_MergePull_OngoingVerification {
params := []pegomock.Param{pull}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "MergePull", params, verifier.timeout)
return &Client_MergePull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockClient_MergePull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Client_MergePull_OngoingVerification struct {
type MockClient_MergePull_OngoingVerification struct {
mock *MockClient
methodInvocations []pegomock.MethodInvocation
}
func (c *Client_MergePull_OngoingVerification) GetCapturedArguments() models.PullRequest {
func (c *MockClient_MergePull_OngoingVerification) GetCapturedArguments() models.PullRequest {
pull := c.GetAllCapturedArguments()
return pull[len(pull)-1]
}
func (c *Client_MergePull_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) {
func (c *MockClient_MergePull_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]models.PullRequest, len(params[0]))

View File

@@ -41,60 +41,60 @@ func (mock *MockSender) Send(log *logging.SimpleLogger, applyResult webhooks.App
return ret0
}
func (mock *MockSender) VerifyWasCalledOnce() *VerifierSender {
return &VerifierSender{
func (mock *MockSender) VerifyWasCalledOnce() *VerifierMockSender {
return &VerifierMockSender{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockSender) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierSender {
return &VerifierSender{
func (mock *MockSender) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockSender {
return &VerifierMockSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockSender) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierSender {
return &VerifierSender{
func (mock *MockSender) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockSender {
return &VerifierMockSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockSender) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierSender {
return &VerifierSender{
func (mock *MockSender) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockSender {
return &VerifierMockSender{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierSender struct {
type VerifierMockSender struct {
mock *MockSender
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierSender) Send(log *logging.SimpleLogger, applyResult webhooks.ApplyResult) *Sender_Send_OngoingVerification {
func (verifier *VerifierMockSender) Send(log *logging.SimpleLogger, applyResult webhooks.ApplyResult) *MockSender_Send_OngoingVerification {
params := []pegomock.Param{log, applyResult}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Send", params, verifier.timeout)
return &Sender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Sender_Send_OngoingVerification struct {
type MockSender_Send_OngoingVerification struct {
mock *MockSender
methodInvocations []pegomock.MethodInvocation
}
func (c *Sender_Send_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, webhooks.ApplyResult) {
func (c *MockSender_Send_OngoingVerification) GetCapturedArguments() (*logging.SimpleLogger, webhooks.ApplyResult) {
log, applyResult := c.GetAllCapturedArguments()
return log[len(log)-1], applyResult[len(applyResult)-1]
}
func (c *Sender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []webhooks.ApplyResult) {
func (c *MockSender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []*logging.SimpleLogger, _param1 []webhooks.ApplyResult) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*logging.SimpleLogger, len(params[0]))

View File

@@ -89,94 +89,94 @@ func (mock *MockSlackClient) PostMessage(channel string, applyResult webhooks.Ap
return ret0
}
func (mock *MockSlackClient) VerifyWasCalledOnce() *VerifierSlackClient {
return &VerifierSlackClient{
func (mock *MockSlackClient) VerifyWasCalledOnce() *VerifierMockSlackClient {
return &VerifierMockSlackClient{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockSlackClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierSlackClient {
return &VerifierSlackClient{
func (mock *MockSlackClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockSlackClient {
return &VerifierMockSlackClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockSlackClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierSlackClient {
return &VerifierSlackClient{
func (mock *MockSlackClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockSlackClient {
return &VerifierMockSlackClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockSlackClient) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierSlackClient {
return &VerifierSlackClient{
func (mock *MockSlackClient) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockSlackClient {
return &VerifierMockSlackClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierSlackClient struct {
type VerifierMockSlackClient struct {
mock *MockSlackClient
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierSlackClient) AuthTest() *SlackClient_AuthTest_OngoingVerification {
func (verifier *VerifierMockSlackClient) AuthTest() *MockSlackClient_AuthTest_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "AuthTest", params, verifier.timeout)
return &SlackClient_AuthTest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSlackClient_AuthTest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SlackClient_AuthTest_OngoingVerification struct {
type MockSlackClient_AuthTest_OngoingVerification struct {
mock *MockSlackClient
methodInvocations []pegomock.MethodInvocation
}
func (c *SlackClient_AuthTest_OngoingVerification) GetCapturedArguments() {
func (c *MockSlackClient_AuthTest_OngoingVerification) GetCapturedArguments() {
}
func (c *SlackClient_AuthTest_OngoingVerification) GetAllCapturedArguments() {
func (c *MockSlackClient_AuthTest_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierSlackClient) TokenIsSet() *SlackClient_TokenIsSet_OngoingVerification {
func (verifier *VerifierMockSlackClient) TokenIsSet() *MockSlackClient_TokenIsSet_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TokenIsSet", params, verifier.timeout)
return &SlackClient_TokenIsSet_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSlackClient_TokenIsSet_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SlackClient_TokenIsSet_OngoingVerification struct {
type MockSlackClient_TokenIsSet_OngoingVerification struct {
mock *MockSlackClient
methodInvocations []pegomock.MethodInvocation
}
func (c *SlackClient_TokenIsSet_OngoingVerification) GetCapturedArguments() {
func (c *MockSlackClient_TokenIsSet_OngoingVerification) GetCapturedArguments() {
}
func (c *SlackClient_TokenIsSet_OngoingVerification) GetAllCapturedArguments() {
func (c *MockSlackClient_TokenIsSet_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierSlackClient) ChannelExists(channelName string) *SlackClient_ChannelExists_OngoingVerification {
func (verifier *VerifierMockSlackClient) ChannelExists(channelName string) *MockSlackClient_ChannelExists_OngoingVerification {
params := []pegomock.Param{channelName}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ChannelExists", params, verifier.timeout)
return &SlackClient_ChannelExists_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSlackClient_ChannelExists_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SlackClient_ChannelExists_OngoingVerification struct {
type MockSlackClient_ChannelExists_OngoingVerification struct {
mock *MockSlackClient
methodInvocations []pegomock.MethodInvocation
}
func (c *SlackClient_ChannelExists_OngoingVerification) GetCapturedArguments() string {
func (c *MockSlackClient_ChannelExists_OngoingVerification) GetCapturedArguments() string {
channelName := c.GetAllCapturedArguments()
return channelName[len(channelName)-1]
}
func (c *SlackClient_ChannelExists_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
func (c *MockSlackClient_ChannelExists_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -187,23 +187,23 @@ func (c *SlackClient_ChannelExists_OngoingVerification) GetAllCapturedArguments(
return
}
func (verifier *VerifierSlackClient) PostMessage(channel string, applyResult webhooks.ApplyResult) *SlackClient_PostMessage_OngoingVerification {
func (verifier *VerifierMockSlackClient) PostMessage(channel string, applyResult webhooks.ApplyResult) *MockSlackClient_PostMessage_OngoingVerification {
params := []pegomock.Param{channel, applyResult}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PostMessage", params, verifier.timeout)
return &SlackClient_PostMessage_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSlackClient_PostMessage_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SlackClient_PostMessage_OngoingVerification struct {
type MockSlackClient_PostMessage_OngoingVerification struct {
mock *MockSlackClient
methodInvocations []pegomock.MethodInvocation
}
func (c *SlackClient_PostMessage_OngoingVerification) GetCapturedArguments() (string, webhooks.ApplyResult) {
func (c *MockSlackClient_PostMessage_OngoingVerification) GetCapturedArguments() (string, webhooks.ApplyResult) {
channel, applyResult := c.GetAllCapturedArguments()
return channel[len(channel)-1], applyResult[len(applyResult)-1]
}
func (c *SlackClient_PostMessage_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []webhooks.ApplyResult) {
func (c *MockSlackClient_PostMessage_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []webhooks.ApplyResult) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -86,77 +86,77 @@ func (mock *MockUnderlyingSlackClient) PostMessage(channel string, text string,
return ret0, ret1, ret2
}
func (mock *MockUnderlyingSlackClient) VerifyWasCalledOnce() *VerifierUnderlyingSlackClient {
return &VerifierUnderlyingSlackClient{
func (mock *MockUnderlyingSlackClient) VerifyWasCalledOnce() *VerifierMockUnderlyingSlackClient {
return &VerifierMockUnderlyingSlackClient{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockUnderlyingSlackClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierUnderlyingSlackClient {
return &VerifierUnderlyingSlackClient{
func (mock *MockUnderlyingSlackClient) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockUnderlyingSlackClient {
return &VerifierMockUnderlyingSlackClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockUnderlyingSlackClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierUnderlyingSlackClient {
return &VerifierUnderlyingSlackClient{
func (mock *MockUnderlyingSlackClient) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockUnderlyingSlackClient {
return &VerifierMockUnderlyingSlackClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockUnderlyingSlackClient) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierUnderlyingSlackClient {
return &VerifierUnderlyingSlackClient{
func (mock *MockUnderlyingSlackClient) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockUnderlyingSlackClient {
return &VerifierMockUnderlyingSlackClient{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierUnderlyingSlackClient struct {
type VerifierMockUnderlyingSlackClient struct {
mock *MockUnderlyingSlackClient
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierUnderlyingSlackClient) AuthTest() *UnderlyingSlackClient_AuthTest_OngoingVerification {
func (verifier *VerifierMockUnderlyingSlackClient) AuthTest() *MockUnderlyingSlackClient_AuthTest_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "AuthTest", params, verifier.timeout)
return &UnderlyingSlackClient_AuthTest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockUnderlyingSlackClient_AuthTest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type UnderlyingSlackClient_AuthTest_OngoingVerification struct {
type MockUnderlyingSlackClient_AuthTest_OngoingVerification struct {
mock *MockUnderlyingSlackClient
methodInvocations []pegomock.MethodInvocation
}
func (c *UnderlyingSlackClient_AuthTest_OngoingVerification) GetCapturedArguments() {
func (c *MockUnderlyingSlackClient_AuthTest_OngoingVerification) GetCapturedArguments() {
}
func (c *UnderlyingSlackClient_AuthTest_OngoingVerification) GetAllCapturedArguments() {
func (c *MockUnderlyingSlackClient_AuthTest_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierUnderlyingSlackClient) GetChannels(excludeArchived bool) *UnderlyingSlackClient_GetChannels_OngoingVerification {
func (verifier *VerifierMockUnderlyingSlackClient) GetChannels(excludeArchived bool) *MockUnderlyingSlackClient_GetChannels_OngoingVerification {
params := []pegomock.Param{excludeArchived}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetChannels", params, verifier.timeout)
return &UnderlyingSlackClient_GetChannels_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockUnderlyingSlackClient_GetChannels_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type UnderlyingSlackClient_GetChannels_OngoingVerification struct {
type MockUnderlyingSlackClient_GetChannels_OngoingVerification struct {
mock *MockUnderlyingSlackClient
methodInvocations []pegomock.MethodInvocation
}
func (c *UnderlyingSlackClient_GetChannels_OngoingVerification) GetCapturedArguments() bool {
func (c *MockUnderlyingSlackClient_GetChannels_OngoingVerification) GetCapturedArguments() bool {
excludeArchived := c.GetAllCapturedArguments()
return excludeArchived[len(excludeArchived)-1]
}
func (c *UnderlyingSlackClient_GetChannels_OngoingVerification) GetAllCapturedArguments() (_param0 []bool) {
func (c *MockUnderlyingSlackClient_GetChannels_OngoingVerification) GetAllCapturedArguments() (_param0 []bool) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]bool, len(params[0]))
@@ -167,23 +167,23 @@ func (c *UnderlyingSlackClient_GetChannels_OngoingVerification) GetAllCapturedAr
return
}
func (verifier *VerifierUnderlyingSlackClient) PostMessage(channel string, text string, parameters slack.PostMessageParameters) *UnderlyingSlackClient_PostMessage_OngoingVerification {
func (verifier *VerifierMockUnderlyingSlackClient) PostMessage(channel string, text string, parameters slack.PostMessageParameters) *MockUnderlyingSlackClient_PostMessage_OngoingVerification {
params := []pegomock.Param{channel, text, parameters}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PostMessage", params, verifier.timeout)
return &UnderlyingSlackClient_PostMessage_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockUnderlyingSlackClient_PostMessage_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type UnderlyingSlackClient_PostMessage_OngoingVerification struct {
type MockUnderlyingSlackClient_PostMessage_OngoingVerification struct {
mock *MockUnderlyingSlackClient
methodInvocations []pegomock.MethodInvocation
}
func (c *UnderlyingSlackClient_PostMessage_OngoingVerification) GetCapturedArguments() (string, string, slack.PostMessageParameters) {
func (c *MockUnderlyingSlackClient_PostMessage_OngoingVerification) GetCapturedArguments() (string, string, slack.PostMessageParameters) {
channel, text, parameters := c.GetAllCapturedArguments()
return channel[len(channel)-1], text[len(text)-1], parameters[len(parameters)-1]
}
func (c *UnderlyingSlackClient_PostMessage_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []slack.PostMessageParameters) {
func (c *MockUnderlyingSlackClient_PostMessage_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []slack.PostMessageParameters) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -401,7 +401,7 @@ func setupE2E(t *testing.T, repoDir string) (server.EventsController, *vcsmocks.
GithubUser: "github-user",
GitlabUser: "gitlab-user",
}
terraformClient, err := terraform.NewClient(logger, dataDir, "", "", "default-tf-version", &NoopTFDownloader{})
terraformClient, err := terraform.NewClient(logger, dataDir, "", "", "", "default-tf-version", &NoopTFDownloader{})
Ok(t, err)
boltdb, err := db.New(dataDir)
Ok(t, err)

View File

@@ -126,63 +126,63 @@ func (mock *MockSimpleLogging) NewLogger(_param0 string, _param1 bool, _param2 l
return ret0
}
func (mock *MockSimpleLogging) VerifyWasCalledOnce() *VerifierSimpleLogging {
return &VerifierSimpleLogging{
func (mock *MockSimpleLogging) VerifyWasCalledOnce() *VerifierMockSimpleLogging {
return &VerifierMockSimpleLogging{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockSimpleLogging) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierSimpleLogging {
return &VerifierSimpleLogging{
func (mock *MockSimpleLogging) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockSimpleLogging {
return &VerifierMockSimpleLogging{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockSimpleLogging) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierSimpleLogging {
return &VerifierSimpleLogging{
func (mock *MockSimpleLogging) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockSimpleLogging {
return &VerifierMockSimpleLogging{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockSimpleLogging) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierSimpleLogging {
return &VerifierSimpleLogging{
func (mock *MockSimpleLogging) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockSimpleLogging {
return &VerifierMockSimpleLogging{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierSimpleLogging struct {
type VerifierMockSimpleLogging struct {
mock *MockSimpleLogging
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierSimpleLogging) Debug(format string, a ...interface{}) *SimpleLogging_Debug_OngoingVerification {
func (verifier *VerifierMockSimpleLogging) Debug(format string, a ...interface{}) *MockSimpleLogging_Debug_OngoingVerification {
params := []pegomock.Param{format}
for _, param := range a {
params = append(params, param)
}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Debug", params, verifier.timeout)
return &SimpleLogging_Debug_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSimpleLogging_Debug_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SimpleLogging_Debug_OngoingVerification struct {
type MockSimpleLogging_Debug_OngoingVerification struct {
mock *MockSimpleLogging
methodInvocations []pegomock.MethodInvocation
}
func (c *SimpleLogging_Debug_OngoingVerification) GetCapturedArguments() (string, []interface{}) {
func (c *MockSimpleLogging_Debug_OngoingVerification) GetCapturedArguments() (string, []interface{}) {
format, a := c.GetAllCapturedArguments()
return format[len(format)-1], a[len(a)-1]
}
func (c *SimpleLogging_Debug_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) {
func (c *MockSimpleLogging_Debug_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -202,26 +202,26 @@ func (c *SimpleLogging_Debug_OngoingVerification) GetAllCapturedArguments() (_pa
return
}
func (verifier *VerifierSimpleLogging) Info(format string, a ...interface{}) *SimpleLogging_Info_OngoingVerification {
func (verifier *VerifierMockSimpleLogging) Info(format string, a ...interface{}) *MockSimpleLogging_Info_OngoingVerification {
params := []pegomock.Param{format}
for _, param := range a {
params = append(params, param)
}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Info", params, verifier.timeout)
return &SimpleLogging_Info_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSimpleLogging_Info_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SimpleLogging_Info_OngoingVerification struct {
type MockSimpleLogging_Info_OngoingVerification struct {
mock *MockSimpleLogging
methodInvocations []pegomock.MethodInvocation
}
func (c *SimpleLogging_Info_OngoingVerification) GetCapturedArguments() (string, []interface{}) {
func (c *MockSimpleLogging_Info_OngoingVerification) GetCapturedArguments() (string, []interface{}) {
format, a := c.GetAllCapturedArguments()
return format[len(format)-1], a[len(a)-1]
}
func (c *SimpleLogging_Info_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) {
func (c *MockSimpleLogging_Info_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -241,26 +241,26 @@ func (c *SimpleLogging_Info_OngoingVerification) GetAllCapturedArguments() (_par
return
}
func (verifier *VerifierSimpleLogging) Warn(format string, a ...interface{}) *SimpleLogging_Warn_OngoingVerification {
func (verifier *VerifierMockSimpleLogging) Warn(format string, a ...interface{}) *MockSimpleLogging_Warn_OngoingVerification {
params := []pegomock.Param{format}
for _, param := range a {
params = append(params, param)
}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Warn", params, verifier.timeout)
return &SimpleLogging_Warn_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSimpleLogging_Warn_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SimpleLogging_Warn_OngoingVerification struct {
type MockSimpleLogging_Warn_OngoingVerification struct {
mock *MockSimpleLogging
methodInvocations []pegomock.MethodInvocation
}
func (c *SimpleLogging_Warn_OngoingVerification) GetCapturedArguments() (string, []interface{}) {
func (c *MockSimpleLogging_Warn_OngoingVerification) GetCapturedArguments() (string, []interface{}) {
format, a := c.GetAllCapturedArguments()
return format[len(format)-1], a[len(a)-1]
}
func (c *SimpleLogging_Warn_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) {
func (c *MockSimpleLogging_Warn_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -280,26 +280,26 @@ func (c *SimpleLogging_Warn_OngoingVerification) GetAllCapturedArguments() (_par
return
}
func (verifier *VerifierSimpleLogging) Err(format string, a ...interface{}) *SimpleLogging_Err_OngoingVerification {
func (verifier *VerifierMockSimpleLogging) Err(format string, a ...interface{}) *MockSimpleLogging_Err_OngoingVerification {
params := []pegomock.Param{format}
for _, param := range a {
params = append(params, param)
}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Err", params, verifier.timeout)
return &SimpleLogging_Err_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSimpleLogging_Err_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SimpleLogging_Err_OngoingVerification struct {
type MockSimpleLogging_Err_OngoingVerification struct {
mock *MockSimpleLogging
methodInvocations []pegomock.MethodInvocation
}
func (c *SimpleLogging_Err_OngoingVerification) GetCapturedArguments() (string, []interface{}) {
func (c *MockSimpleLogging_Err_OngoingVerification) GetCapturedArguments() (string, []interface{}) {
format, a := c.GetAllCapturedArguments()
return format[len(format)-1], a[len(a)-1]
}
func (c *SimpleLogging_Err_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) {
func (c *MockSimpleLogging_Err_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
@@ -319,26 +319,26 @@ func (c *SimpleLogging_Err_OngoingVerification) GetAllCapturedArguments() (_para
return
}
func (verifier *VerifierSimpleLogging) Log(level logging.LogLevel, format string, a ...interface{}) *SimpleLogging_Log_OngoingVerification {
func (verifier *VerifierMockSimpleLogging) Log(level logging.LogLevel, format string, a ...interface{}) *MockSimpleLogging_Log_OngoingVerification {
params := []pegomock.Param{level, format}
for _, param := range a {
params = append(params, param)
}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Log", params, verifier.timeout)
return &SimpleLogging_Log_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSimpleLogging_Log_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SimpleLogging_Log_OngoingVerification struct {
type MockSimpleLogging_Log_OngoingVerification struct {
mock *MockSimpleLogging
methodInvocations []pegomock.MethodInvocation
}
func (c *SimpleLogging_Log_OngoingVerification) GetCapturedArguments() (logging.LogLevel, string, []interface{}) {
func (c *MockSimpleLogging_Log_OngoingVerification) GetCapturedArguments() (logging.LogLevel, string, []interface{}) {
level, format, a := c.GetAllCapturedArguments()
return level[len(level)-1], format[len(format)-1], a[len(a)-1]
}
func (c *SimpleLogging_Log_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.LogLevel, _param1 []string, _param2 [][]interface{}) {
func (c *MockSimpleLogging_Log_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.LogLevel, _param1 []string, _param2 [][]interface{}) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]logging.LogLevel, len(params[0]))
@@ -362,57 +362,57 @@ func (c *SimpleLogging_Log_OngoingVerification) GetAllCapturedArguments() (_para
return
}
func (verifier *VerifierSimpleLogging) Underlying() *SimpleLogging_Underlying_OngoingVerification {
func (verifier *VerifierMockSimpleLogging) Underlying() *MockSimpleLogging_Underlying_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Underlying", params, verifier.timeout)
return &SimpleLogging_Underlying_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSimpleLogging_Underlying_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SimpleLogging_Underlying_OngoingVerification struct {
type MockSimpleLogging_Underlying_OngoingVerification struct {
mock *MockSimpleLogging
methodInvocations []pegomock.MethodInvocation
}
func (c *SimpleLogging_Underlying_OngoingVerification) GetCapturedArguments() {
func (c *MockSimpleLogging_Underlying_OngoingVerification) GetCapturedArguments() {
}
func (c *SimpleLogging_Underlying_OngoingVerification) GetAllCapturedArguments() {
func (c *MockSimpleLogging_Underlying_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierSimpleLogging) GetLevel() *SimpleLogging_GetLevel_OngoingVerification {
func (verifier *VerifierMockSimpleLogging) GetLevel() *MockSimpleLogging_GetLevel_OngoingVerification {
params := []pegomock.Param{}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetLevel", params, verifier.timeout)
return &SimpleLogging_GetLevel_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSimpleLogging_GetLevel_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SimpleLogging_GetLevel_OngoingVerification struct {
type MockSimpleLogging_GetLevel_OngoingVerification struct {
mock *MockSimpleLogging
methodInvocations []pegomock.MethodInvocation
}
func (c *SimpleLogging_GetLevel_OngoingVerification) GetCapturedArguments() {
func (c *MockSimpleLogging_GetLevel_OngoingVerification) GetCapturedArguments() {
}
func (c *SimpleLogging_GetLevel_OngoingVerification) GetAllCapturedArguments() {
func (c *MockSimpleLogging_GetLevel_OngoingVerification) GetAllCapturedArguments() {
}
func (verifier *VerifierSimpleLogging) NewLogger(_param0 string, _param1 bool, _param2 logging.LogLevel) *SimpleLogging_NewLogger_OngoingVerification {
func (verifier *VerifierMockSimpleLogging) NewLogger(_param0 string, _param1 bool, _param2 logging.LogLevel) *MockSimpleLogging_NewLogger_OngoingVerification {
params := []pegomock.Param{_param0, _param1, _param2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NewLogger", params, verifier.timeout)
return &SimpleLogging_NewLogger_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockSimpleLogging_NewLogger_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type SimpleLogging_NewLogger_OngoingVerification struct {
type MockSimpleLogging_NewLogger_OngoingVerification struct {
mock *MockSimpleLogging
methodInvocations []pegomock.MethodInvocation
}
func (c *SimpleLogging_NewLogger_OngoingVerification) GetCapturedArguments() (string, bool, logging.LogLevel) {
func (c *MockSimpleLogging_NewLogger_OngoingVerification) GetCapturedArguments() (string, bool, logging.LogLevel) {
_param0, _param1, _param2 := c.GetAllCapturedArguments()
return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1]
}
func (c *SimpleLogging_NewLogger_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []bool, _param2 []logging.LogLevel) {
func (c *MockSimpleLogging_NewLogger_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []bool, _param2 []logging.LogLevel) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))

View File

@@ -44,60 +44,60 @@ func (mock *MockGithubRequestValidator) Validate(r *http.Request, secret []byte)
return ret0, ret1
}
func (mock *MockGithubRequestValidator) VerifyWasCalledOnce() *VerifierGithubRequestValidator {
return &VerifierGithubRequestValidator{
func (mock *MockGithubRequestValidator) VerifyWasCalledOnce() *VerifierMockGithubRequestValidator {
return &VerifierMockGithubRequestValidator{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockGithubRequestValidator) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierGithubRequestValidator {
return &VerifierGithubRequestValidator{
func (mock *MockGithubRequestValidator) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockGithubRequestValidator {
return &VerifierMockGithubRequestValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockGithubRequestValidator) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierGithubRequestValidator {
return &VerifierGithubRequestValidator{
func (mock *MockGithubRequestValidator) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockGithubRequestValidator {
return &VerifierMockGithubRequestValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockGithubRequestValidator) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierGithubRequestValidator {
return &VerifierGithubRequestValidator{
func (mock *MockGithubRequestValidator) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockGithubRequestValidator {
return &VerifierMockGithubRequestValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierGithubRequestValidator struct {
type VerifierMockGithubRequestValidator struct {
mock *MockGithubRequestValidator
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierGithubRequestValidator) Validate(r *http.Request, secret []byte) *GithubRequestValidator_Validate_OngoingVerification {
func (verifier *VerifierMockGithubRequestValidator) Validate(r *http.Request, secret []byte) *MockGithubRequestValidator_Validate_OngoingVerification {
params := []pegomock.Param{r, secret}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Validate", params, verifier.timeout)
return &GithubRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockGithubRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type GithubRequestValidator_Validate_OngoingVerification struct {
type MockGithubRequestValidator_Validate_OngoingVerification struct {
mock *MockGithubRequestValidator
methodInvocations []pegomock.MethodInvocation
}
func (c *GithubRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
r, secret := c.GetAllCapturedArguments()
return r[len(r)-1], secret[len(secret)-1]
}
func (c *GithubRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {
func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*http.Request, len(params[0]))

View File

@@ -44,60 +44,60 @@ func (mock *MockGitlabRequestParserValidator) ParseAndValidate(r *http.Request,
return ret0, ret1
}
func (mock *MockGitlabRequestParserValidator) VerifyWasCalledOnce() *VerifierGitlabRequestParserValidator {
return &VerifierGitlabRequestParserValidator{
func (mock *MockGitlabRequestParserValidator) VerifyWasCalledOnce() *VerifierMockGitlabRequestParserValidator {
return &VerifierMockGitlabRequestParserValidator{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockGitlabRequestParserValidator) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierGitlabRequestParserValidator {
return &VerifierGitlabRequestParserValidator{
func (mock *MockGitlabRequestParserValidator) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockGitlabRequestParserValidator {
return &VerifierMockGitlabRequestParserValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockGitlabRequestParserValidator) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierGitlabRequestParserValidator {
return &VerifierGitlabRequestParserValidator{
func (mock *MockGitlabRequestParserValidator) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockGitlabRequestParserValidator {
return &VerifierMockGitlabRequestParserValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockGitlabRequestParserValidator) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierGitlabRequestParserValidator {
return &VerifierGitlabRequestParserValidator{
func (mock *MockGitlabRequestParserValidator) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockGitlabRequestParserValidator {
return &VerifierMockGitlabRequestParserValidator{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierGitlabRequestParserValidator struct {
type VerifierMockGitlabRequestParserValidator struct {
mock *MockGitlabRequestParserValidator
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierGitlabRequestParserValidator) ParseAndValidate(r *http.Request, secret []byte) *GitlabRequestParserValidator_ParseAndValidate_OngoingVerification {
func (verifier *VerifierMockGitlabRequestParserValidator) ParseAndValidate(r *http.Request, secret []byte) *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification {
params := []pegomock.Param{r, secret}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseAndValidate", params, verifier.timeout)
return &GitlabRequestParserValidator_ParseAndValidate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type GitlabRequestParserValidator_ParseAndValidate_OngoingVerification struct {
type MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification struct {
mock *MockGitlabRequestParserValidator
methodInvocations []pegomock.MethodInvocation
}
func (c *GitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
func (c *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) {
r, secret := c.GetAllCapturedArguments()
return r[len(r)-1], secret[len(secret)-1]
}
func (c *GitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {
func (c *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]*http.Request, len(params[0]))

View File

@@ -40,60 +40,60 @@ func (mock *MockTemplateWriter) Execute(wr io.Writer, data interface{}) error {
return ret0
}
func (mock *MockTemplateWriter) VerifyWasCalledOnce() *VerifierTemplateWriter {
return &VerifierTemplateWriter{
func (mock *MockTemplateWriter) VerifyWasCalledOnce() *VerifierMockTemplateWriter {
return &VerifierMockTemplateWriter{
mock: mock,
invocationCountMatcher: pegomock.Times(1),
}
}
func (mock *MockTemplateWriter) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierTemplateWriter {
return &VerifierTemplateWriter{
func (mock *MockTemplateWriter) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockTemplateWriter {
return &VerifierMockTemplateWriter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
}
}
func (mock *MockTemplateWriter) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierTemplateWriter {
return &VerifierTemplateWriter{
func (mock *MockTemplateWriter) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockTemplateWriter {
return &VerifierMockTemplateWriter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
inOrderContext: inOrderContext,
}
}
func (mock *MockTemplateWriter) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierTemplateWriter {
return &VerifierTemplateWriter{
func (mock *MockTemplateWriter) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockTemplateWriter {
return &VerifierMockTemplateWriter{
mock: mock,
invocationCountMatcher: invocationCountMatcher,
timeout: timeout,
}
}
type VerifierTemplateWriter struct {
type VerifierMockTemplateWriter struct {
mock *MockTemplateWriter
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
timeout time.Duration
}
func (verifier *VerifierTemplateWriter) Execute(wr io.Writer, data interface{}) *TemplateWriter_Execute_OngoingVerification {
func (verifier *VerifierMockTemplateWriter) Execute(wr io.Writer, data interface{}) *MockTemplateWriter_Execute_OngoingVerification {
params := []pegomock.Param{wr, data}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Execute", params, verifier.timeout)
return &TemplateWriter_Execute_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
return &MockTemplateWriter_Execute_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type TemplateWriter_Execute_OngoingVerification struct {
type MockTemplateWriter_Execute_OngoingVerification struct {
mock *MockTemplateWriter
methodInvocations []pegomock.MethodInvocation
}
func (c *TemplateWriter_Execute_OngoingVerification) GetCapturedArguments() (io.Writer, interface{}) {
func (c *MockTemplateWriter_Execute_OngoingVerification) GetCapturedArguments() (io.Writer, interface{}) {
wr, data := c.GetAllCapturedArguments()
return wr[len(wr)-1], data[len(data)-1]
}
func (c *TemplateWriter_Execute_OngoingVerification) GetAllCapturedArguments() (_param0 []io.Writer, _param1 []interface{}) {
func (c *MockTemplateWriter_Execute_OngoingVerification) GetAllCapturedArguments() (_param0 []io.Writer, _param1 []interface{}) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]io.Writer, len(params[0]))

View File

@@ -177,7 +177,14 @@ func NewServer(userConfig UserConfig, config Config) (*Server, error) {
}
vcsClient := vcs.NewClientProxy(githubClient, gitlabClient, bitbucketCloudClient, bitbucketServerClient, azuredevopsClient)
commitStatusUpdater := &events.DefaultCommitStatusUpdater{Client: vcsClient}
terraformClient, err := terraform.NewClient(logger, userConfig.DataDir, userConfig.TFEToken, userConfig.DefaultTFVersion, config.DefaultTFVersionFlag, &terraform.DefaultDownloader{})
terraformClient, err := terraform.NewClient(
logger,
userConfig.DataDir,
userConfig.TFEToken,
userConfig.TFEHostname,
userConfig.DefaultTFVersion,
config.DefaultTFVersionFlag,
&terraform.DefaultDownloader{})
// The flag.Lookup call is to detect if we're running in a unit test. If we
// are, then we don't error out because we don't have/want terraform
// installed on our CI system where the unit tests run.

View File

@@ -46,6 +46,7 @@ type UserConfig struct {
SlackToken string `mapstructure:"slack-token"`
SSLCertFile string `mapstructure:"ssl-cert-file"`
SSLKeyFile string `mapstructure:"ssl-key-file"`
TFEHostname string `mapstructure:"tfe-hostname"`
TFEToken string `mapstructure:"tfe-token"`
DefaultTFVersion string `mapstructure:"default-tf-version"`
Webhooks []WebhookConfig `mapstructure:"webhooks"`

View File

@@ -5,7 +5,7 @@
FROM circleci/golang:1.12
# Install Terraform
ENV TERRAFORM_VERSION=0.12.1
ENV TERRAFORM_VERSION=0.12.3
RUN curl -LOks https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
sudo mkdir -p /usr/local/bin/tf/versions/${TERRAFORM_VERSION} && \
sudo unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/tf/versions/${TERRAFORM_VERSION} && \

View File

@@ -3413,7 +3413,7 @@ locate-path@^2.0.0:
p-locate "^2.0.0"
path-exists "^3.0.0"
lodash._reinterpolate@~3.0.0:
lodash._reinterpolate@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@@ -3434,17 +3434,17 @@ lodash.memoize@^4.1.2:
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
lodash.template@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.4.0.tgz#e73a0385c8355591746e020b99679c690e68fba0"
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
dependencies:
lodash._reinterpolate "~3.0.0"
lodash._reinterpolate "^3.0.0"
lodash.templatesettings "^4.0.0"
lodash.templatesettings@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz#2b4d4e95ba440d915ff08bc899e4553666713316"
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33"
dependencies:
lodash._reinterpolate "~3.0.0"
lodash._reinterpolate "^3.0.0"
lodash.throttle@^4.1.1:
version "4.1.1"