From 3954955e13f98362ef0d4bd90beb58d6ea77b2bd Mon Sep 17 00:00:00 2001 From: Ken Kaizu Date: Wed, 21 Jun 2023 04:05:23 +0900 Subject: [PATCH] fix(deps): update module github.com/petergtz/pegomock/v3 to v4 (#3534) * fix(deps): update module github.com/petergtz/pegomock/v3 to v4 in go.mod * remove pegomock generate m option, which is not support after v4 * make regen-mocks * replace pegomock v4 primitive eq/matchers * convert pegomock v4 Eq/Any matchers * remove custom models.Repo matcher * pegomock v4 cannot use result method args ref https://github.com/petergtz/pegomock/issues/123 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 +- server/controllers/api_controller_test.go | 21 +- .../events/azuredevops_request_validator.go | 2 +- .../azuredevops_request_validator_test.go | 2 +- .../events/events_controller_e2e_test.go | 41 ++-- .../events/events_controller_test.go | 35 ++- .../events/github_request_validator.go | 2 +- .../events/github_request_validator_test.go | 2 +- .../events/gitlab_request_parser_validator.go | 2 +- .../gitlab_request_parser_validator_test.go | 2 +- .../mocks/matchers/ptr_to_http_request.go | 33 --- .../events/mocks/matchers/slice_of_byte.go | 31 --- .../mock_azuredevops_request_validator.go | 14 +- .../mocks/mock_github_request_validator.go | 14 +- .../mock_gitlab_request_parser_validator.go | 14 +- server/controllers/locks_controller_test.go | 12 +- .../templates/mocks/matchers/io_writer.go | 33 --- .../templates/mocks/mock_template_writer.go | 14 +- server/controllers/templates/web_templates.go | 2 +- server/core/config/raw/repo_cfg.go | 40 ++-- server/core/config/valid/repo_cfg.go | 24 +- server/core/locking/apply_locking.go | 4 +- server/core/locking/locking.go | 4 +- server/core/locking/locking_test.go | 29 ++- .../locking/mocks/matchers/command_name.go | 33 --- .../matchers/locking_applycommandlock.go | 33 --- .../mocks/matchers/locking_trylockresponse.go | 33 --- .../map_of_string_to_models_projectlock.go | 33 --- .../locking/mocks/matchers/models_project.go | 33 --- .../mocks/matchers/models_projectlock.go | 33 --- .../matchers/models_projectplanstatus.go | 33 --- .../mocks/matchers/models_pullrequest.go | 33 --- .../mocks/matchers/models_pullstatus.go | 33 --- .../locking/mocks/matchers/models_user.go | 33 --- .../mocks/matchers/ptr_to_command_lock.go | 33 --- .../matchers/ptr_to_models_projectlock.go | 33 --- .../matchers/ptr_to_models_pullstatus.go | 33 --- .../slice_of_command_projectresult.go | 33 --- .../matchers/slice_of_models_projectlock.go | 33 --- .../core/locking/mocks/matchers/time_time.go | 33 --- .../locking/mocks/mock_apply_lock_checker.go | 2 +- .../core/locking/mocks/mock_apply_locker.go | 2 +- server/core/locking/mocks/mock_backend.go | 134 +++++------ server/core/locking/mocks/mock_locker.go | 50 ++-- server/core/runtime/apply_step_runner_test.go | 10 +- .../matchers/ptr_to_go_version_version.go | 33 --- .../cache/mocks/mock_key_serializer.go | 14 +- .../runtime/cache/mocks/mock_version_path.go | 14 +- server/core/runtime/cache/version_path.go | 4 +- .../core/runtime/cache/version_path_test.go | 8 +- server/core/runtime/env_step_runner_test.go | 2 +- server/core/runtime/executor.go | 2 +- .../core/runtime/import_step_runner_test.go | 8 +- server/core/runtime/init_step_runner_test.go | 18 +- ...nimum_version_step_runner_delegate_test.go | 2 +- .../runtime/mocks/matchers/command_name.go | 33 --- .../mocks/matchers/command_projectcontext.go | 33 --- .../mocks/matchers/logging_simplelogging.go | 33 --- .../mocks/matchers/map_of_string_to_string.go | 31 --- .../mocks/matchers/models_approvalstatus.go | 33 --- .../mocks/matchers/models_commitstatus.go | 33 --- .../mocks/matchers/models_pullrequest.go | 33 --- .../runtime/mocks/matchers/models_repo.go | 33 --- .../models_workflowhookcommandcontext.go | 33 --- .../matchers/ptr_to_command_projectresult.go | 33 --- .../matchers/ptr_to_go_version_version.go | 33 --- .../matchers/recv_chan_of_models_line.go | 33 --- .../mocks/matchers/send_chan_of_string.go | 31 --- .../runtime/mocks/matchers/slice_of_string.go | 31 --- .../core/runtime/mocks/mock_async_tfexec.go | 14 +- .../mocks/mock_post_workflows_hook_runner.go | 14 +- .../mocks/mock_pre_workflows_hook_runner.go | 14 +- .../mocks/mock_pull_approved_checker.go | 14 +- server/core/runtime/mocks/mock_runner.go | 14 +- .../core/runtime/mocks/mock_status_updater.go | 22 +- .../mocks/mock_versionedexecutorworkflow.go | 26 +-- server/core/runtime/models/exec.go | 2 +- server/core/runtime/models/filepath.go | 2 +- .../mocks/matchers/map_of_string_to_string.go | 31 --- .../models/mocks/matchers/models_filepath.go | 33 --- .../models/mocks/matchers/slice_of_string.go | 31 --- server/core/runtime/models/mocks/mock_exec.go | 26 +-- .../runtime/models/mocks/mock_filepath.go | 26 +-- .../models/shell_command_runner_test.go | 11 +- .../core/runtime/multienv_step_runner_test.go | 2 +- server/core/runtime/plan_step_runner_test.go | 40 ++-- .../plan_type_step_runner_delegate_test.go | 2 +- server/core/runtime/policy/conftest_client.go | 2 +- .../runtime/policy/conftest_client_test.go | 12 +- .../policy/mocks/matchers/valid_policyset.go | 33 --- .../policy/mocks/mock_conftest_client.go | 14 +- .../runtime/policy_check_step_runner_test.go | 2 +- .../core/runtime/post_workflow_hook_runner.go | 2 +- .../runtime/post_workflow_hook_runner_test.go | 10 +- .../core/runtime/pre_workflow_hook_runner.go | 2 +- .../runtime/pre_workflow_hook_runner_test.go | 10 +- server/core/runtime/pull_approved_checker.go | 2 +- server/core/runtime/run_step_runner_test.go | 8 +- server/core/runtime/runtime.go | 6 +- server/core/runtime/show_step_runner_test.go | 2 +- .../core/runtime/state_rm_step_runner_test.go | 8 +- .../core/runtime/version_step_runner_test.go | 2 +- .../workspace_step_runner_delegate_test.go | 2 +- .../mocks/matchers/command_projectcontext.go | 33 --- .../mocks/matchers/logging_simplelogging.go | 33 --- .../mocks/matchers/map_of_string_to_string.go | 31 --- .../matchers/ptr_to_go_version_version.go | 33 --- .../mocks/matchers/slice_of_string.go | 31 --- .../core/terraform/mocks/mock_downloader.go | 26 +-- .../terraform/mocks/mock_terraform_client.go | 50 ++-- server/core/terraform/terraform_client.go | 4 +- .../terraform_client_internal_test.go | 22 +- .../core/terraform/terraform_client_test.go | 6 +- server/events/apply_command_runner_test.go | 29 ++- server/events/command_requirement_handler.go | 2 +- .../command_requirement_handler_test.go | 17 +- server/events/command_runner.go | 8 +- server/events/command_runner_test.go | 152 ++++++------ server/events/comment_parser.go | 4 +- server/events/commit_status_updater.go | 2 +- server/events/commit_status_updater_test.go | 2 +- server/events/delete_lock_command.go | 2 +- server/events/delete_lock_command_test.go | 2 +- server/events/event_parser.go | 2 +- server/events/github_app_working_dir_test.go | 4 +- server/events/import_command_runner_test.go | 4 +- .../events/matchers/logging_simplelogging.go | 33 --- server/events/matchers/models_pullrequest.go | 33 --- server/events/matchers/models_repo.go | 33 --- .../matchers/ptr_to_logging_simplelogger.go | 13 -- server/events/mock_workingdir_test.go | 79 +++---- .../mocks/matchers/azuredevops_event.go | 33 --- server/events/mocks/matchers/command_name.go | 33 --- .../mocks/matchers/command_projectcontext.go | 33 --- .../mocks/matchers/command_projectresult.go | 33 --- .../matchers/events_commentparseresult.go | 33 --- .../matchers/go_gitlab_mergecommentevent.go | 33 --- .../mocks/matchers/go_gitlab_mergeevent.go | 33 --- server/events/mocks/matchers/jobs_pullinfo.go | 33 --- .../mocks/matchers/logging_simplelogging.go | 33 --- .../mocks/matchers/map_of_string_to_string.go | 31 --- .../mocks/matchers/models_commitstatus.go | 33 --- .../events/mocks/matchers/models_project.go | 33 --- .../mocks/matchers/models_pullrequest.go | 33 --- .../matchers/models_pullrequesteventtype.go | 33 --- server/events/mocks/matchers/models_repo.go | 33 --- server/events/mocks/matchers/models_user.go | 33 --- .../mocks/matchers/models_vcshosttype.go | 33 --- .../ptr_to_azuredevops_gitpullrequest.go | 33 --- .../ptr_to_azuredevops_gitrepository.go | 33 --- .../mocks/matchers/ptr_to_command_context.go | 33 --- .../matchers/ptr_to_command_projectresult.go | 33 --- .../matchers/ptr_to_events_commentcommand.go | 33 --- .../matchers/ptr_to_events_trylockresponse.go | 33 --- .../ptr_to_github_issuecommentevent.go | 33 --- .../matchers/ptr_to_github_pullrequest.go | 33 --- .../ptr_to_github_pullrequestevent.go | 33 --- .../matchers/ptr_to_github_repository.go | 33 --- .../matchers/ptr_to_go_gitlab_mergerequest.go | 33 --- .../matchers/ptr_to_models_projectlock.go | 33 --- .../matchers/ptr_to_models_pullrequest.go | 33 --- .../mocks/matchers/ptr_to_models_repo.go | 33 --- server/events/mocks/matchers/slice_of_byte.go | 31 --- .../slice_of_command_projectcontext.go | 33 --- .../matchers/slice_of_events_pendingplan.go | 33 --- .../events/mocks/matchers/slice_of_string.go | 31 --- .../mocks/matchers/webhooks_applyresult.go | 33 --- .../mocks/mock_azuredevops_pull_getter.go | 14 +- .../mocks/mock_command_requirement_handler.go | 38 +-- server/events/mocks/mock_command_runner.go | 26 +-- server/events/mocks/mock_comment_building.go | 38 +-- server/events/mocks/mock_comment_parsing.go | 14 +- .../mocks/mock_commit_status_updater.go | 50 ++-- .../events/mocks/mock_custom_step_runner.go | 14 +- .../events/mocks/mock_delete_lock_command.go | 26 +-- server/events/mocks/mock_env_step_runner.go | 14 +- server/events/mocks/mock_event_parsing.go | 218 +++++++++--------- .../events/mocks/mock_github_pull_getter.go | 14 +- .../mocks/mock_gitlab_merge_request_getter.go | 14 +- .../events/mocks/mock_job_message_sender.go | 14 +- server/events/mocks/mock_job_url_setter.go | 22 +- .../events/mocks/mock_lock_url_generator.go | 14 +- .../events/mocks/mock_pending_plan_finder.go | 26 +-- .../mock_post_workflow_hook_url_generator.go | 14 +- ...ock_post_workflows_hooks_command_runner.go | 14 +- .../mock_pre_workflow_hook_url_generator.go | 14 +- ...mock_pre_workflows_hooks_command_runner.go | 14 +- .../mocks/mock_project_command_builder.go | 86 +++---- .../mocks/mock_project_command_runner.go | 86 +++---- server/events/mocks/mock_project_lock.go | 14 +- server/events/mocks/mock_pull_cleaner.go | 14 +- server/events/mocks/mock_resource_cleaner.go | 14 +- server/events/mocks/mock_step_runner.go | 14 +- server/events/mocks/mock_webhooks_sender.go | 14 +- server/events/mocks/mock_working_dir.go | 74 +++--- .../events/mocks/mock_working_dir_locker.go | 26 +-- server/events/pending_plan_finder.go | 2 +- server/events/plan_command_runner_test.go | 31 ++- .../post_workflow_hooks_command_runner.go | 4 +- ...post_workflow_hooks_command_runner_test.go | 14 +- .../pre_workflow_hooks_command_runner.go | 4 +- .../pre_workflow_hooks_command_runner_test.go | 19 +- server/events/project_command_builder.go | 2 +- .../project_command_builder_internal_test.go | 20 +- server/events/project_command_builder_test.go | 103 ++++----- .../project_command_context_builder_test.go | 2 +- server/events/project_command_runner.go | 16 +- server/events/project_command_runner_test.go | 89 ++++--- server/events/project_locker.go | 2 +- server/events/project_locker_test.go | 2 +- server/events/pull_closed_executor.go | 4 +- server/events/pull_closed_executor_test.go | 9 +- server/events/vcs/client.go | 2 +- server/events/vcs/github_credentials.go | 2 +- server/events/vcs/instrumented_client.go | 2 +- .../mocks/matchers/models_approvalstatus.go | 33 --- .../vcs/mocks/matchers/models_commitstatus.go | 33 --- .../mocks/matchers/models_pullreqstatus.go | 33 --- .../vcs/mocks/matchers/models_pullrequest.go | 33 --- .../matchers/models_pullrequestoptions.go | 33 --- .../events/vcs/mocks/matchers/models_repo.go | 33 --- .../events/vcs/mocks/matchers/models_user.go | 33 --- .../vcs/mocks/matchers/models_vcshosttype.go | 33 --- .../matchers/ptr_to_github_pullrequest.go | 33 --- .../vcs/mocks/matchers/ptr_to_http_client.go | 33 --- .../vcs/mocks/matchers/slice_of_byte.go | 31 --- .../vcs/mocks/matchers/slice_of_string.go | 31 --- server/events/vcs/mocks/mock_client.go | 170 +++++++------- .../vcs/mocks/mock_github_credentials.go | 2 +- .../mocks/mock_github_pull_request_getter.go | 14 +- .../vcs/mocks/mock_pull_req_status_fetcher.go | 14 +- server/events/vcs/pull_status_fetcher.go | 2 +- .../mocks/matchers/logging_simplelogging.go | 33 --- .../matchers/ptr_to_slack_authtestresponse.go | 33 --- ...ptr_to_slack_getconversationsparameters.go | 33 --- .../mocks/matchers/slack_msgoption.go | 33 --- .../mocks/matchers/slice_of_slack_channel.go | 33 --- .../mocks/matchers/webhooks_applyresult.go | 33 --- server/events/webhooks/mocks/mock_sender.go | 14 +- .../webhooks/mocks/mock_slack_client.go | 14 +- .../mocks/mock_underlying_slack_client.go | 30 +-- server/events/webhooks/slack_client.go | 4 +- server/events/webhooks/slack_client_test.go | 2 +- server/events/webhooks/slack_test.go | 2 +- server/events/webhooks/webhooks.go | 2 +- server/events/webhooks/webhooks_test.go | 2 +- server/events/working_dir.go | 4 +- server/jobs/job_url_setter.go | 4 +- server/jobs/job_url_setter_test.go | 7 +- server/jobs/mocks/matchers/chan_of_string.go | 31 --- server/jobs/mocks/matchers/command_name.go | 33 --- .../mocks/matchers/command_projectcontext.go | 33 --- server/jobs/mocks/matchers/jobs_pullinfo.go | 33 --- .../mocks/matchers/models_commitstatus.go | 33 --- .../models_workflowhookcommandcontext.go | 33 --- .../matchers/ptr_to_command_projectresult.go | 33 --- .../mock_project_command_output_handler.go | 74 +++--- .../mocks/mock_project_job_url_generator.go | 14 +- .../jobs/mocks/mock_project_status_updater.go | 22 +- server/jobs/project_command_output_handler.go | 2 +- .../mocks/matchers/logging_loglevel.go | 33 --- .../mocks/matchers/logging_simplelogging.go | 33 --- server/logging/mocks/mock_simple_logging.go | 118 +++++----- server/logging/simple_logger.go | 2 +- server/scheduled/executor_service.go | 2 +- server/scheduled/executor_service_test.go | 2 +- .../mocks/mock_executor_service_job.go | 2 +- server/server_test.go | 2 +- 269 files changed, 1522 insertions(+), 5156 deletions(-) delete mode 100644 server/controllers/events/mocks/matchers/ptr_to_http_request.go delete mode 100644 server/controllers/events/mocks/matchers/slice_of_byte.go delete mode 100644 server/controllers/templates/mocks/matchers/io_writer.go delete mode 100644 server/core/locking/mocks/matchers/command_name.go delete mode 100644 server/core/locking/mocks/matchers/locking_applycommandlock.go delete mode 100644 server/core/locking/mocks/matchers/locking_trylockresponse.go delete mode 100644 server/core/locking/mocks/matchers/map_of_string_to_models_projectlock.go delete mode 100644 server/core/locking/mocks/matchers/models_project.go delete mode 100644 server/core/locking/mocks/matchers/models_projectlock.go delete mode 100644 server/core/locking/mocks/matchers/models_projectplanstatus.go delete mode 100644 server/core/locking/mocks/matchers/models_pullrequest.go delete mode 100644 server/core/locking/mocks/matchers/models_pullstatus.go delete mode 100644 server/core/locking/mocks/matchers/models_user.go delete mode 100644 server/core/locking/mocks/matchers/ptr_to_command_lock.go delete mode 100644 server/core/locking/mocks/matchers/ptr_to_models_projectlock.go delete mode 100644 server/core/locking/mocks/matchers/ptr_to_models_pullstatus.go delete mode 100644 server/core/locking/mocks/matchers/slice_of_command_projectresult.go delete mode 100644 server/core/locking/mocks/matchers/slice_of_models_projectlock.go delete mode 100644 server/core/locking/mocks/matchers/time_time.go delete mode 100644 server/core/runtime/cache/mocks/matchers/ptr_to_go_version_version.go delete mode 100644 server/core/runtime/mocks/matchers/command_name.go delete mode 100644 server/core/runtime/mocks/matchers/command_projectcontext.go delete mode 100644 server/core/runtime/mocks/matchers/logging_simplelogging.go delete mode 100644 server/core/runtime/mocks/matchers/map_of_string_to_string.go delete mode 100644 server/core/runtime/mocks/matchers/models_approvalstatus.go delete mode 100644 server/core/runtime/mocks/matchers/models_commitstatus.go delete mode 100644 server/core/runtime/mocks/matchers/models_pullrequest.go delete mode 100644 server/core/runtime/mocks/matchers/models_repo.go delete mode 100644 server/core/runtime/mocks/matchers/models_workflowhookcommandcontext.go delete mode 100644 server/core/runtime/mocks/matchers/ptr_to_command_projectresult.go delete mode 100644 server/core/runtime/mocks/matchers/ptr_to_go_version_version.go delete mode 100644 server/core/runtime/mocks/matchers/recv_chan_of_models_line.go delete mode 100644 server/core/runtime/mocks/matchers/send_chan_of_string.go delete mode 100644 server/core/runtime/mocks/matchers/slice_of_string.go delete mode 100644 server/core/runtime/models/mocks/matchers/map_of_string_to_string.go delete mode 100644 server/core/runtime/models/mocks/matchers/models_filepath.go delete mode 100644 server/core/runtime/models/mocks/matchers/slice_of_string.go delete mode 100644 server/core/runtime/policy/mocks/matchers/valid_policyset.go delete mode 100644 server/core/terraform/mocks/matchers/command_projectcontext.go delete mode 100644 server/core/terraform/mocks/matchers/logging_simplelogging.go delete mode 100644 server/core/terraform/mocks/matchers/map_of_string_to_string.go delete mode 100644 server/core/terraform/mocks/matchers/ptr_to_go_version_version.go delete mode 100644 server/core/terraform/mocks/matchers/slice_of_string.go delete mode 100644 server/events/matchers/logging_simplelogging.go delete mode 100644 server/events/matchers/models_pullrequest.go delete mode 100644 server/events/matchers/models_repo.go delete mode 100644 server/events/matchers/ptr_to_logging_simplelogger.go delete mode 100644 server/events/mocks/matchers/azuredevops_event.go delete mode 100644 server/events/mocks/matchers/command_name.go delete mode 100644 server/events/mocks/matchers/command_projectcontext.go delete mode 100644 server/events/mocks/matchers/command_projectresult.go delete mode 100644 server/events/mocks/matchers/events_commentparseresult.go delete mode 100644 server/events/mocks/matchers/go_gitlab_mergecommentevent.go delete mode 100644 server/events/mocks/matchers/go_gitlab_mergeevent.go delete mode 100644 server/events/mocks/matchers/jobs_pullinfo.go delete mode 100644 server/events/mocks/matchers/logging_simplelogging.go delete mode 100644 server/events/mocks/matchers/map_of_string_to_string.go delete mode 100644 server/events/mocks/matchers/models_commitstatus.go delete mode 100644 server/events/mocks/matchers/models_project.go delete mode 100644 server/events/mocks/matchers/models_pullrequest.go delete mode 100644 server/events/mocks/matchers/models_pullrequesteventtype.go delete mode 100644 server/events/mocks/matchers/models_repo.go delete mode 100644 server/events/mocks/matchers/models_user.go delete mode 100644 server/events/mocks/matchers/models_vcshosttype.go delete mode 100644 server/events/mocks/matchers/ptr_to_azuredevops_gitpullrequest.go delete mode 100644 server/events/mocks/matchers/ptr_to_azuredevops_gitrepository.go delete mode 100644 server/events/mocks/matchers/ptr_to_command_context.go delete mode 100644 server/events/mocks/matchers/ptr_to_command_projectresult.go delete mode 100644 server/events/mocks/matchers/ptr_to_events_commentcommand.go delete mode 100644 server/events/mocks/matchers/ptr_to_events_trylockresponse.go delete mode 100644 server/events/mocks/matchers/ptr_to_github_issuecommentevent.go delete mode 100644 server/events/mocks/matchers/ptr_to_github_pullrequest.go delete mode 100644 server/events/mocks/matchers/ptr_to_github_pullrequestevent.go delete mode 100644 server/events/mocks/matchers/ptr_to_github_repository.go delete mode 100644 server/events/mocks/matchers/ptr_to_go_gitlab_mergerequest.go delete mode 100644 server/events/mocks/matchers/ptr_to_models_projectlock.go delete mode 100644 server/events/mocks/matchers/ptr_to_models_pullrequest.go delete mode 100644 server/events/mocks/matchers/ptr_to_models_repo.go delete mode 100644 server/events/mocks/matchers/slice_of_byte.go delete mode 100644 server/events/mocks/matchers/slice_of_command_projectcontext.go delete mode 100644 server/events/mocks/matchers/slice_of_events_pendingplan.go delete mode 100644 server/events/mocks/matchers/slice_of_string.go delete mode 100644 server/events/mocks/matchers/webhooks_applyresult.go delete mode 100644 server/events/vcs/mocks/matchers/models_approvalstatus.go delete mode 100644 server/events/vcs/mocks/matchers/models_commitstatus.go delete mode 100644 server/events/vcs/mocks/matchers/models_pullreqstatus.go delete mode 100644 server/events/vcs/mocks/matchers/models_pullrequest.go delete mode 100644 server/events/vcs/mocks/matchers/models_pullrequestoptions.go delete mode 100644 server/events/vcs/mocks/matchers/models_repo.go delete mode 100644 server/events/vcs/mocks/matchers/models_user.go delete mode 100644 server/events/vcs/mocks/matchers/models_vcshosttype.go delete mode 100644 server/events/vcs/mocks/matchers/ptr_to_github_pullrequest.go delete mode 100644 server/events/vcs/mocks/matchers/ptr_to_http_client.go delete mode 100644 server/events/vcs/mocks/matchers/slice_of_byte.go delete mode 100644 server/events/vcs/mocks/matchers/slice_of_string.go delete mode 100644 server/events/webhooks/mocks/matchers/logging_simplelogging.go delete mode 100644 server/events/webhooks/mocks/matchers/ptr_to_slack_authtestresponse.go delete mode 100644 server/events/webhooks/mocks/matchers/ptr_to_slack_getconversationsparameters.go delete mode 100644 server/events/webhooks/mocks/matchers/slack_msgoption.go delete mode 100644 server/events/webhooks/mocks/matchers/slice_of_slack_channel.go delete mode 100644 server/events/webhooks/mocks/matchers/webhooks_applyresult.go delete mode 100644 server/jobs/mocks/matchers/chan_of_string.go delete mode 100644 server/jobs/mocks/matchers/command_name.go delete mode 100644 server/jobs/mocks/matchers/command_projectcontext.go delete mode 100644 server/jobs/mocks/matchers/jobs_pullinfo.go delete mode 100644 server/jobs/mocks/matchers/models_commitstatus.go delete mode 100644 server/jobs/mocks/matchers/models_workflowhookcommandcontext.go delete mode 100644 server/jobs/mocks/matchers/ptr_to_command_projectresult.go delete mode 100644 server/logging/mocks/matchers/logging_loglevel.go delete mode 100644 server/logging/mocks/matchers/logging_simplelogging.go diff --git a/go.mod b/go.mod index 57c19b0a5..3613ea5c4 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/moby/patternmatcher v0.5.0 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 - github.com/petergtz/pegomock/v3 v3.1.0 + github.com/petergtz/pegomock/v4 v4.0.0 github.com/pkg/errors v0.9.1 github.com/redis/go-redis/v9 v9.0.5 github.com/remeh/sizedwaitgroup v1.0.0 diff --git a/go.sum b/go.sum index e6c9d9c31..b4c78a8ca 100644 --- a/go.sum +++ b/go.sum @@ -342,8 +342,8 @@ github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= -github.com/petergtz/pegomock/v3 v3.1.0 h1:Pkn9DXS0DXb7CsUhvDutX7JNj0NIyjvZ5qWqnDTMAAE= -github.com/petergtz/pegomock/v3 v3.1.0/go.mod h1:1+YY4LlCpraeTFFYDY6JI6g6zoWKFGny0LpgPXk6YZw= +github.com/petergtz/pegomock/v4 v4.0.0 h1:BIGMUof4NXc+xBbuFk0VBfK5Ls7DplcP+LWz4hfYWsY= +github.com/petergtz/pegomock/v4 v4.0.0/go.mod h1:Xscaw/kXYcuh9sGsns+If19FnSMMQy4Wz60YJTn3XOU= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/server/controllers/api_controller_test.go b/server/controllers/api_controller_test.go index 0c4017c36..1f2370ef0 100644 --- a/server/controllers/api_controller_test.go +++ b/server/controllers/api_controller_test.go @@ -7,13 +7,12 @@ import ( "net/http/httptest" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/controllers" . "github.com/runatlantis/atlantis/server/core/locking/mocks" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" . "github.com/runatlantis/atlantis/server/events/mocks" - . "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" . "github.com/runatlantis/atlantis/server/events/vcs/mocks" "github.com/runatlantis/atlantis/server/logging" @@ -37,8 +36,8 @@ func TestAPIController_Plan(t *testing.T) { w := httptest.NewRecorder() ac.Plan(w, req) ResponseContains(t, w, http.StatusOK, "") - projectCommandBuilder.VerifyWasCalledOnce().BuildPlanCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand()) - projectCommandRunner.VerifyWasCalledOnce().Plan(AnyCommandProjectContext()) + projectCommandBuilder.VerifyWasCalledOnce().BuildPlanCommands(Any[*command.Context](), Any[*events.CommentCommand]()) + projectCommandRunner.VerifyWasCalledOnce().Plan(Any[command.ProjectContext]()) } func TestAPIController_Apply(t *testing.T) { @@ -54,9 +53,9 @@ func TestAPIController_Apply(t *testing.T) { w := httptest.NewRecorder() ac.Apply(w, req) ResponseContains(t, w, http.StatusOK, "") - projectCommandBuilder.VerifyWasCalledOnce().BuildApplyCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand()) - projectCommandRunner.VerifyWasCalledOnce().Plan(AnyCommandProjectContext()) - projectCommandRunner.VerifyWasCalledOnce().Apply(AnyCommandProjectContext()) + projectCommandBuilder.VerifyWasCalledOnce().BuildApplyCommands(Any[*command.Context](), Any[*events.CommentCommand]()) + projectCommandRunner.VerifyWasCalledOnce().Plan(Any[command.ProjectContext]()) + projectCommandRunner.VerifyWasCalledOnce().Apply(Any[command.ProjectContext]()) } func setup(t *testing.T) (controllers.APIController, *MockProjectCommandBuilder, *MockProjectCommandRunner) { @@ -70,20 +69,20 @@ func setup(t *testing.T) (controllers.APIController, *MockProjectCommandBuilder, Ok(t, err) projectCommandBuilder := NewMockProjectCommandBuilder() - When(projectCommandBuilder.BuildPlanCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())). + When(projectCommandBuilder.BuildPlanCommands(Any[*command.Context](), Any[*events.CommentCommand]())). ThenReturn([]command.ProjectContext{{ CommandName: command.Plan, }}, nil) - When(projectCommandBuilder.BuildApplyCommands(AnyPtrToCommandContext(), AnyPtrToEventsCommentCommand())). + When(projectCommandBuilder.BuildApplyCommands(Any[*command.Context](), Any[*events.CommentCommand]())). ThenReturn([]command.ProjectContext{{ CommandName: command.Apply, }}, nil) projectCommandRunner := NewMockProjectCommandRunner() - When(projectCommandRunner.Plan(AnyCommandProjectContext())).ThenReturn(command.ProjectResult{ + When(projectCommandRunner.Plan(Any[command.ProjectContext]())).ThenReturn(command.ProjectResult{ PlanSuccess: &models.PlanSuccess{}, }) - When(projectCommandRunner.Apply(AnyCommandProjectContext())).ThenReturn(command.ProjectResult{ + When(projectCommandRunner.Apply(Any[command.ProjectContext]())).ThenReturn(command.ProjectResult{ ApplySuccess: "success", }) diff --git a/server/controllers/events/azuredevops_request_validator.go b/server/controllers/events/azuredevops_request_validator.go index 43cf99a7e..17e48fe7c 100644 --- a/server/controllers/events/azuredevops_request_validator.go +++ b/server/controllers/events/azuredevops_request_validator.go @@ -8,7 +8,7 @@ import ( "github.com/mcdafydd/go-azuredevops/azuredevops" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_azuredevops_request_validator.go AzureDevopsRequestValidator +//go:generate pegomock generate --package mocks -o mocks/mock_azuredevops_request_validator.go AzureDevopsRequestValidator // AzureDevopsRequestValidator handles checking if Azure DevOps requests // contain a valid Basic authentication username and password. diff --git a/server/controllers/events/azuredevops_request_validator_test.go b/server/controllers/events/azuredevops_request_validator_test.go index 2222519bd..8fff056d5 100644 --- a/server/controllers/events/azuredevops_request_validator_test.go +++ b/server/controllers/events/azuredevops_request_validator_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/controllers/events" . "github.com/runatlantis/atlantis/testing" ) diff --git a/server/controllers/events/events_controller_e2e_test.go b/server/controllers/events/events_controller_e2e_test.go index 940234008..d46b485e0 100644 --- a/server/controllers/events/events_controller_e2e_test.go +++ b/server/controllers/events/events_controller_e2e_test.go @@ -15,7 +15,7 @@ import ( "github.com/google/go-github/v53/github" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server" events_controllers "github.com/runatlantis/atlantis/server/controllers/events" @@ -25,17 +25,14 @@ import ( "github.com/runatlantis/atlantis/server/core/locking" "github.com/runatlantis/atlantis/server/core/runtime" runtimemocks "github.com/runatlantis/atlantis/server/core/runtime/mocks" - runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers" "github.com/runatlantis/atlantis/server/core/runtime/policy" "github.com/runatlantis/atlantis/server/core/terraform" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/mocks" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/events/vcs" vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks" - vcsmatchers "github.com/runatlantis/atlantis/server/events/vcs/mocks/matchers" "github.com/runatlantis/atlantis/server/events/webhooks" jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks" "github.com/runatlantis/atlantis/server/logging" @@ -579,8 +576,8 @@ func TestGitHubWorkflow(t *testing.T) { // Setup test dependencies. w := httptest.NewRecorder() - When(githubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(headSHA), nil) - When(vcsClient.GetModifiedFiles(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil) + When(githubGetter.GetPullRequest(Any[models.Repo](), Any[int]())).ThenReturn(GitHubPullRequestParsed(headSHA), nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil) // First, send the open pull request event which triggers autoplan. pullOpenedReq := GitHubPullRequestOpenedEvent(t, headSHA) @@ -613,9 +610,9 @@ func TestGitHubWorkflow(t *testing.T) { expNumHooks := len(c.Comments) + 1 - c.ExpParseFailedCount // Let's verify the pre-workflow hook was called for each comment including the pull request opened event - mockPreWorkflowHookRunner.VerifyWasCalled(Times(expNumHooks)).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString("some dummy command"), AnyString()) + mockPreWorkflowHookRunner.VerifyWasCalled(Times(expNumHooks)).Run(Any[models.WorkflowHookCommandContext](), Eq("some dummy command"), Any[string]()) // Let's verify the post-workflow hook was called for each comment including the pull request opened event - mockPostWorkflowHookRunner.VerifyWasCalled(Times(expNumHooks)).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString("some post dummy command"), AnyString()) + mockPostWorkflowHookRunner.VerifyWasCalled(Times(expNumHooks)).Run(Any[models.WorkflowHookCommandContext](), Eq("some post dummy command"), Any[string]()) // Now we're ready to verify Atlantis made all the comments back (or // replies) that we expect. We expect each plan to have 1 comment, @@ -631,7 +628,7 @@ func TestGitHubWorkflow(t *testing.T) { expNumReplies++ } - _, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()).GetAllCapturedArguments() + _, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetAllCapturedArguments() Assert(t, len(c.ExpReplies) == len(actReplies), "missing expected replies, got %d but expected %d", len(actReplies), len(c.ExpReplies)) for i, expReply := range c.ExpReplies { assertCommentEquals(t, expReply, actReplies[i], c.RepoDir, c.ExpParallel) @@ -639,9 +636,9 @@ func TestGitHubWorkflow(t *testing.T) { if c.ExpAutomerge { // Verify that the merge API call was made. - vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions()) + vcsClient.VerifyWasCalledOnce().MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]()) } else { - vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions()) + vcsClient.VerifyWasCalled(Never()).MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]()) } }) } @@ -744,8 +741,8 @@ func TestSimpleWorkflow_terraformLockFile(t *testing.T) { // Setup test dependencies. w := httptest.NewRecorder() - When(githubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(headSHA), nil) - When(vcsClient.GetModifiedFiles(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil) + When(githubGetter.GetPullRequest(Any[models.Repo](), Any[int]())).ThenReturn(GitHubPullRequestParsed(headSHA), nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil) // First, send the open pull request event which triggers autoplan. pullOpenedReq := GitHubPullRequestOpenedEvent(t, headSHA) @@ -797,14 +794,14 @@ func TestSimpleWorkflow_terraformLockFile(t *testing.T) { } // Let's verify the pre-workflow hook was called for each comment including the pull request opened event - mockPreWorkflowHookRunner.VerifyWasCalled(Times(2)).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString("some dummy command"), AnyString()) + mockPreWorkflowHookRunner.VerifyWasCalled(Times(2)).Run(Any[models.WorkflowHookCommandContext](), Eq("some dummy command"), Any[string]()) // Now we're ready to verify Atlantis made all the comments back (or // replies) that we expect. We expect each plan to have 1 comment, // and apply have 1 for each comment plus one for the locks deleted at the // end. - _, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(2)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()).GetAllCapturedArguments() + _, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(2)).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetAllCapturedArguments() Assert(t, len(c.ExpReplies) == len(actReplies), "missing expected replies, got %d but expected %d", len(actReplies), len(c.ExpReplies)) for i, expReply := range c.ExpReplies { assertCommentEquals(t, expReply, actReplies[i], c.RepoDir, false) @@ -1010,12 +1007,12 @@ func TestGitHubWorkflowWithPolicyCheck(t *testing.T) { // Setup test dependencies. w := httptest.NewRecorder() - When(vcsClient.PullIsMergeable(AnyRepo(), matchers.AnyModelsPullRequest(), EqString("atlantis-test"))).ThenReturn(true, nil) - When(vcsClient.PullIsApproved(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(models.ApprovalStatus{ + When(vcsClient.PullIsMergeable(Any[models.Repo](), Any[models.PullRequest](), Eq("atlantis-test"))).ThenReturn(true, nil) + When(vcsClient.PullIsApproved(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(models.ApprovalStatus{ IsApproved: true, }, nil) - When(githubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(headSHA), nil) - When(vcsClient.GetModifiedFiles(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil) + When(githubGetter.GetPullRequest(Any[models.Repo](), Any[int]())).ThenReturn(GitHubPullRequestParsed(headSHA), nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil) // First, send the open pull request event which triggers autoplan. pullOpenedReq := GitHubPullRequestOpenedEvent(t, headSHA) @@ -1063,7 +1060,7 @@ func TestGitHubWorkflowWithPolicyCheck(t *testing.T) { expNumReplies-- } - _, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()).GetAllCapturedArguments() + _, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetAllCapturedArguments() Assert(t, len(c.ExpReplies) == len(actReplies), "missing expected replies, got %d but expected %d", len(actReplies), len(c.ExpReplies)) for i, expReply := range c.ExpReplies { assertCommentEquals(t, expReply, actReplies[i], c.RepoDir, c.ExpParallel) @@ -1071,9 +1068,9 @@ func TestGitHubWorkflowWithPolicyCheck(t *testing.T) { if c.ExpAutomerge { // Verify that the merge API call was made. - vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions()) + vcsClient.VerifyWasCalledOnce().MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]()) } else { - vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions()) + vcsClient.VerifyWasCalled(Never()).MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]()) } }) } diff --git a/server/controllers/events/events_controller_test.go b/server/controllers/events/events_controller_test.go index a9368a440..1aab8f246 100644 --- a/server/controllers/events/events_controller_test.go +++ b/server/controllers/events/events_controller_test.go @@ -22,16 +22,16 @@ import ( "net/http/httptest" "os" "path/filepath" - "reflect" "strings" "testing" - . "github.com/petergtz/pegomock/v3" + "github.com/google/go-github/v53/github" + "github.com/mcdafydd/go-azuredevops/azuredevops" + . "github.com/petergtz/pegomock/v4" events_controllers "github.com/runatlantis/atlantis/server/controllers/events" "github.com/runatlantis/atlantis/server/controllers/events/mocks" "github.com/runatlantis/atlantis/server/events" emocks "github.com/runatlantis/atlantis/server/events/mocks" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks" "github.com/runatlantis/atlantis/server/logging" @@ -47,11 +47,6 @@ const azuredevopsHeader = "Request-Id" var user = []byte("user") var secret = []byte("secret") -func AnyRepo() models.Repo { - RegisterMatcher(NewAnyMatcher(reflect.TypeOf(models.Repo{}))) - return models.Repo{} -} - func TestPost_NotGithubOrGitlab(t *testing.T) { t.Log("when the request is not for gitlab or github a 400 is returned") e, _, _, _, _, _, _, _, _ := setup(t) @@ -159,7 +154,7 @@ func TestPost_GithubInvalidComment(t *testing.T) { req.Header.Set(githubHeader, "issue_comment") event := `{"action": "created"}` When(v.Validate(req, secret)).ThenReturn([]byte(event), nil) - When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(models.Repo{}, models.User{}, 1, errors.New("err")) + When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(models.Repo{}, models.User{}, 1, errors.New("err")) w := httptest.NewRecorder() e.Post(w, req) ResponseContains(t, w, http.StatusBadRequest, "Failed parsing event") @@ -184,7 +179,7 @@ func TestPost_GithubCommentInvalidCommand(t *testing.T) { req.Header.Set(githubHeader, "issue_comment") event := `{"action": "created"}` When(v.Validate(req, secret)).ThenReturn([]byte(event), nil) - When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(models.Repo{}, models.User{}, 1, nil) + When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(models.Repo{}, models.User{}, 1, nil) When(cp.Parse("", models.Github)).ThenReturn(events.CommentParseResult{Ignore: true}) w := httptest.NewRecorder() e.Post(w, req) @@ -251,7 +246,7 @@ func TestPost_GitlabCommentNotAllowlistedWithSilenceErrors(t *testing.T) { body, _ := io.ReadAll(w.Result().Body) exp := "Repo not allowlisted" Assert(t, strings.Contains(string(body), exp), "exp %q to be contained in %q", exp, string(body)) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } @@ -316,7 +311,7 @@ func TestPost_GithubCommentNotAllowlistedWithSilenceErrors(t *testing.T) { body, _ := io.ReadAll(w.Result().Body) exp := "Repo not allowlisted" Assert(t, strings.Contains(string(body), exp), "exp %q to be contained in %q", exp, string(body)) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } func TestPost_GitlabCommentResponse(t *testing.T) { @@ -341,7 +336,7 @@ func TestPost_GithubCommentResponse(t *testing.T) { When(v.Validate(req, secret)).ThenReturn([]byte(event), nil) baseRepo := models.Repo{} user := models.User{} - When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(baseRepo, user, 1, nil) + When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(baseRepo, user, 1, nil) When(cp.Parse("", models.Github)).ThenReturn(events.CommentParseResult{CommentResponse: "a comment"}) w := httptest.NewRecorder() @@ -373,7 +368,7 @@ func TestPost_GithubCommentSuccess(t *testing.T) { baseRepo := models.Repo{} user := models.User{} cmd := events.CommentCommand{} - When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(baseRepo, user, 1, nil) + When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(baseRepo, user, 1, nil) When(cp.Parse("", models.Github)).ThenReturn(events.CommentParseResult{Command: &cmd}) w := httptest.NewRecorder() e.Post(w, req) @@ -392,7 +387,7 @@ func TestPost_GithubCommentReaction(t *testing.T) { baseRepo := models.Repo{} user := models.User{} cmd := events.CommentCommand{} - When(p.ParseGithubIssueCommentEvent(matchers.AnyPtrToGithubIssueCommentEvent())).ThenReturn(baseRepo, user, 1, nil) + When(p.ParseGithubIssueCommentEvent(Any[*github.IssueCommentEvent]())).ThenReturn(baseRepo, user, 1, nil) When(cp.Parse("", models.Github)).ThenReturn(events.CommentParseResult{Command: &cmd}) w := httptest.NewRecorder() e.Post(w, req) @@ -421,7 +416,7 @@ func TestPost_GithubPullRequestInvalid(t *testing.T) { event := `{"action": "closed"}` When(v.Validate(req, secret)).ThenReturn([]byte(event), nil) - When(p.ParseGithubPullEvent(matchers.AnyPtrToGithubPullRequestEvent())).ThenReturn(models.PullRequest{}, models.OpenedPullEvent, models.Repo{}, models.Repo{}, models.User{}, errors.New("err")) + When(p.ParseGithubPullEvent(Any[*github.PullRequestEvent]())).ThenReturn(models.PullRequest{}, models.OpenedPullEvent, models.Repo{}, models.Repo{}, models.User{}, errors.New("err")) w := httptest.NewRecorder() e.Post(w, req) ResponseContains(t, w, http.StatusBadRequest, "Error parsing pull data: err") @@ -693,7 +688,7 @@ func TestPost_AzureDevopsPullRequestCommentPassingIgnores(t *testing.T) { e, _, _, ado, _, _, _, _, _ := setup(t) repo := models.Repo{} - When(e.Parser.ParseAzureDevopsRepo(matchers.AnyPtrToAzuredevopsGitRepository())).ThenReturn(repo, nil) + When(e.Parser.ParseAzureDevopsRepo(Any[*azuredevops.GitRepository]())).ThenReturn(repo, nil) payload := `{ "subscriptionId": "11111111-1111-1111-1111-111111111111", @@ -739,7 +734,7 @@ func TestPost_GithubPullRequestClosedErrCleaningPull(t *testing.T) { When(v.Validate(req, secret)).ThenReturn([]byte(event), nil) repo := models.Repo{} pull := models.PullRequest{State: models.ClosedPullState} - When(p.ParseGithubPullEvent(matchers.AnyPtrToGithubPullRequestEvent())).ThenReturn(pull, models.OpenedPullEvent, repo, repo, models.User{}, nil) + When(p.ParseGithubPullEvent(Any[*github.PullRequestEvent]())).ThenReturn(pull, models.OpenedPullEvent, repo, repo, models.User{}, nil) When(c.CleanUpPull(repo, pull)).ThenReturn(errors.New("cleanup err")) w := httptest.NewRecorder() e.Post(w, req) @@ -775,7 +770,7 @@ func TestPost_GithubClosedPullRequestSuccess(t *testing.T) { When(v.Validate(req, secret)).ThenReturn([]byte(event), nil) repo := models.Repo{} pull := models.PullRequest{State: models.ClosedPullState} - When(p.ParseGithubPullEvent(matchers.AnyPtrToGithubPullRequestEvent())).ThenReturn(pull, models.OpenedPullEvent, repo, repo, models.User{}, nil) + When(p.ParseGithubPullEvent(Any[*github.PullRequestEvent]())).ThenReturn(pull, models.OpenedPullEvent, repo, repo, models.User{}, nil) When(c.CleanUpPull(repo, pull)).ThenReturn(nil) w := httptest.NewRecorder() e.Post(w, req) @@ -928,7 +923,7 @@ func TestPost_PullOpenedOrUpdated(t *testing.T) { When(v.Validate(req, secret)).ThenReturn([]byte(event), nil) repo = models.Repo{} pullRequest = models.PullRequest{State: models.ClosedPullState} - When(p.ParseGithubPullEvent(matchers.AnyPtrToGithubPullRequestEvent())).ThenReturn(pullRequest, models.OpenedPullEvent, repo, repo, models.User{}, nil) + When(p.ParseGithubPullEvent(Any[*github.PullRequestEvent]())).ThenReturn(pullRequest, models.OpenedPullEvent, repo, repo, models.User{}, nil) } w := httptest.NewRecorder() diff --git a/server/controllers/events/github_request_validator.go b/server/controllers/events/github_request_validator.go index 4bada5ecf..1d7c71e28 100644 --- a/server/controllers/events/github_request_validator.go +++ b/server/controllers/events/github_request_validator.go @@ -22,7 +22,7 @@ import ( "github.com/google/go-github/v53/github" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_github_request_validator.go GithubRequestValidator +//go:generate pegomock generate --package mocks -o mocks/mock_github_request_validator.go GithubRequestValidator // GithubRequestValidator handles checking if GitHub requests are signed // properly by the secret. diff --git a/server/controllers/events/github_request_validator_test.go b/server/controllers/events/github_request_validator_test.go index aa4f8eb77..8b640b29b 100644 --- a/server/controllers/events/github_request_validator_test.go +++ b/server/controllers/events/github_request_validator_test.go @@ -19,7 +19,7 @@ import ( "net/url" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/controllers/events" . "github.com/runatlantis/atlantis/testing" ) diff --git a/server/controllers/events/gitlab_request_parser_validator.go b/server/controllers/events/gitlab_request_parser_validator.go index 0d9e77ede..5d58dba83 100644 --- a/server/controllers/events/gitlab_request_parser_validator.go +++ b/server/controllers/events/gitlab_request_parser_validator.go @@ -25,7 +25,7 @@ import ( const secretHeader = "X-Gitlab-Token" // #nosec -//go:generate pegomock generate -m --package mocks -o mocks/mock_gitlab_request_parser_validator.go GitlabRequestParserValidator +//go:generate pegomock generate --package mocks -o mocks/mock_gitlab_request_parser_validator.go GitlabRequestParserValidator // GitlabRequestParserValidator parses and validates GitLab requests. type GitlabRequestParserValidator interface { diff --git a/server/controllers/events/gitlab_request_parser_validator_test.go b/server/controllers/events/gitlab_request_parser_validator_test.go index 1ff85cca5..184b9f00b 100644 --- a/server/controllers/events/gitlab_request_parser_validator_test.go +++ b/server/controllers/events/gitlab_request_parser_validator_test.go @@ -19,7 +19,7 @@ import ( "reflect" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/controllers/events" . "github.com/runatlantis/atlantis/testing" gitlab "github.com/xanzy/go-gitlab" diff --git a/server/controllers/events/mocks/matchers/ptr_to_http_request.go b/server/controllers/events/mocks/matchers/ptr_to_http_request.go deleted file mode 100644 index 5a8a81a91..000000000 --- a/server/controllers/events/mocks/matchers/ptr_to_http_request.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - http "net/http" -) - -func AnyPtrToHttpRequest() *http.Request { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*http.Request))(nil)).Elem())) - var nullValue *http.Request - return nullValue -} - -func EqPtrToHttpRequest(value *http.Request) *http.Request { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *http.Request - return nullValue -} - -func NotEqPtrToHttpRequest(value *http.Request) *http.Request { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *http.Request - return nullValue -} - -func PtrToHttpRequestThat(matcher pegomock.ArgumentMatcher) *http.Request { - pegomock.RegisterMatcher(matcher) - var nullValue *http.Request - return nullValue -} diff --git a/server/controllers/events/mocks/matchers/slice_of_byte.go b/server/controllers/events/mocks/matchers/slice_of_byte.go deleted file mode 100644 index b71a45767..000000000 --- a/server/controllers/events/mocks/matchers/slice_of_byte.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySliceOfByte() []byte { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]byte))(nil)).Elem())) - var nullValue []byte - return nullValue -} - -func EqSliceOfByte(value []byte) []byte { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []byte - return nullValue -} - -func NotEqSliceOfByte(value []byte) []byte { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []byte - return nullValue -} - -func SliceOfByteThat(matcher pegomock.ArgumentMatcher) []byte { - pegomock.RegisterMatcher(matcher) - var nullValue []byte - return nullValue -} diff --git a/server/controllers/events/mocks/mock_azuredevops_request_validator.go b/server/controllers/events/mocks/mock_azuredevops_request_validator.go index 63ff57ef2..3f1095335 100644 --- a/server/controllers/events/mocks/mock_azuredevops_request_validator.go +++ b/server/controllers/events/mocks/mock_azuredevops_request_validator.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" http "net/http" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockAzureDevopsRequestValidator(options ...pegomock.Option) *MockAzureDe func (mock *MockAzureDevopsRequestValidator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockAzureDevopsRequestValidator) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockAzureDevopsRequestValidator) Validate(_param0 *http.Request, _param1 []byte, _param2 []byte) ([]byte, error) { +func (mock *MockAzureDevopsRequestValidator) Validate(r *http.Request, user []byte, pass []byte) ([]byte, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockAzureDevopsRequestValidator().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{r, user, pass} result := pegomock.GetGenericMockFrom(mock).Invoke("Validate", params, []reflect.Type{reflect.TypeOf((*[]byte)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []byte var ret1 error @@ -81,8 +81,8 @@ type VerifierMockAzureDevopsRequestValidator struct { timeout time.Duration } -func (verifier *VerifierMockAzureDevopsRequestValidator) Validate(_param0 *http.Request, _param1 []byte, _param2 []byte) *MockAzureDevopsRequestValidator_Validate_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockAzureDevopsRequestValidator) Validate(r *http.Request, user []byte, pass []byte) *MockAzureDevopsRequestValidator_Validate_OngoingVerification { + params := []pegomock.Param{r, user, pass} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Validate", params, verifier.timeout) return &MockAzureDevopsRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockAzureDevopsRequestValidator_Validate_OngoingVerification struct { } func (c *MockAzureDevopsRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte, []byte) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + r, user, pass := c.GetAllCapturedArguments() + return r[len(r)-1], user[len(user)-1], pass[len(pass)-1] } func (c *MockAzureDevopsRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte, _param2 [][]byte) { diff --git a/server/controllers/events/mocks/mock_github_request_validator.go b/server/controllers/events/mocks/mock_github_request_validator.go index 4e64c7d04..d3f0d0d21 100644 --- a/server/controllers/events/mocks/mock_github_request_validator.go +++ b/server/controllers/events/mocks/mock_github_request_validator.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" http "net/http" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockGithubRequestValidator(options ...pegomock.Option) *MockGithubReques func (mock *MockGithubRequestValidator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockGithubRequestValidator) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockGithubRequestValidator) Validate(_param0 *http.Request, _param1 []byte) ([]byte, error) { +func (mock *MockGithubRequestValidator) Validate(r *http.Request, secret []byte) ([]byte, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockGithubRequestValidator().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{r, secret} result := pegomock.GetGenericMockFrom(mock).Invoke("Validate", params, []reflect.Type{reflect.TypeOf((*[]byte)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []byte var ret1 error @@ -81,8 +81,8 @@ type VerifierMockGithubRequestValidator struct { timeout time.Duration } -func (verifier *VerifierMockGithubRequestValidator) Validate(_param0 *http.Request, _param1 []byte) *MockGithubRequestValidator_Validate_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockGithubRequestValidator_Validate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockGithubRequestValidator_Validate_OngoingVerification struct { } func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + r, secret := c.GetAllCapturedArguments() + return r[len(r)-1], secret[len(secret)-1] } func (c *MockGithubRequestValidator_Validate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) { diff --git a/server/controllers/events/mocks/mock_gitlab_request_parser_validator.go b/server/controllers/events/mocks/mock_gitlab_request_parser_validator.go index 2cc8b300c..671fd8127 100644 --- a/server/controllers/events/mocks/mock_gitlab_request_parser_validator.go +++ b/server/controllers/events/mocks/mock_gitlab_request_parser_validator.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" http "net/http" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockGitlabRequestParserValidator(options ...pegomock.Option) *MockGitlab func (mock *MockGitlabRequestParserValidator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockGitlabRequestParserValidator) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockGitlabRequestParserValidator) ParseAndValidate(_param0 *http.Request, _param1 []byte) (interface{}, error) { +func (mock *MockGitlabRequestParserValidator) ParseAndValidate(r *http.Request, secret []byte) (interface{}, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockGitlabRequestParserValidator().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{r, secret} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseAndValidate", params, []reflect.Type{reflect.TypeOf((*interface{})(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 interface{} var ret1 error @@ -81,8 +81,8 @@ type VerifierMockGitlabRequestParserValidator struct { timeout time.Duration } -func (verifier *VerifierMockGitlabRequestParserValidator) ParseAndValidate(_param0 *http.Request, _param1 []byte) *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification struc } func (c *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetCapturedArguments() (*http.Request, []byte) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + r, secret := c.GetAllCapturedArguments() + return r[len(r)-1], secret[len(secret)-1] } func (c *MockGitlabRequestParserValidator_ParseAndValidate_OngoingVerification) GetAllCapturedArguments() (_param0 []*http.Request, _param1 [][]byte) { diff --git a/server/controllers/locks_controller_test.go b/server/controllers/locks_controller_test.go index f9ff26c7c..88e538d15 100644 --- a/server/controllers/locks_controller_test.go +++ b/server/controllers/locks_controller_test.go @@ -7,7 +7,6 @@ import ( "net/http" "net/http/httptest" "net/url" - "reflect" "testing" "time" @@ -18,7 +17,7 @@ import ( "github.com/runatlantis/atlantis/server/core/locking" "github.com/gorilla/mux" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/core/locking/mocks" @@ -30,11 +29,6 @@ import ( . "github.com/runatlantis/atlantis/testing" ) -func AnyRepo() models.Repo { - RegisterMatcher(NewAnyMatcher(reflect.TypeOf(models.Repo{}))) - return models.Repo{} -} - func TestCreateApplyLock(t *testing.T) { t.Run("Creates apply lock", func(t *testing.T) { req, _ := http.NewRequest("GET", "", bytes.NewBuffer(nil)) @@ -272,7 +266,7 @@ func TestDeleteLock_OldFormat(t *testing.T) { w := httptest.NewRecorder() lc.DeleteLock(w, req) ResponseContains(t, w, http.StatusOK, "Deleted lock id \"id\"") - cp.VerifyWasCalled(Never()).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()) + cp.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } func TestDeleteLock_UpdateProjectStatus(t *testing.T) { @@ -356,7 +350,7 @@ func TestDeleteLock_CommentFailed(t *testing.T) { tmp := t.TempDir() backend, err := db.New(tmp) Ok(t, err) - When(cp.CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString())).ThenReturn(errors.New("err")) + When(cp.CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]())).ThenReturn(errors.New("err")) lc := controllers.LocksController{ DeleteLockCommand: dlc, Logger: logging.NewNoopLogger(t), diff --git a/server/controllers/templates/mocks/matchers/io_writer.go b/server/controllers/templates/mocks/matchers/io_writer.go deleted file mode 100644 index c9d0f5cd7..000000000 --- a/server/controllers/templates/mocks/matchers/io_writer.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - io "io" -) - -func AnyIoWriter() io.Writer { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(io.Writer))(nil)).Elem())) - var nullValue io.Writer - return nullValue -} - -func EqIoWriter(value io.Writer) io.Writer { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue io.Writer - return nullValue -} - -func NotEqIoWriter(value io.Writer) io.Writer { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue io.Writer - return nullValue -} - -func IoWriterThat(matcher pegomock.ArgumentMatcher) io.Writer { - pegomock.RegisterMatcher(matcher) - var nullValue io.Writer - return nullValue -} diff --git a/server/controllers/templates/mocks/mock_template_writer.go b/server/controllers/templates/mocks/mock_template_writer.go index 2b1f821ee..e3fafa580 100644 --- a/server/controllers/templates/mocks/mock_template_writer.go +++ b/server/controllers/templates/mocks/mock_template_writer.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" io "io" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockTemplateWriter(options ...pegomock.Option) *MockTemplateWriter { func (mock *MockTemplateWriter) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockTemplateWriter) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockTemplateWriter) Execute(_param0 io.Writer, _param1 interface{}) error { +func (mock *MockTemplateWriter) Execute(wr io.Writer, data interface{}) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockTemplateWriter().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{wr, data} result := pegomock.GetGenericMockFrom(mock).Invoke("Execute", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -77,8 +77,8 @@ type VerifierMockTemplateWriter struct { timeout time.Duration } -func (verifier *VerifierMockTemplateWriter) Execute(_param0 io.Writer, _param1 interface{}) *MockTemplateWriter_Execute_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockTemplateWriter_Execute_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -89,8 +89,8 @@ type MockTemplateWriter_Execute_OngoingVerification struct { } func (c *MockTemplateWriter_Execute_OngoingVerification) GetCapturedArguments() (io.Writer, interface{}) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + wr, data := c.GetAllCapturedArguments() + return wr[len(wr)-1], data[len(data)-1] } func (c *MockTemplateWriter_Execute_OngoingVerification) GetAllCapturedArguments() (_param0 []io.Writer, _param1 []interface{}) { diff --git a/server/controllers/templates/web_templates.go b/server/controllers/templates/web_templates.go index 77571a61b..64d0bcbea 100644 --- a/server/controllers/templates/web_templates.go +++ b/server/controllers/templates/web_templates.go @@ -19,7 +19,7 @@ import ( "time" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_template_writer.go TemplateWriter +//go:generate pegomock generate --package mocks -o mocks/mock_template_writer.go TemplateWriter // TemplateWriter is an interface over html/template that's used to enable // mocking. diff --git a/server/core/config/raw/repo_cfg.go b/server/core/config/raw/repo_cfg.go index e2bad4add..b3d184c28 100644 --- a/server/core/config/raw/repo_cfg.go +++ b/server/core/config/raw/repo_cfg.go @@ -30,16 +30,16 @@ const DefaultAbortOnExcecutionOrderFail = false // RepoCfg is the raw schema for repo-level atlantis.yaml config. type RepoCfg struct { - Version *int `yaml:"version,omitempty"` - Projects []Project `yaml:"projects,omitempty"` - Workflows map[string]Workflow `yaml:"workflows,omitempty"` - PolicySets PolicySets `yaml:"policies,omitempty"` - Automerge *bool `yaml:"automerge,omitempty"` - ParallelApply *bool `yaml:"parallel_apply,omitempty"` - ParallelPlan *bool `yaml:"parallel_plan,omitempty"` - DeleteSourceBranchOnMerge *bool `yaml:"delete_source_branch_on_merge,omitempty"` - EmojiReaction *string `yaml:"emoji_reaction,omitempty"` - AllowedRegexpPrefixes []string `yaml:"allowed_regexp_prefixes,omitempty"` + Version *int `yaml:"version,omitempty"` + Projects []Project `yaml:"projects,omitempty"` + Workflows map[string]Workflow `yaml:"workflows,omitempty"` + PolicySets PolicySets `yaml:"policies,omitempty"` + Automerge *bool `yaml:"automerge,omitempty"` + ParallelApply *bool `yaml:"parallel_apply,omitempty"` + ParallelPlan *bool `yaml:"parallel_plan,omitempty"` + DeleteSourceBranchOnMerge *bool `yaml:"delete_source_branch_on_merge,omitempty"` + EmojiReaction *string `yaml:"emoji_reaction,omitempty"` + AllowedRegexpPrefixes []string `yaml:"allowed_regexp_prefixes,omitempty"` AbortOnExcecutionOrderFail *bool `yaml:"abort_on_execution_order_fail,omitempty"` } @@ -98,16 +98,16 @@ func (r RepoCfg) ToValid() valid.RepoCfg { } return valid.RepoCfg{ - Version: *r.Version, - Projects: validProjects, - Workflows: validWorkflows, - Automerge: automerge, - ParallelApply: parallelApply, - ParallelPlan: parallelPlan, - ParallelPolicyCheck: parallelPlan, - DeleteSourceBranchOnMerge: r.DeleteSourceBranchOnMerge, - AllowedRegexpPrefixes: r.AllowedRegexpPrefixes, - EmojiReaction: emojiReaction, + Version: *r.Version, + Projects: validProjects, + Workflows: validWorkflows, + Automerge: automerge, + ParallelApply: parallelApply, + ParallelPlan: parallelPlan, + ParallelPolicyCheck: parallelPlan, + DeleteSourceBranchOnMerge: r.DeleteSourceBranchOnMerge, + AllowedRegexpPrefixes: r.AllowedRegexpPrefixes, + EmojiReaction: emojiReaction, AbortOnExcecutionOrderFail: abortOnExcecutionOrderFail, } } diff --git a/server/core/config/valid/repo_cfg.go b/server/core/config/valid/repo_cfg.go index 4c74eea60..608a92e91 100644 --- a/server/core/config/valid/repo_cfg.go +++ b/server/core/config/valid/repo_cfg.go @@ -14,18 +14,18 @@ import ( // RepoCfg is the atlantis.yaml config after it's been parsed and validated. type RepoCfg struct { // Version is the version of the atlantis YAML file. - Version int - Projects []Project - Workflows map[string]Workflow - PolicySets PolicySets - Automerge bool - ParallelApply bool - ParallelPlan bool - ParallelPolicyCheck bool - DeleteSourceBranchOnMerge *bool - RepoLocking *bool - EmojiReaction string - AllowedRegexpPrefixes []string + Version int + Projects []Project + Workflows map[string]Workflow + PolicySets PolicySets + Automerge bool + ParallelApply bool + ParallelPlan bool + ParallelPolicyCheck bool + DeleteSourceBranchOnMerge *bool + RepoLocking *bool + EmojiReaction string + AllowedRegexpPrefixes []string AbortOnExcecutionOrderFail bool } diff --git a/server/core/locking/apply_locking.go b/server/core/locking/apply_locking.go index d071ca866..8107770ce 100644 --- a/server/core/locking/apply_locking.go +++ b/server/core/locking/apply_locking.go @@ -7,7 +7,7 @@ import ( "github.com/runatlantis/atlantis/server/events/command" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_apply_lock_checker.go ApplyLockChecker +//go:generate pegomock generate --package mocks -o mocks/mock_apply_lock_checker.go ApplyLockChecker // ApplyLockChecker is an implementation of the global apply lock retrieval. // It returns an object that contains information about apply locks status. @@ -15,7 +15,7 @@ type ApplyLockChecker interface { CheckApplyLock() (ApplyCommandLock, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_apply_locker.go ApplyLocker +//go:generate pegomock generate --package mocks -o mocks/mock_apply_locker.go ApplyLocker // ApplyLocker interface that manages locks for apply command runner type ApplyLocker interface { diff --git a/server/core/locking/locking.go b/server/core/locking/locking.go index 386da46d3..78676dbaf 100644 --- a/server/core/locking/locking.go +++ b/server/core/locking/locking.go @@ -26,7 +26,7 @@ import ( "github.com/runatlantis/atlantis/server/events/models" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_backend.go Backend +//go:generate pegomock generate --package mocks -o mocks/mock_backend.go Backend // Backend is an implementation of the locking API we require. type Backend interface { @@ -60,7 +60,7 @@ type Client struct { backend Backend } -//go:generate pegomock generate -m --package mocks -o mocks/mock_locker.go Locker +//go:generate pegomock generate --package mocks -o mocks/mock_locker.go Locker type Locker interface { TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) (TryLockResponse, error) diff --git a/server/core/locking/locking_test.go b/server/core/locking/locking_test.go index b379e43d5..dd59454d4 100644 --- a/server/core/locking/locking_test.go +++ b/server/core/locking/locking_test.go @@ -20,10 +20,9 @@ import ( "strings" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/locking" "github.com/runatlantis/atlantis/server/core/locking/mocks" - "github.com/runatlantis/atlantis/server/core/locking/mocks/matchers" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/models" . "github.com/runatlantis/atlantis/testing" @@ -40,7 +39,7 @@ var pl = models.ProjectLock{Project: project, Pull: pull, User: user, Workspace: func TestTryLock_Err(t *testing.T) { RegisterMockTestingT(t) backend := mocks.NewMockBackend() - When(backend.TryLock(matchers.AnyModelsProjectLock())).ThenReturn(false, models.ProjectLock{}, errExpected) + When(backend.TryLock(Any[models.ProjectLock]())).ThenReturn(false, models.ProjectLock{}, errExpected) t.Log("when the backend returns an error, TryLock should return that error") l := locking.NewClient(backend) _, err := l.TryLock(project, workspace, pull, user) @@ -51,7 +50,7 @@ func TestTryLock_Success(t *testing.T) { RegisterMockTestingT(t) currLock := models.ProjectLock{} backend := mocks.NewMockBackend() - When(backend.TryLock(matchers.AnyModelsProjectLock())).ThenReturn(true, currLock, nil) + When(backend.TryLock(Any[models.ProjectLock]())).ThenReturn(true, currLock, nil) l := locking.NewClient(backend) r, err := l.TryLock(project, workspace, pull, user) Ok(t, err) @@ -71,7 +70,7 @@ func TestUnlock_InvalidKey(t *testing.T) { func TestUnlock_Err(t *testing.T) { RegisterMockTestingT(t) backend := mocks.NewMockBackend() - When(backend.Unlock(matchers.AnyModelsProject(), AnyString())).ThenReturn(nil, errExpected) + When(backend.Unlock(Any[models.Project](), Any[string]())).ThenReturn(nil, errExpected) l := locking.NewClient(backend) _, err := l.Unlock("owner/repo/path/workspace") Equals(t, err, err) @@ -81,7 +80,7 @@ func TestUnlock_Err(t *testing.T) { func TestUnlock(t *testing.T) { RegisterMockTestingT(t) backend := mocks.NewMockBackend() - When(backend.Unlock(matchers.AnyModelsProject(), AnyString())).ThenReturn(&pl, nil) + When(backend.Unlock(Any[models.Project](), Any[string]())).ThenReturn(&pl, nil) l := locking.NewClient(backend) lock, err := l.Unlock("owner/repo/path/workspace") Ok(t, err) @@ -196,7 +195,7 @@ func TestApplyLocker(t *testing.T) { t.Run("backend errors", func(t *testing.T) { backend := mocks.NewMockBackend() - When(backend.LockCommand(matchers.AnyCommandName(), matchers.AnyTimeTime())).ThenReturn(nil, errExpected) + When(backend.LockCommand(Any[command.Name](), Any[time.Time]())).ThenReturn(nil, errExpected) l := locking.NewApplyClient(backend, false) lock, err := l.LockApply() Equals(t, errExpected, err) @@ -210,13 +209,13 @@ func TestApplyLocker(t *testing.T) { _, err := l.LockApply() ErrEquals(t, "DisableApplyFlag is set; Apply commands are locked globally until flag is unset", err) - backend.VerifyWasCalled(Never()).LockCommand(matchers.AnyCommandName(), matchers.AnyTimeTime()) + backend.VerifyWasCalled(Never()).LockCommand(Any[command.Name](), Any[time.Time]()) }) t.Run("succeeds", func(t *testing.T) { backend := mocks.NewMockBackend() - When(backend.LockCommand(matchers.AnyCommandName(), matchers.AnyTimeTime())).ThenReturn(applyLock, nil) + When(backend.LockCommand(Any[command.Name](), Any[time.Time]())).ThenReturn(applyLock, nil) l := locking.NewApplyClient(backend, false) lock, _ := l.LockApply() Assert(t, lock.Locked, "exp lock present") @@ -227,7 +226,7 @@ func TestApplyLocker(t *testing.T) { t.Run("backend fails", func(t *testing.T) { backend := mocks.NewMockBackend() - When(backend.UnlockCommand(matchers.AnyCommandName())).ThenReturn(errExpected) + When(backend.UnlockCommand(Any[command.Name]())).ThenReturn(errExpected) l := locking.NewApplyClient(backend, false) err := l.UnlockApply() Equals(t, errExpected, err) @@ -240,13 +239,13 @@ func TestApplyLocker(t *testing.T) { err := l.UnlockApply() ErrEquals(t, "apply commands are disabled until DisableApply flag is unset", err) - backend.VerifyWasCalled(Never()).UnlockCommand(matchers.AnyCommandName()) + backend.VerifyWasCalled(Never()).UnlockCommand(Any[command.Name]()) }) t.Run("succeeds", func(t *testing.T) { backend := mocks.NewMockBackend() - When(backend.UnlockCommand(matchers.AnyCommandName())).ThenReturn(nil) + When(backend.UnlockCommand(Any[command.Name]())).ThenReturn(nil) l := locking.NewApplyClient(backend, false) err := l.UnlockApply() Equals(t, nil, err) @@ -258,7 +257,7 @@ func TestApplyLocker(t *testing.T) { t.Run("fails", func(t *testing.T) { backend := mocks.NewMockBackend() - When(backend.CheckCommandLock(matchers.AnyCommandName())).ThenReturn(nil, errExpected) + When(backend.CheckCommandLock(Any[command.Name]())).ThenReturn(nil, errExpected) l := locking.NewApplyClient(backend, false) lock, err := l.CheckApplyLock() Equals(t, errExpected, err) @@ -272,13 +271,13 @@ func TestApplyLocker(t *testing.T) { lock, err := l.CheckApplyLock() Ok(t, err) Equals(t, lock.Locked, true) - backend.VerifyWasCalled(Never()).CheckCommandLock(matchers.AnyCommandName()) + backend.VerifyWasCalled(Never()).CheckCommandLock(Any[command.Name]()) }) t.Run("UnlockCommand succeeds", func(t *testing.T) { backend := mocks.NewMockBackend() - When(backend.CheckCommandLock(matchers.AnyCommandName())).ThenReturn(applyLock, nil) + When(backend.CheckCommandLock(Any[command.Name]())).ThenReturn(applyLock, nil) l := locking.NewApplyClient(backend, false) lock, err := l.CheckApplyLock() Equals(t, nil, err) diff --git a/server/core/locking/mocks/matchers/command_name.go b/server/core/locking/mocks/matchers/command_name.go deleted file mode 100644 index f0c39dc39..000000000 --- a/server/core/locking/mocks/matchers/command_name.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandName() command.Name { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.Name))(nil)).Elem())) - var nullValue command.Name - return nullValue -} - -func EqCommandName(value command.Name) command.Name { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.Name - return nullValue -} - -func NotEqCommandName(value command.Name) command.Name { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.Name - return nullValue -} - -func CommandNameThat(matcher pegomock.ArgumentMatcher) command.Name { - pegomock.RegisterMatcher(matcher) - var nullValue command.Name - return nullValue -} diff --git a/server/core/locking/mocks/matchers/locking_applycommandlock.go b/server/core/locking/mocks/matchers/locking_applycommandlock.go deleted file mode 100644 index 97a494c68..000000000 --- a/server/core/locking/mocks/matchers/locking_applycommandlock.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - locking "github.com/runatlantis/atlantis/server/core/locking" -) - -func AnyLockingApplyCommandLock() locking.ApplyCommandLock { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(locking.ApplyCommandLock))(nil)).Elem())) - var nullValue locking.ApplyCommandLock - return nullValue -} - -func EqLockingApplyCommandLock(value locking.ApplyCommandLock) locking.ApplyCommandLock { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue locking.ApplyCommandLock - return nullValue -} - -func NotEqLockingApplyCommandLock(value locking.ApplyCommandLock) locking.ApplyCommandLock { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue locking.ApplyCommandLock - return nullValue -} - -func LockingApplyCommandLockThat(matcher pegomock.ArgumentMatcher) locking.ApplyCommandLock { - pegomock.RegisterMatcher(matcher) - var nullValue locking.ApplyCommandLock - return nullValue -} diff --git a/server/core/locking/mocks/matchers/locking_trylockresponse.go b/server/core/locking/mocks/matchers/locking_trylockresponse.go deleted file mode 100644 index 10e407b91..000000000 --- a/server/core/locking/mocks/matchers/locking_trylockresponse.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - locking "github.com/runatlantis/atlantis/server/core/locking" -) - -func AnyLockingTryLockResponse() locking.TryLockResponse { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(locking.TryLockResponse))(nil)).Elem())) - var nullValue locking.TryLockResponse - return nullValue -} - -func EqLockingTryLockResponse(value locking.TryLockResponse) locking.TryLockResponse { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue locking.TryLockResponse - return nullValue -} - -func NotEqLockingTryLockResponse(value locking.TryLockResponse) locking.TryLockResponse { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue locking.TryLockResponse - return nullValue -} - -func LockingTryLockResponseThat(matcher pegomock.ArgumentMatcher) locking.TryLockResponse { - pegomock.RegisterMatcher(matcher) - var nullValue locking.TryLockResponse - return nullValue -} diff --git a/server/core/locking/mocks/matchers/map_of_string_to_models_projectlock.go b/server/core/locking/mocks/matchers/map_of_string_to_models_projectlock.go deleted file mode 100644 index 44bad8a73..000000000 --- a/server/core/locking/mocks/matchers/map_of_string_to_models_projectlock.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyMapOfStringToModelsProjectLock() map[string]models.ProjectLock { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(map[string]models.ProjectLock))(nil)).Elem())) - var nullValue map[string]models.ProjectLock - return nullValue -} - -func EqMapOfStringToModelsProjectLock(value map[string]models.ProjectLock) map[string]models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue map[string]models.ProjectLock - return nullValue -} - -func NotEqMapOfStringToModelsProjectLock(value map[string]models.ProjectLock) map[string]models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue map[string]models.ProjectLock - return nullValue -} - -func MapOfStringToModelsProjectLockThat(matcher pegomock.ArgumentMatcher) map[string]models.ProjectLock { - pegomock.RegisterMatcher(matcher) - var nullValue map[string]models.ProjectLock - return nullValue -} diff --git a/server/core/locking/mocks/matchers/models_project.go b/server/core/locking/mocks/matchers/models_project.go deleted file mode 100644 index 5366370f1..000000000 --- a/server/core/locking/mocks/matchers/models_project.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsProject() models.Project { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.Project))(nil)).Elem())) - var nullValue models.Project - return nullValue -} - -func EqModelsProject(value models.Project) models.Project { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.Project - return nullValue -} - -func NotEqModelsProject(value models.Project) models.Project { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.Project - return nullValue -} - -func ModelsProjectThat(matcher pegomock.ArgumentMatcher) models.Project { - pegomock.RegisterMatcher(matcher) - var nullValue models.Project - return nullValue -} diff --git a/server/core/locking/mocks/matchers/models_projectlock.go b/server/core/locking/mocks/matchers/models_projectlock.go deleted file mode 100644 index 5332bed6e..000000000 --- a/server/core/locking/mocks/matchers/models_projectlock.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsProjectLock() models.ProjectLock { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.ProjectLock))(nil)).Elem())) - var nullValue models.ProjectLock - return nullValue -} - -func EqModelsProjectLock(value models.ProjectLock) models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.ProjectLock - return nullValue -} - -func NotEqModelsProjectLock(value models.ProjectLock) models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.ProjectLock - return nullValue -} - -func ModelsProjectLockThat(matcher pegomock.ArgumentMatcher) models.ProjectLock { - pegomock.RegisterMatcher(matcher) - var nullValue models.ProjectLock - return nullValue -} diff --git a/server/core/locking/mocks/matchers/models_projectplanstatus.go b/server/core/locking/mocks/matchers/models_projectplanstatus.go deleted file mode 100644 index 1f150689f..000000000 --- a/server/core/locking/mocks/matchers/models_projectplanstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsProjectPlanStatus() models.ProjectPlanStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.ProjectPlanStatus))(nil)).Elem())) - var nullValue models.ProjectPlanStatus - return nullValue -} - -func EqModelsProjectPlanStatus(value models.ProjectPlanStatus) models.ProjectPlanStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.ProjectPlanStatus - return nullValue -} - -func NotEqModelsProjectPlanStatus(value models.ProjectPlanStatus) models.ProjectPlanStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.ProjectPlanStatus - return nullValue -} - -func ModelsProjectPlanStatusThat(matcher pegomock.ArgumentMatcher) models.ProjectPlanStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.ProjectPlanStatus - return nullValue -} diff --git a/server/core/locking/mocks/matchers/models_pullrequest.go b/server/core/locking/mocks/matchers/models_pullrequest.go deleted file mode 100644 index 16b40e0e6..000000000 --- a/server/core/locking/mocks/matchers/models_pullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullRequest() models.PullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullRequest))(nil)).Elem())) - var nullValue models.PullRequest - return nullValue -} - -func EqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func NotEqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func ModelsPullRequestThat(matcher pegomock.ArgumentMatcher) models.PullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullRequest - return nullValue -} diff --git a/server/core/locking/mocks/matchers/models_pullstatus.go b/server/core/locking/mocks/matchers/models_pullstatus.go deleted file mode 100644 index 0ada25333..000000000 --- a/server/core/locking/mocks/matchers/models_pullstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullStatus() models.PullStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullStatus))(nil)).Elem())) - var nullValue models.PullStatus - return nullValue -} - -func EqModelsPullStatus(value models.PullStatus) models.PullStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullStatus - return nullValue -} - -func NotEqModelsPullStatus(value models.PullStatus) models.PullStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullStatus - return nullValue -} - -func ModelsPullStatusThat(matcher pegomock.ArgumentMatcher) models.PullStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullStatus - return nullValue -} diff --git a/server/core/locking/mocks/matchers/models_user.go b/server/core/locking/mocks/matchers/models_user.go deleted file mode 100644 index 958cb1e83..000000000 --- a/server/core/locking/mocks/matchers/models_user.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsUser() models.User { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.User))(nil)).Elem())) - var nullValue models.User - return nullValue -} - -func EqModelsUser(value models.User) models.User { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.User - return nullValue -} - -func NotEqModelsUser(value models.User) models.User { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.User - return nullValue -} - -func ModelsUserThat(matcher pegomock.ArgumentMatcher) models.User { - pegomock.RegisterMatcher(matcher) - var nullValue models.User - return nullValue -} diff --git a/server/core/locking/mocks/matchers/ptr_to_command_lock.go b/server/core/locking/mocks/matchers/ptr_to_command_lock.go deleted file mode 100644 index 7cadbd600..000000000 --- a/server/core/locking/mocks/matchers/ptr_to_command_lock.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyPtrToCommandLock() *command.Lock { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*command.Lock))(nil)).Elem())) - var nullValue *command.Lock - return nullValue -} - -func EqPtrToCommandLock(value *command.Lock) *command.Lock { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *command.Lock - return nullValue -} - -func NotEqPtrToCommandLock(value *command.Lock) *command.Lock { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *command.Lock - return nullValue -} - -func PtrToCommandLockThat(matcher pegomock.ArgumentMatcher) *command.Lock { - pegomock.RegisterMatcher(matcher) - var nullValue *command.Lock - return nullValue -} diff --git a/server/core/locking/mocks/matchers/ptr_to_models_projectlock.go b/server/core/locking/mocks/matchers/ptr_to_models_projectlock.go deleted file mode 100644 index ec5ccf148..000000000 --- a/server/core/locking/mocks/matchers/ptr_to_models_projectlock.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyPtrToModelsProjectLock() *models.ProjectLock { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*models.ProjectLock))(nil)).Elem())) - var nullValue *models.ProjectLock - return nullValue -} - -func EqPtrToModelsProjectLock(value *models.ProjectLock) *models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *models.ProjectLock - return nullValue -} - -func NotEqPtrToModelsProjectLock(value *models.ProjectLock) *models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *models.ProjectLock - return nullValue -} - -func PtrToModelsProjectLockThat(matcher pegomock.ArgumentMatcher) *models.ProjectLock { - pegomock.RegisterMatcher(matcher) - var nullValue *models.ProjectLock - return nullValue -} diff --git a/server/core/locking/mocks/matchers/ptr_to_models_pullstatus.go b/server/core/locking/mocks/matchers/ptr_to_models_pullstatus.go deleted file mode 100644 index dba39ad46..000000000 --- a/server/core/locking/mocks/matchers/ptr_to_models_pullstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyPtrToModelsPullStatus() *models.PullStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*models.PullStatus))(nil)).Elem())) - var nullValue *models.PullStatus - return nullValue -} - -func EqPtrToModelsPullStatus(value *models.PullStatus) *models.PullStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *models.PullStatus - return nullValue -} - -func NotEqPtrToModelsPullStatus(value *models.PullStatus) *models.PullStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *models.PullStatus - return nullValue -} - -func PtrToModelsPullStatusThat(matcher pegomock.ArgumentMatcher) *models.PullStatus { - pegomock.RegisterMatcher(matcher) - var nullValue *models.PullStatus - return nullValue -} diff --git a/server/core/locking/mocks/matchers/slice_of_command_projectresult.go b/server/core/locking/mocks/matchers/slice_of_command_projectresult.go deleted file mode 100644 index 47ad9d596..000000000 --- a/server/core/locking/mocks/matchers/slice_of_command_projectresult.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnySliceOfCommandProjectResult() []command.ProjectResult { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]command.ProjectResult))(nil)).Elem())) - var nullValue []command.ProjectResult - return nullValue -} - -func EqSliceOfCommandProjectResult(value []command.ProjectResult) []command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []command.ProjectResult - return nullValue -} - -func NotEqSliceOfCommandProjectResult(value []command.ProjectResult) []command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []command.ProjectResult - return nullValue -} - -func SliceOfCommandProjectResultThat(matcher pegomock.ArgumentMatcher) []command.ProjectResult { - pegomock.RegisterMatcher(matcher) - var nullValue []command.ProjectResult - return nullValue -} diff --git a/server/core/locking/mocks/matchers/slice_of_models_projectlock.go b/server/core/locking/mocks/matchers/slice_of_models_projectlock.go deleted file mode 100644 index 231657ca0..000000000 --- a/server/core/locking/mocks/matchers/slice_of_models_projectlock.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnySliceOfModelsProjectLock() []models.ProjectLock { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]models.ProjectLock))(nil)).Elem())) - var nullValue []models.ProjectLock - return nullValue -} - -func EqSliceOfModelsProjectLock(value []models.ProjectLock) []models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []models.ProjectLock - return nullValue -} - -func NotEqSliceOfModelsProjectLock(value []models.ProjectLock) []models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []models.ProjectLock - return nullValue -} - -func SliceOfModelsProjectLockThat(matcher pegomock.ArgumentMatcher) []models.ProjectLock { - pegomock.RegisterMatcher(matcher) - var nullValue []models.ProjectLock - return nullValue -} diff --git a/server/core/locking/mocks/matchers/time_time.go b/server/core/locking/mocks/matchers/time_time.go deleted file mode 100644 index 99a6e2f1c..000000000 --- a/server/core/locking/mocks/matchers/time_time.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - time "time" -) - -func AnyTimeTime() time.Time { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(time.Time))(nil)).Elem())) - var nullValue time.Time - return nullValue -} - -func EqTimeTime(value time.Time) time.Time { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue time.Time - return nullValue -} - -func NotEqTimeTime(value time.Time) time.Time { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue time.Time - return nullValue -} - -func TimeTimeThat(matcher pegomock.ArgumentMatcher) time.Time { - pegomock.RegisterMatcher(matcher) - var nullValue time.Time - return nullValue -} diff --git a/server/core/locking/mocks/mock_apply_lock_checker.go b/server/core/locking/mocks/mock_apply_lock_checker.go index 495fba3e6..cfe777fa3 100644 --- a/server/core/locking/mocks/mock_apply_lock_checker.go +++ b/server/core/locking/mocks/mock_apply_lock_checker.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" locking "github.com/runatlantis/atlantis/server/core/locking" "reflect" "time" diff --git a/server/core/locking/mocks/mock_apply_locker.go b/server/core/locking/mocks/mock_apply_locker.go index 63a46699e..691d1b268 100644 --- a/server/core/locking/mocks/mock_apply_locker.go +++ b/server/core/locking/mocks/mock_apply_locker.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" locking "github.com/runatlantis/atlantis/server/core/locking" "reflect" "time" diff --git a/server/core/locking/mocks/mock_backend.go b/server/core/locking/mocks/mock_backend.go index eb7ee8903..f2174476a 100644 --- a/server/core/locking/mocks/mock_backend.go +++ b/server/core/locking/mocks/mock_backend.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" models "github.com/runatlantis/atlantis/server/events/models" "reflect" @@ -26,11 +26,11 @@ func NewMockBackend(options ...pegomock.Option) *MockBackend { func (mock *MockBackend) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockBackend) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockBackend) CheckCommandLock(_param0 command.Name) (*command.Lock, error) { +func (mock *MockBackend) CheckCommandLock(cmdName command.Name) (*command.Lock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{cmdName} result := pegomock.GetGenericMockFrom(mock).Invoke("CheckCommandLock", params, []reflect.Type{reflect.TypeOf((**command.Lock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *command.Lock var ret1 error @@ -45,11 +45,11 @@ func (mock *MockBackend) CheckCommandLock(_param0 command.Name) (*command.Lock, return ret0, ret1 } -func (mock *MockBackend) DeletePullStatus(_param0 models.PullRequest) error { +func (mock *MockBackend) DeletePullStatus(pull models.PullRequest) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pull} result := pegomock.GetGenericMockFrom(mock).Invoke("DeletePullStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -60,11 +60,11 @@ func (mock *MockBackend) DeletePullStatus(_param0 models.PullRequest) error { return ret0 } -func (mock *MockBackend) GetLock(_param0 models.Project, _param1 string) (*models.ProjectLock, error) { +func (mock *MockBackend) GetLock(project models.Project, workspace string) (*models.ProjectLock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{project, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("GetLock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *models.ProjectLock var ret1 error @@ -79,11 +79,11 @@ func (mock *MockBackend) GetLock(_param0 models.Project, _param1 string) (*model return ret0, ret1 } -func (mock *MockBackend) GetPullStatus(_param0 models.PullRequest) (*models.PullStatus, error) { +func (mock *MockBackend) GetPullStatus(pull models.PullRequest) (*models.PullStatus, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pull} result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullStatus", params, []reflect.Type{reflect.TypeOf((**models.PullStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *models.PullStatus var ret1 error @@ -117,11 +117,11 @@ func (mock *MockBackend) List() ([]models.ProjectLock, error) { return ret0, ret1 } -func (mock *MockBackend) LockCommand(_param0 command.Name, _param1 time.Time) (*command.Lock, error) { +func (mock *MockBackend) LockCommand(cmdName command.Name, lockTime time.Time) (*command.Lock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{cmdName, lockTime} result := pegomock.GetGenericMockFrom(mock).Invoke("LockCommand", params, []reflect.Type{reflect.TypeOf((**command.Lock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *command.Lock var ret1 error @@ -136,11 +136,11 @@ func (mock *MockBackend) LockCommand(_param0 command.Name, _param1 time.Time) (* return ret0, ret1 } -func (mock *MockBackend) TryLock(_param0 models.ProjectLock) (bool, models.ProjectLock, error) { +func (mock *MockBackend) TryLock(lock models.ProjectLock) (bool, models.ProjectLock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{lock} result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 bool var ret1 models.ProjectLock @@ -159,11 +159,11 @@ func (mock *MockBackend) TryLock(_param0 models.ProjectLock) (bool, models.Proje return ret0, ret1, ret2 } -func (mock *MockBackend) Unlock(_param0 models.Project, _param1 string) (*models.ProjectLock, error) { +func (mock *MockBackend) Unlock(project models.Project, workspace string) (*models.ProjectLock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{project, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("Unlock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *models.ProjectLock var ret1 error @@ -178,11 +178,11 @@ func (mock *MockBackend) Unlock(_param0 models.Project, _param1 string) (*models return ret0, ret1 } -func (mock *MockBackend) UnlockByPull(_param0 string, _param1 int) ([]models.ProjectLock, error) { +func (mock *MockBackend) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repoFullName, pullNum} result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockByPull", params, []reflect.Type{reflect.TypeOf((*[]models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []models.ProjectLock var ret1 error @@ -197,11 +197,11 @@ func (mock *MockBackend) UnlockByPull(_param0 string, _param1 int) ([]models.Pro return ret0, ret1 } -func (mock *MockBackend) UnlockCommand(_param0 command.Name) error { +func (mock *MockBackend) UnlockCommand(cmdName command.Name) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{cmdName} result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockCommand", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -212,11 +212,11 @@ func (mock *MockBackend) UnlockCommand(_param0 command.Name) error { return ret0 } -func (mock *MockBackend) UpdateProjectStatus(_param0 models.PullRequest, _param1 string, _param2 string, _param3 models.ProjectPlanStatus) error { +func (mock *MockBackend) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, newStatus models.ProjectPlanStatus) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{pull, workspace, repoRelDir, newStatus} result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProjectStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -227,11 +227,11 @@ func (mock *MockBackend) UpdateProjectStatus(_param0 models.PullRequest, _param1 return ret0 } -func (mock *MockBackend) UpdatePullWithResults(_param0 models.PullRequest, _param1 []command.ProjectResult) (models.PullStatus, error) { +func (mock *MockBackend) UpdatePullWithResults(pull models.PullRequest, newResults []command.ProjectResult) (models.PullStatus, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockBackend().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{pull, newResults} result := pegomock.GetGenericMockFrom(mock).Invoke("UpdatePullWithResults", params, []reflect.Type{reflect.TypeOf((*models.PullStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullStatus var ret1 error @@ -283,8 +283,8 @@ type VerifierMockBackend struct { timeout time.Duration } -func (verifier *VerifierMockBackend) CheckCommandLock(_param0 command.Name) *MockBackend_CheckCommandLock_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockBackend) CheckCommandLock(cmdName command.Name) *MockBackend_CheckCommandLock_OngoingVerification { + params := []pegomock.Param{cmdName} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CheckCommandLock", params, verifier.timeout) return &MockBackend_CheckCommandLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -295,8 +295,8 @@ type MockBackend_CheckCommandLock_OngoingVerification struct { } func (c *MockBackend_CheckCommandLock_OngoingVerification) GetCapturedArguments() command.Name { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + cmdName := c.GetAllCapturedArguments() + return cmdName[len(cmdName)-1] } func (c *MockBackend_CheckCommandLock_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name) { @@ -310,8 +310,8 @@ func (c *MockBackend_CheckCommandLock_OngoingVerification) GetAllCapturedArgumen return } -func (verifier *VerifierMockBackend) DeletePullStatus(_param0 models.PullRequest) *MockBackend_DeletePullStatus_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockBackend) DeletePullStatus(pull models.PullRequest) *MockBackend_DeletePullStatus_OngoingVerification { + params := []pegomock.Param{pull} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeletePullStatus", params, verifier.timeout) return &MockBackend_DeletePullStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -322,8 +322,8 @@ type MockBackend_DeletePullStatus_OngoingVerification struct { } func (c *MockBackend_DeletePullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pull := c.GetAllCapturedArguments() + return pull[len(pull)-1] } func (c *MockBackend_DeletePullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) { @@ -337,8 +337,8 @@ func (c *MockBackend_DeletePullStatus_OngoingVerification) GetAllCapturedArgumen return } -func (verifier *VerifierMockBackend) GetLock(_param0 models.Project, _param1 string) *MockBackend_GetLock_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockBackend_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -349,8 +349,8 @@ type MockBackend_GetLock_OngoingVerification struct { } func (c *MockBackend_GetLock_OngoingVerification) GetCapturedArguments() (models.Project, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + project, workspace := c.GetAllCapturedArguments() + return project[len(project)-1], workspace[len(workspace)-1] } func (c *MockBackend_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) { @@ -368,8 +368,8 @@ func (c *MockBackend_GetLock_OngoingVerification) GetAllCapturedArguments() (_pa return } -func (verifier *VerifierMockBackend) GetPullStatus(_param0 models.PullRequest) *MockBackend_GetPullStatus_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockBackend) GetPullStatus(pull models.PullRequest) *MockBackend_GetPullStatus_OngoingVerification { + params := []pegomock.Param{pull} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullStatus", params, verifier.timeout) return &MockBackend_GetPullStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -380,8 +380,8 @@ type MockBackend_GetPullStatus_OngoingVerification struct { } func (c *MockBackend_GetPullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pull := c.GetAllCapturedArguments() + return pull[len(pull)-1] } func (c *MockBackend_GetPullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) { @@ -412,8 +412,8 @@ func (c *MockBackend_List_OngoingVerification) GetCapturedArguments() { func (c *MockBackend_List_OngoingVerification) GetAllCapturedArguments() { } -func (verifier *VerifierMockBackend) LockCommand(_param0 command.Name, _param1 time.Time) *MockBackend_LockCommand_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockBackend) LockCommand(cmdName command.Name, lockTime time.Time) *MockBackend_LockCommand_OngoingVerification { + params := []pegomock.Param{cmdName, lockTime} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "LockCommand", params, verifier.timeout) return &MockBackend_LockCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -424,8 +424,8 @@ type MockBackend_LockCommand_OngoingVerification struct { } func (c *MockBackend_LockCommand_OngoingVerification) GetCapturedArguments() (command.Name, time.Time) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + cmdName, lockTime := c.GetAllCapturedArguments() + return cmdName[len(cmdName)-1], lockTime[len(lockTime)-1] } func (c *MockBackend_LockCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name, _param1 []time.Time) { @@ -443,8 +443,8 @@ func (c *MockBackend_LockCommand_OngoingVerification) GetAllCapturedArguments() return } -func (verifier *VerifierMockBackend) TryLock(_param0 models.ProjectLock) *MockBackend_TryLock_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockBackend_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -455,8 +455,8 @@ type MockBackend_TryLock_OngoingVerification struct { } func (c *MockBackend_TryLock_OngoingVerification) GetCapturedArguments() models.ProjectLock { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + lock := c.GetAllCapturedArguments() + return lock[len(lock)-1] } func (c *MockBackend_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.ProjectLock) { @@ -470,8 +470,8 @@ func (c *MockBackend_TryLock_OngoingVerification) GetAllCapturedArguments() (_pa return } -func (verifier *VerifierMockBackend) Unlock(_param0 models.Project, _param1 string) *MockBackend_Unlock_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockBackend_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -482,8 +482,8 @@ type MockBackend_Unlock_OngoingVerification struct { } func (c *MockBackend_Unlock_OngoingVerification) GetCapturedArguments() (models.Project, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + project, workspace := c.GetAllCapturedArguments() + return project[len(project)-1], workspace[len(workspace)-1] } func (c *MockBackend_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string) { @@ -501,8 +501,8 @@ func (c *MockBackend_Unlock_OngoingVerification) GetAllCapturedArguments() (_par return } -func (verifier *VerifierMockBackend) UnlockByPull(_param0 string, _param1 int) *MockBackend_UnlockByPull_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockBackend_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -513,8 +513,8 @@ type MockBackend_UnlockByPull_OngoingVerification struct { } func (c *MockBackend_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repoFullName, pullNum := c.GetAllCapturedArguments() + return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1] } func (c *MockBackend_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) { @@ -532,8 +532,8 @@ func (c *MockBackend_UnlockByPull_OngoingVerification) GetAllCapturedArguments() return } -func (verifier *VerifierMockBackend) UnlockCommand(_param0 command.Name) *MockBackend_UnlockCommand_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockBackend) UnlockCommand(cmdName command.Name) *MockBackend_UnlockCommand_OngoingVerification { + params := []pegomock.Param{cmdName} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UnlockCommand", params, verifier.timeout) return &MockBackend_UnlockCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -544,8 +544,8 @@ type MockBackend_UnlockCommand_OngoingVerification struct { } func (c *MockBackend_UnlockCommand_OngoingVerification) GetCapturedArguments() command.Name { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + cmdName := c.GetAllCapturedArguments() + return cmdName[len(cmdName)-1] } func (c *MockBackend_UnlockCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []command.Name) { @@ -559,8 +559,8 @@ func (c *MockBackend_UnlockCommand_OngoingVerification) GetAllCapturedArguments( return } -func (verifier *VerifierMockBackend) UpdateProjectStatus(_param0 models.PullRequest, _param1 string, _param2 string, _param3 models.ProjectPlanStatus) *MockBackend_UpdateProjectStatus_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockBackend) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, newStatus models.ProjectPlanStatus) *MockBackend_UpdateProjectStatus_OngoingVerification { + params := []pegomock.Param{pull, workspace, repoRelDir, newStatus} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateProjectStatus", params, verifier.timeout) return &MockBackend_UpdateProjectStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -571,8 +571,8 @@ type MockBackend_UpdateProjectStatus_OngoingVerification struct { } func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetCapturedArguments() (models.PullRequest, string, string, models.ProjectPlanStatus) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + pull, workspace, repoRelDir, newStatus := c.GetAllCapturedArguments() + return pull[len(pull)-1], workspace[len(workspace)-1], repoRelDir[len(repoRelDir)-1], newStatus[len(newStatus)-1] } func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 []string, _param2 []string, _param3 []models.ProjectPlanStatus) { @@ -598,8 +598,8 @@ func (c *MockBackend_UpdateProjectStatus_OngoingVerification) GetAllCapturedArgu return } -func (verifier *VerifierMockBackend) UpdatePullWithResults(_param0 models.PullRequest, _param1 []command.ProjectResult) *MockBackend_UpdatePullWithResults_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockBackend) UpdatePullWithResults(pull models.PullRequest, newResults []command.ProjectResult) *MockBackend_UpdatePullWithResults_OngoingVerification { + params := []pegomock.Param{pull, newResults} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdatePullWithResults", params, verifier.timeout) return &MockBackend_UpdatePullWithResults_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -610,8 +610,8 @@ type MockBackend_UpdatePullWithResults_OngoingVerification struct { } func (c *MockBackend_UpdatePullWithResults_OngoingVerification) GetCapturedArguments() (models.PullRequest, []command.ProjectResult) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + pull, newResults := c.GetAllCapturedArguments() + return pull[len(pull)-1], newResults[len(newResults)-1] } func (c *MockBackend_UpdatePullWithResults_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 [][]command.ProjectResult) { diff --git a/server/core/locking/mocks/mock_locker.go b/server/core/locking/mocks/mock_locker.go index 4aef56e3f..1efcb2c64 100644 --- a/server/core/locking/mocks/mock_locker.go +++ b/server/core/locking/mocks/mock_locker.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" locking "github.com/runatlantis/atlantis/server/core/locking" models "github.com/runatlantis/atlantis/server/events/models" "reflect" @@ -26,11 +26,11 @@ func NewMockLocker(options ...pegomock.Option) *MockLocker { func (mock *MockLocker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockLocker) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockLocker) GetLock(_param0 string) (*models.ProjectLock, error) { +func (mock *MockLocker) GetLock(key string) (*models.ProjectLock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockLocker().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{key} result := pegomock.GetGenericMockFrom(mock).Invoke("GetLock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *models.ProjectLock var ret1 error @@ -64,11 +64,11 @@ func (mock *MockLocker) List() (map[string]models.ProjectLock, error) { return ret0, ret1 } -func (mock *MockLocker) TryLock(_param0 models.Project, _param1 string, _param2 models.PullRequest, _param3 models.User) (locking.TryLockResponse, error) { +func (mock *MockLocker) TryLock(p models.Project, workspace string, pull models.PullRequest, user models.User) (locking.TryLockResponse, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockLocker().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{p, workspace, pull, user} result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*locking.TryLockResponse)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 locking.TryLockResponse var ret1 error @@ -83,11 +83,11 @@ func (mock *MockLocker) TryLock(_param0 models.Project, _param1 string, _param2 return ret0, ret1 } -func (mock *MockLocker) Unlock(_param0 string) (*models.ProjectLock, error) { +func (mock *MockLocker) Unlock(key string) (*models.ProjectLock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockLocker().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{key} result := pegomock.GetGenericMockFrom(mock).Invoke("Unlock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *models.ProjectLock var ret1 error @@ -102,11 +102,11 @@ func (mock *MockLocker) Unlock(_param0 string) (*models.ProjectLock, error) { return ret0, ret1 } -func (mock *MockLocker) UnlockByPull(_param0 string, _param1 int) ([]models.ProjectLock, error) { +func (mock *MockLocker) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockLocker().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repoFullName, pullNum} result := pegomock.GetGenericMockFrom(mock).Invoke("UnlockByPull", params, []reflect.Type{reflect.TypeOf((*[]models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []models.ProjectLock var ret1 error @@ -158,8 +158,8 @@ type VerifierMockLocker struct { timeout time.Duration } -func (verifier *VerifierMockLocker) GetLock(_param0 string) *MockLocker_GetLock_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockLocker_GetLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -170,8 +170,8 @@ type MockLocker_GetLock_OngoingVerification struct { } func (c *MockLocker_GetLock_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + key := c.GetAllCapturedArguments() + return key[len(key)-1] } func (c *MockLocker_GetLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { @@ -202,8 +202,8 @@ func (c *MockLocker_List_OngoingVerification) GetCapturedArguments() { func (c *MockLocker_List_OngoingVerification) GetAllCapturedArguments() { } -func (verifier *VerifierMockLocker) TryLock(_param0 models.Project, _param1 string, _param2 models.PullRequest, _param3 models.User) *MockLocker_TryLock_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +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 &MockLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -214,8 +214,8 @@ type MockLocker_TryLock_OngoingVerification struct { } func (c *MockLocker_TryLock_OngoingVerification) GetCapturedArguments() (models.Project, string, models.PullRequest, models.User) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + 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 *MockLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Project, _param1 []string, _param2 []models.PullRequest, _param3 []models.User) { @@ -241,8 +241,8 @@ func (c *MockLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_par return } -func (verifier *VerifierMockLocker) Unlock(_param0 string) *MockLocker_Unlock_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockLocker_Unlock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -253,8 +253,8 @@ type MockLocker_Unlock_OngoingVerification struct { } func (c *MockLocker_Unlock_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + key := c.GetAllCapturedArguments() + return key[len(key)-1] } func (c *MockLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { @@ -268,8 +268,8 @@ func (c *MockLocker_Unlock_OngoingVerification) GetAllCapturedArguments() (_para return } -func (verifier *VerifierMockLocker) UnlockByPull(_param0 string, _param1 int) *MockLocker_UnlockByPull_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockLocker_UnlockByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -280,8 +280,8 @@ type MockLocker_UnlockByPull_OngoingVerification struct { } func (c *MockLocker_UnlockByPull_OngoingVerification) GetCapturedArguments() (string, int) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repoFullName, pullNum := c.GetAllCapturedArguments() + return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1] } func (c *MockLocker_UnlockByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) { diff --git a/server/core/runtime/apply_step_runner_test.go b/server/core/runtime/apply_step_runner_test.go index d6d8ad0a4..0e5e65bd4 100644 --- a/server/core/runtime/apply_step_runner_test.go +++ b/server/core/runtime/apply_step_runner_test.go @@ -9,15 +9,13 @@ import ( "testing" version "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/pkg/errors" "github.com/runatlantis/atlantis/server/core/runtime" runtimemocks "github.com/runatlantis/atlantis/server/core/runtime/mocks" runtimemodels "github.com/runatlantis/atlantis/server/core/runtime/models" "github.com/runatlantis/atlantis/server/core/terraform/mocks" - matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers" "github.com/runatlantis/atlantis/server/events/command" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/logging" @@ -66,7 +64,7 @@ func TestRun_Success(t *testing.T) { TerraformExecutor: terraform, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil)) Ok(t, err) @@ -98,7 +96,7 @@ func TestRun_AppliesCorrectProjectPlan(t *testing.T) { TerraformExecutor: terraform, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil)) Ok(t, err) @@ -130,7 +128,7 @@ func TestRun_UsesConfiguredTFVersion(t *testing.T) { TerraformExecutor: terraform, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := o.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil)) Ok(t, err) diff --git a/server/core/runtime/cache/mocks/matchers/ptr_to_go_version_version.go b/server/core/runtime/cache/mocks/matchers/ptr_to_go_version_version.go deleted file mode 100644 index bbae04738..000000000 --- a/server/core/runtime/cache/mocks/matchers/ptr_to_go_version_version.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - go_version "github.com/hashicorp/go-version" -) - -func AnyPtrToGoVersionVersion() *go_version.Version { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*go_version.Version))(nil)).Elem())) - var nullValue *go_version.Version - return nullValue -} - -func EqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *go_version.Version - return nullValue -} - -func NotEqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *go_version.Version - return nullValue -} - -func PtrToGoVersionVersionThat(matcher pegomock.ArgumentMatcher) *go_version.Version { - pegomock.RegisterMatcher(matcher) - var nullValue *go_version.Version - return nullValue -} diff --git a/server/core/runtime/cache/mocks/mock_key_serializer.go b/server/core/runtime/cache/mocks/mock_key_serializer.go index 6337cbb99..043ece805 100644 --- a/server/core/runtime/cache/mocks/mock_key_serializer.go +++ b/server/core/runtime/cache/mocks/mock_key_serializer.go @@ -5,7 +5,7 @@ package mocks import ( go_version "github.com/hashicorp/go-version" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -25,11 +25,11 @@ func NewMockKeySerializer(options ...pegomock.Option) *MockKeySerializer { func (mock *MockKeySerializer) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockKeySerializer) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockKeySerializer) Serialize(_param0 *go_version.Version) (string, error) { +func (mock *MockKeySerializer) Serialize(key *go_version.Version) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockKeySerializer().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{key} result := pegomock.GetGenericMockFrom(mock).Invoke("Serialize", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -81,8 +81,8 @@ type VerifierMockKeySerializer struct { timeout time.Duration } -func (verifier *VerifierMockKeySerializer) Serialize(_param0 *go_version.Version) *MockKeySerializer_Serialize_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockKeySerializer) Serialize(key *go_version.Version) *MockKeySerializer_Serialize_OngoingVerification { + params := []pegomock.Param{key} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Serialize", params, verifier.timeout) return &MockKeySerializer_Serialize_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockKeySerializer_Serialize_OngoingVerification struct { } func (c *MockKeySerializer_Serialize_OngoingVerification) GetCapturedArguments() *go_version.Version { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + key := c.GetAllCapturedArguments() + return key[len(key)-1] } func (c *MockKeySerializer_Serialize_OngoingVerification) GetAllCapturedArguments() (_param0 []*go_version.Version) { diff --git a/server/core/runtime/cache/mocks/mock_version_path.go b/server/core/runtime/cache/mocks/mock_version_path.go index 4b2d232f0..84c2bd5f7 100644 --- a/server/core/runtime/cache/mocks/mock_version_path.go +++ b/server/core/runtime/cache/mocks/mock_version_path.go @@ -5,7 +5,7 @@ package mocks import ( go_version "github.com/hashicorp/go-version" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -25,11 +25,11 @@ func NewMockExecutionVersionCache(options ...pegomock.Option) *MockExecutionVers func (mock *MockExecutionVersionCache) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockExecutionVersionCache) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockExecutionVersionCache) Get(_param0 *go_version.Version) (string, error) { +func (mock *MockExecutionVersionCache) Get(key *go_version.Version) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockExecutionVersionCache().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{key} result := pegomock.GetGenericMockFrom(mock).Invoke("Get", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -81,8 +81,8 @@ type VerifierMockExecutionVersionCache struct { timeout time.Duration } -func (verifier *VerifierMockExecutionVersionCache) Get(_param0 *go_version.Version) *MockExecutionVersionCache_Get_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockExecutionVersionCache) Get(key *go_version.Version) *MockExecutionVersionCache_Get_OngoingVerification { + params := []pegomock.Param{key} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Get", params, verifier.timeout) return &MockExecutionVersionCache_Get_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockExecutionVersionCache_Get_OngoingVerification struct { } func (c *MockExecutionVersionCache_Get_OngoingVerification) GetCapturedArguments() *go_version.Version { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + key := c.GetAllCapturedArguments() + return key[len(key)-1] } func (c *MockExecutionVersionCache_Get_OngoingVerification) GetAllCapturedArguments() (_param0 []*go_version.Version) { diff --git a/server/core/runtime/cache/version_path.go b/server/core/runtime/cache/version_path.go index 8232f1727..197d5d990 100644 --- a/server/core/runtime/cache/version_path.go +++ b/server/core/runtime/cache/version_path.go @@ -9,8 +9,8 @@ import ( "github.com/runatlantis/atlantis/server/core/runtime/models" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_version_path.go ExecutionVersionCache -//go:generate pegomock generate -m --package mocks -o mocks/mock_key_serializer.go KeySerializer +//go:generate pegomock generate --package mocks -o mocks/mock_version_path.go ExecutionVersionCache +//go:generate pegomock generate --package mocks -o mocks/mock_key_serializer.go KeySerializer type ExecutionVersionCache interface { Get(key *version.Version) (string, error) diff --git a/server/core/runtime/cache/version_path_test.go b/server/core/runtime/cache/version_path_test.go index d65eed31f..b7c08d1dd 100644 --- a/server/core/runtime/cache/version_path_test.go +++ b/server/core/runtime/cache/version_path_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" cache_mocks "github.com/runatlantis/atlantis/server/core/runtime/cache/mocks" "github.com/runatlantis/atlantis/server/core/runtime/models" models_mocks "github.com/runatlantis/atlantis/server/core/runtime/models/mocks" @@ -50,10 +50,10 @@ func TestExecutionVersionDiskLayer(t *testing.T) { Assert(t, err != nil, "err is expected") - mockFilePath.VerifyWasCalled(Never()).Join(AnyString()) + mockFilePath.VerifyWasCalled(Never()).Join(Any[string]()) mockFilePath.VerifyWasCalled(Never()).NotExists() mockFilePath.VerifyWasCalled(Never()).Resolve() - mockExec.VerifyWasCalled(Never()).LookPath(AnyString()) + mockExec.VerifyWasCalled(Never()).LookPath(Any[string]()) }) t.Run("finds in path", func(t *testing.T) { @@ -77,7 +77,7 @@ func TestExecutionVersionDiskLayer(t *testing.T) { Assert(t, resultPath == expectedPath, "path is expected") - mockFilePath.VerifyWasCalled(Never()).Join(AnyString()) + mockFilePath.VerifyWasCalled(Never()).Join(Any[string]()) mockFilePath.VerifyWasCalled(Never()).Resolve() mockFilePath.VerifyWasCalled(Never()).NotExists() }) diff --git a/server/core/runtime/env_step_runner_test.go b/server/core/runtime/env_step_runner_test.go index 046a18e7b..a26b5c1a9 100644 --- a/server/core/runtime/env_step_runner_test.go +++ b/server/core/runtime/env_step_runner_test.go @@ -11,7 +11,7 @@ import ( jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks" "github.com/runatlantis/atlantis/server/logging" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" . "github.com/runatlantis/atlantis/testing" ) diff --git a/server/core/runtime/executor.go b/server/core/runtime/executor.go index 5a3f805bb..69daafc22 100644 --- a/server/core/runtime/executor.go +++ b/server/core/runtime/executor.go @@ -6,7 +6,7 @@ import ( "github.com/runatlantis/atlantis/server/logging" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_versionedexecutorworkflow.go VersionedExecutorWorkflow +//go:generate pegomock generate --package mocks -o mocks/mock_versionedexecutorworkflow.go VersionedExecutorWorkflow // VersionedExecutorWorkflow defines a versioned execution for a given project context type VersionedExecutorWorkflow interface { diff --git a/server/core/runtime/import_step_runner_test.go b/server/core/runtime/import_step_runner_test.go index 1c344457e..b10f182de 100644 --- a/server/core/runtime/import_step_runner_test.go +++ b/server/core/runtime/import_step_runner_test.go @@ -7,10 +7,8 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" - runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/terraform/mocks" - tfmatchers "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/logging" . "github.com/runatlantis/atlantis/testing" @@ -35,7 +33,7 @@ func TestImportStepRunner_Run_Success(t *testing.T) { tfVersion, _ := version.NewVersion("0.15.0") s := NewImportStepRunner(terraform, tfVersion) - When(terraform.RunCommandWithVersion(runtimematchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), tfmatchers.AnyMapOfStringToString(), tfmatchers.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := s.Run(context, []string{}, tmpDir, map[string]string(nil)) Ok(t, err) @@ -65,7 +63,7 @@ func TestImportStepRunner_Run_Workspace(t *testing.T) { tfVersion, _ := version.NewVersion("0.15.0") s := NewImportStepRunner(terraform, tfVersion) - When(terraform.RunCommandWithVersion(runtimematchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), runtimematchers.AnyMapOfStringToString(), runtimematchers.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := s.Run(context, []string{}, tmpDir, map[string]string(nil)) Ok(t, err) diff --git a/server/core/runtime/init_step_runner_test.go b/server/core/runtime/init_step_runner_test.go index 28224fc21..45927591a 100644 --- a/server/core/runtime/init_step_runner_test.go +++ b/server/core/runtime/init_step_runner_test.go @@ -8,14 +8,12 @@ import ( "testing" version "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/pkg/errors" "github.com/runatlantis/atlantis/server/core/runtime" "github.com/runatlantis/atlantis/server/core/terraform/mocks" - matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers" "github.com/runatlantis/atlantis/server/events/command" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/logging" . "github.com/runatlantis/atlantis/testing" ) @@ -60,7 +58,7 @@ func TestRun_UsesGetOrInitForRightVersion(t *testing.T) { TerraformExecutor: terraform, DefaultTFVersion: tfVersion, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := iso.Run(ctx, []string{"extra", "args"}, "/path", map[string]string(nil)) @@ -83,7 +81,7 @@ func TestRun_ShowInitOutputOnError(t *testing.T) { RegisterMockTestingT(t) tfClient := mocks.NewMockClient() logger := logging.NewNoopLogger(t) - When(tfClient.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(tfClient.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", errors.New("error")) tfVersion, _ := version.NewVersion("0.11.0") @@ -127,7 +125,7 @@ func TestRun_InitOmitsUpgradeFlagIfLockFileTracked(t *testing.T) { TerraformExecutor: terraform, DefaultTFVersion: tfVersion, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := iso.Run(ctx, []string{"extra", "args"}, repoDir, map[string]string(nil)) @@ -156,7 +154,7 @@ func TestRun_InitKeepsUpgradeFlagIfLockFileNotPresent(t *testing.T) { TerraformExecutor: terraform, DefaultTFVersion: tfVersion, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := iso.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil)) @@ -189,7 +187,7 @@ func TestRun_InitKeepUpgradeFlagIfLockFilePresentAndTFLessThanPoint14(t *testing TerraformExecutor: terraform, DefaultTFVersion: tfVersion, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := iso.Run(ctx, []string{"extra", "args"}, tmpDir, map[string]string(nil)) @@ -256,7 +254,7 @@ func TestRun_InitExtraArgsDeDupe(t *testing.T) { TerraformExecutor: terraform, DefaultTFVersion: tfVersion, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := iso.Run(ctx, c.extraArgs, "/path", map[string]string(nil)) @@ -288,7 +286,7 @@ func TestRun_InitDeletesLockFileIfPresentAndNotTracked(t *testing.T) { TerraformExecutor: terraform, DefaultTFVersion: tfVersion, } - When(terraform.RunCommandWithVersion(matchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), matchers2.AnyMapOfStringToString(), matchers2.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) ctx := command.ProjectContext{ diff --git a/server/core/runtime/minimum_version_step_runner_delegate_test.go b/server/core/runtime/minimum_version_step_runner_delegate_test.go index 3fdfdc556..2c87f6711 100644 --- a/server/core/runtime/minimum_version_step_runner_delegate_test.go +++ b/server/core/runtime/minimum_version_step_runner_delegate_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/runtime/mocks" "github.com/runatlantis/atlantis/server/events/command" . "github.com/runatlantis/atlantis/testing" diff --git a/server/core/runtime/mocks/matchers/command_name.go b/server/core/runtime/mocks/matchers/command_name.go deleted file mode 100644 index f0c39dc39..000000000 --- a/server/core/runtime/mocks/matchers/command_name.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandName() command.Name { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.Name))(nil)).Elem())) - var nullValue command.Name - return nullValue -} - -func EqCommandName(value command.Name) command.Name { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.Name - return nullValue -} - -func NotEqCommandName(value command.Name) command.Name { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.Name - return nullValue -} - -func CommandNameThat(matcher pegomock.ArgumentMatcher) command.Name { - pegomock.RegisterMatcher(matcher) - var nullValue command.Name - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/command_projectcontext.go b/server/core/runtime/mocks/matchers/command_projectcontext.go deleted file mode 100644 index 53929afd5..000000000 --- a/server/core/runtime/mocks/matchers/command_projectcontext.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandProjectContext() command.ProjectContext { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectContext))(nil)).Elem())) - var nullValue command.ProjectContext - return nullValue -} - -func EqCommandProjectContext(value command.ProjectContext) command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.ProjectContext - return nullValue -} - -func NotEqCommandProjectContext(value command.ProjectContext) command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.ProjectContext - return nullValue -} - -func CommandProjectContextThat(matcher pegomock.ArgumentMatcher) command.ProjectContext { - pegomock.RegisterMatcher(matcher) - var nullValue command.ProjectContext - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/logging_simplelogging.go b/server/core/runtime/mocks/matchers/logging_simplelogging.go deleted file mode 100644 index 6bb3b9ec9..000000000 --- a/server/core/runtime/mocks/matchers/logging_simplelogging.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - logging "github.com/runatlantis/atlantis/server/logging" -) - -func AnyLoggingSimpleLogging() logging.SimpleLogging { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem())) - var nullValue logging.SimpleLogging - return nullValue -} - -func EqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func NotEqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func LoggingSimpleLoggingThat(matcher pegomock.ArgumentMatcher) logging.SimpleLogging { - pegomock.RegisterMatcher(matcher) - var nullValue logging.SimpleLogging - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/map_of_string_to_string.go b/server/core/runtime/mocks/matchers/map_of_string_to_string.go deleted file mode 100644 index dacd5d8ae..000000000 --- a/server/core/runtime/mocks/matchers/map_of_string_to_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnyMapOfStringToString() map[string]string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(map[string]string))(nil)).Elem())) - var nullValue map[string]string - return nullValue -} - -func EqMapOfStringToString(value map[string]string) map[string]string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue map[string]string - return nullValue -} - -func NotEqMapOfStringToString(value map[string]string) map[string]string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue map[string]string - return nullValue -} - -func MapOfStringToStringThat(matcher pegomock.ArgumentMatcher) map[string]string { - pegomock.RegisterMatcher(matcher) - var nullValue map[string]string - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/models_approvalstatus.go b/server/core/runtime/mocks/matchers/models_approvalstatus.go deleted file mode 100644 index 87c6174d6..000000000 --- a/server/core/runtime/mocks/matchers/models_approvalstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsApprovalStatus() models.ApprovalStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.ApprovalStatus))(nil)).Elem())) - var nullValue models.ApprovalStatus - return nullValue -} - -func EqModelsApprovalStatus(value models.ApprovalStatus) models.ApprovalStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.ApprovalStatus - return nullValue -} - -func NotEqModelsApprovalStatus(value models.ApprovalStatus) models.ApprovalStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.ApprovalStatus - return nullValue -} - -func ModelsApprovalStatusThat(matcher pegomock.ArgumentMatcher) models.ApprovalStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.ApprovalStatus - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/models_commitstatus.go b/server/core/runtime/mocks/matchers/models_commitstatus.go deleted file mode 100644 index f72ee4dc8..000000000 --- a/server/core/runtime/mocks/matchers/models_commitstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsCommitStatus() models.CommitStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.CommitStatus))(nil)).Elem())) - var nullValue models.CommitStatus - return nullValue -} - -func EqModelsCommitStatus(value models.CommitStatus) models.CommitStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.CommitStatus - return nullValue -} - -func NotEqModelsCommitStatus(value models.CommitStatus) models.CommitStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.CommitStatus - return nullValue -} - -func ModelsCommitStatusThat(matcher pegomock.ArgumentMatcher) models.CommitStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.CommitStatus - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/models_pullrequest.go b/server/core/runtime/mocks/matchers/models_pullrequest.go deleted file mode 100644 index 16b40e0e6..000000000 --- a/server/core/runtime/mocks/matchers/models_pullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullRequest() models.PullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullRequest))(nil)).Elem())) - var nullValue models.PullRequest - return nullValue -} - -func EqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func NotEqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func ModelsPullRequestThat(matcher pegomock.ArgumentMatcher) models.PullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullRequest - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/models_repo.go b/server/core/runtime/mocks/matchers/models_repo.go deleted file mode 100644 index 0f0b59bbb..000000000 --- a/server/core/runtime/mocks/matchers/models_repo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsRepo() models.Repo { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.Repo))(nil)).Elem())) - var nullValue models.Repo - return nullValue -} - -func EqModelsRepo(value models.Repo) models.Repo { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.Repo - return nullValue -} - -func NotEqModelsRepo(value models.Repo) models.Repo { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.Repo - return nullValue -} - -func ModelsRepoThat(matcher pegomock.ArgumentMatcher) models.Repo { - pegomock.RegisterMatcher(matcher) - var nullValue models.Repo - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/models_workflowhookcommandcontext.go b/server/core/runtime/mocks/matchers/models_workflowhookcommandcontext.go deleted file mode 100644 index 0d6b8a9af..000000000 --- a/server/core/runtime/mocks/matchers/models_workflowhookcommandcontext.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsWorkflowHookCommandContext() models.WorkflowHookCommandContext { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.WorkflowHookCommandContext))(nil)).Elem())) - var nullValue models.WorkflowHookCommandContext - return nullValue -} - -func EqModelsWorkflowHookCommandContext(value models.WorkflowHookCommandContext) models.WorkflowHookCommandContext { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.WorkflowHookCommandContext - return nullValue -} - -func NotEqModelsWorkflowHookCommandContext(value models.WorkflowHookCommandContext) models.WorkflowHookCommandContext { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.WorkflowHookCommandContext - return nullValue -} - -func ModelsWorkflowHookCommandContextThat(matcher pegomock.ArgumentMatcher) models.WorkflowHookCommandContext { - pegomock.RegisterMatcher(matcher) - var nullValue models.WorkflowHookCommandContext - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/ptr_to_command_projectresult.go b/server/core/runtime/mocks/matchers/ptr_to_command_projectresult.go deleted file mode 100644 index ca9d37187..000000000 --- a/server/core/runtime/mocks/matchers/ptr_to_command_projectresult.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyPtrToCommandProjectResult() *command.ProjectResult { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*command.ProjectResult))(nil)).Elem())) - var nullValue *command.ProjectResult - return nullValue -} - -func EqPtrToCommandProjectResult(value *command.ProjectResult) *command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *command.ProjectResult - return nullValue -} - -func NotEqPtrToCommandProjectResult(value *command.ProjectResult) *command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *command.ProjectResult - return nullValue -} - -func PtrToCommandProjectResultThat(matcher pegomock.ArgumentMatcher) *command.ProjectResult { - pegomock.RegisterMatcher(matcher) - var nullValue *command.ProjectResult - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/ptr_to_go_version_version.go b/server/core/runtime/mocks/matchers/ptr_to_go_version_version.go deleted file mode 100644 index bbae04738..000000000 --- a/server/core/runtime/mocks/matchers/ptr_to_go_version_version.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - go_version "github.com/hashicorp/go-version" -) - -func AnyPtrToGoVersionVersion() *go_version.Version { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*go_version.Version))(nil)).Elem())) - var nullValue *go_version.Version - return nullValue -} - -func EqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *go_version.Version - return nullValue -} - -func NotEqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *go_version.Version - return nullValue -} - -func PtrToGoVersionVersionThat(matcher pegomock.ArgumentMatcher) *go_version.Version { - pegomock.RegisterMatcher(matcher) - var nullValue *go_version.Version - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/recv_chan_of_models_line.go b/server/core/runtime/mocks/matchers/recv_chan_of_models_line.go deleted file mode 100644 index eb18c5684..000000000 --- a/server/core/runtime/mocks/matchers/recv_chan_of_models_line.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/core/runtime/models" -) - -func AnyRecvChanOfModelsLine() <-chan models.Line { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(<-chan models.Line))(nil)).Elem())) - var nullValue <-chan models.Line - return nullValue -} - -func EqRecvChanOfModelsLine(value <-chan models.Line) <-chan models.Line { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue <-chan models.Line - return nullValue -} - -func NotEqRecvChanOfModelsLine(value <-chan models.Line) <-chan models.Line { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue <-chan models.Line - return nullValue -} - -func RecvChanOfModelsLineThat(matcher pegomock.ArgumentMatcher) <-chan models.Line { - pegomock.RegisterMatcher(matcher) - var nullValue <-chan models.Line - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/send_chan_of_string.go b/server/core/runtime/mocks/matchers/send_chan_of_string.go deleted file mode 100644 index b3b13b8d5..000000000 --- a/server/core/runtime/mocks/matchers/send_chan_of_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySendChanOfString() chan<- string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(chan<- string))(nil)).Elem())) - var nullValue chan<- string - return nullValue -} - -func EqSendChanOfString(value chan<- string) chan<- string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue chan<- string - return nullValue -} - -func NotEqSendChanOfString(value chan<- string) chan<- string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue chan<- string - return nullValue -} - -func SendChanOfStringThat(matcher pegomock.ArgumentMatcher) chan<- string { - pegomock.RegisterMatcher(matcher) - var nullValue chan<- string - return nullValue -} diff --git a/server/core/runtime/mocks/matchers/slice_of_string.go b/server/core/runtime/mocks/matchers/slice_of_string.go deleted file mode 100644 index 96b18dd8b..000000000 --- a/server/core/runtime/mocks/matchers/slice_of_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySliceOfString() []string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]string))(nil)).Elem())) - var nullValue []string - return nullValue -} - -func EqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func NotEqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func SliceOfStringThat(matcher pegomock.ArgumentMatcher) []string { - pegomock.RegisterMatcher(matcher) - var nullValue []string - return nullValue -} diff --git a/server/core/runtime/mocks/mock_async_tfexec.go b/server/core/runtime/mocks/mock_async_tfexec.go index 0a7075cf6..fc93fde91 100644 --- a/server/core/runtime/mocks/mock_async_tfexec.go +++ b/server/core/runtime/mocks/mock_async_tfexec.go @@ -5,7 +5,7 @@ package mocks import ( go_version "github.com/hashicorp/go-version" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/core/runtime/models" command "github.com/runatlantis/atlantis/server/events/command" "reflect" @@ -27,11 +27,11 @@ func NewMockAsyncTFExec(options ...pegomock.Option) *MockAsyncTFExec { func (mock *MockAsyncTFExec) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockAsyncTFExec) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockAsyncTFExec) RunCommandAsync(_param0 command.ProjectContext, _param1 string, _param2 []string, _param3 map[string]string, _param4 *go_version.Version, _param5 string) (chan<- string, <-chan models.Line) { +func (mock *MockAsyncTFExec) RunCommandAsync(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *go_version.Version, workspace string) (chan<- string, <-chan models.Line) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockAsyncTFExec().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} + params := []pegomock.Param{ctx, path, args, envs, v, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("RunCommandAsync", params, []reflect.Type{reflect.TypeOf((*chan<- string)(nil)).Elem(), reflect.TypeOf((*<-chan models.Line)(nil)).Elem()}) var ret0 chan<- string var ret1 <-chan models.Line @@ -91,8 +91,8 @@ type VerifierMockAsyncTFExec struct { timeout time.Duration } -func (verifier *VerifierMockAsyncTFExec) RunCommandAsync(_param0 command.ProjectContext, _param1 string, _param2 []string, _param3 map[string]string, _param4 *go_version.Version, _param5 string) *MockAsyncTFExec_RunCommandAsync_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} +func (verifier *VerifierMockAsyncTFExec) RunCommandAsync(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *go_version.Version, workspace string) *MockAsyncTFExec_RunCommandAsync_OngoingVerification { + params := []pegomock.Param{ctx, path, args, envs, v, workspace} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunCommandAsync", params, verifier.timeout) return &MockAsyncTFExec_RunCommandAsync_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -103,8 +103,8 @@ type MockAsyncTFExec_RunCommandAsync_OngoingVerification struct { } func (c *MockAsyncTFExec_RunCommandAsync_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, []string, map[string]string, *go_version.Version, string) { - _param0, _param1, _param2, _param3, _param4, _param5 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1], _param5[len(_param5)-1] + ctx, path, args, envs, v, workspace := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], path[len(path)-1], args[len(args)-1], envs[len(envs)-1], v[len(v)-1], workspace[len(workspace)-1] } func (c *MockAsyncTFExec_RunCommandAsync_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 [][]string, _param3 []map[string]string, _param4 []*go_version.Version, _param5 []string) { diff --git a/server/core/runtime/mocks/mock_post_workflows_hook_runner.go b/server/core/runtime/mocks/mock_post_workflows_hook_runner.go index bbafa6a5b..1eadfe762 100644 --- a/server/core/runtime/mocks/mock_post_workflows_hook_runner.go +++ b/server/core/runtime/mocks/mock_post_workflows_hook_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockPostWorkflowHookRunner(options ...pegomock.Option) *MockPostWorkflow func (mock *MockPostWorkflowHookRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockPostWorkflowHookRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPostWorkflowHookRunner) Run(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) (string, string, error) { +func (mock *MockPostWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPostWorkflowHookRunner().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{ctx, command, path} result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 string @@ -85,8 +85,8 @@ type VerifierMockPostWorkflowHookRunner struct { timeout time.Duration } -func (verifier *VerifierMockPostWorkflowHookRunner) Run(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) *MockPostWorkflowHookRunner_Run_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockPostWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) *MockPostWorkflowHookRunner_Run_OngoingVerification { + params := []pegomock.Param{ctx, command, path} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout) return &MockPostWorkflowHookRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -97,8 +97,8 @@ type MockPostWorkflowHookRunner_Run_OngoingVerification struct { } func (c *MockPostWorkflowHookRunner_Run_OngoingVerification) GetCapturedArguments() (models.WorkflowHookCommandContext, string, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + ctx, command, path := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], command[len(command)-1], path[len(path)-1] } func (c *MockPostWorkflowHookRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.WorkflowHookCommandContext, _param1 []string, _param2 []string) { diff --git a/server/core/runtime/mocks/mock_pre_workflows_hook_runner.go b/server/core/runtime/mocks/mock_pre_workflows_hook_runner.go index 49a72c3b0..09d4435d9 100644 --- a/server/core/runtime/mocks/mock_pre_workflows_hook_runner.go +++ b/server/core/runtime/mocks/mock_pre_workflows_hook_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockPreWorkflowHookRunner(options ...pegomock.Option) *MockPreWorkflowHo func (mock *MockPreWorkflowHookRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockPreWorkflowHookRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPreWorkflowHookRunner) Run(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) (string, string, error) { +func (mock *MockPreWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPreWorkflowHookRunner().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{ctx, command, path} result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 string @@ -85,8 +85,8 @@ type VerifierMockPreWorkflowHookRunner struct { timeout time.Duration } -func (verifier *VerifierMockPreWorkflowHookRunner) Run(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 string) *MockPreWorkflowHookRunner_Run_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockPreWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) *MockPreWorkflowHookRunner_Run_OngoingVerification { + params := []pegomock.Param{ctx, command, path} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout) return &MockPreWorkflowHookRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -97,8 +97,8 @@ type MockPreWorkflowHookRunner_Run_OngoingVerification struct { } func (c *MockPreWorkflowHookRunner_Run_OngoingVerification) GetCapturedArguments() (models.WorkflowHookCommandContext, string, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + ctx, command, path := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], command[len(command)-1], path[len(path)-1] } func (c *MockPreWorkflowHookRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []models.WorkflowHookCommandContext, _param1 []string, _param2 []string) { diff --git a/server/core/runtime/mocks/mock_pull_approved_checker.go b/server/core/runtime/mocks/mock_pull_approved_checker.go index 2709766d5..13e1a3a83 100644 --- a/server/core/runtime/mocks/mock_pull_approved_checker.go +++ b/server/core/runtime/mocks/mock_pull_approved_checker.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockPullApprovedChecker(options ...pegomock.Option) *MockPullApprovedChe func (mock *MockPullApprovedChecker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockPullApprovedChecker) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPullApprovedChecker) PullIsApproved(_param0 models.Repo, _param1 models.PullRequest) (models.ApprovalStatus, error) { +func (mock *MockPullApprovedChecker) PullIsApproved(baseRepo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPullApprovedChecker().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{baseRepo, pull} result := pegomock.GetGenericMockFrom(mock).Invoke("PullIsApproved", params, []reflect.Type{reflect.TypeOf((*models.ApprovalStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.ApprovalStatus var ret1 error @@ -81,8 +81,8 @@ type VerifierMockPullApprovedChecker struct { timeout time.Duration } -func (verifier *VerifierMockPullApprovedChecker) PullIsApproved(_param0 models.Repo, _param1 models.PullRequest) *MockPullApprovedChecker_PullIsApproved_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockPullApprovedChecker_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockPullApprovedChecker_PullIsApproved_OngoingVerification struct { } func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + baseRepo, pull := c.GetAllCapturedArguments() + return baseRepo[len(baseRepo)-1], pull[len(pull)-1] } func (c *MockPullApprovedChecker_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { diff --git a/server/core/runtime/mocks/mock_runner.go b/server/core/runtime/mocks/mock_runner.go index d7434da35..d29757fac 100644 --- a/server/core/runtime/mocks/mock_runner.go +++ b/server/core/runtime/mocks/mock_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockRunner(options ...pegomock.Option) *MockRunner { func (mock *MockRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockRunner) Run(_param0 command.ProjectContext, _param1 []string, _param2 string, _param3 map[string]string) (string, error) { +func (mock *MockRunner) Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockRunner().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{ctx, extraArgs, path, envs} result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -81,8 +81,8 @@ type VerifierMockRunner struct { timeout time.Duration } -func (verifier *VerifierMockRunner) Run(_param0 command.ProjectContext, _param1 []string, _param2 string, _param3 map[string]string) *MockRunner_Run_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockRunner) Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) *MockRunner_Run_OngoingVerification { + params := []pegomock.Param{ctx, extraArgs, path, envs} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout) return &MockRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockRunner_Run_OngoingVerification struct { } func (c *MockRunner_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, []string, string, map[string]string) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + ctx, extraArgs, path, envs := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], extraArgs[len(extraArgs)-1], path[len(path)-1], envs[len(envs)-1] } func (c *MockRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 [][]string, _param2 []string, _param3 []map[string]string) { diff --git a/server/core/runtime/mocks/mock_status_updater.go b/server/core/runtime/mocks/mock_status_updater.go index ad9ac2ae3..63da713ab 100644 --- a/server/core/runtime/mocks/mock_status_updater.go +++ b/server/core/runtime/mocks/mock_status_updater.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" models "github.com/runatlantis/atlantis/server/events/models" "reflect" @@ -26,16 +26,16 @@ func NewMockStatusUpdater(options ...pegomock.Option) *MockStatusUpdater { func (mock *MockStatusUpdater) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockStatusUpdater) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockStatusUpdater) UpdateProject(_param0 command.ProjectContext, _param1 command.Name, _param2 models.CommitStatus, _param3 string, _param4 *command.ProjectResult) error { +func (mock *MockStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockStatusUpdater().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} - result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProject", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) + params := []pegomock.Param{ctx, cmdName, status, url, result} + pegomockResult := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProject", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error - if len(result) != 0 { - if result[0] != nil { - ret0 = result[0].(error) + if len(pegomockResult) != 0 { + if pegomockResult[0] != nil { + ret0 = pegomockResult[0].(error) } } return ret0 @@ -78,8 +78,8 @@ type VerifierMockStatusUpdater struct { timeout time.Duration } -func (verifier *VerifierMockStatusUpdater) UpdateProject(_param0 command.ProjectContext, _param1 command.Name, _param2 models.CommitStatus, _param3 string, _param4 *command.ProjectResult) *MockStatusUpdater_UpdateProject_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} +func (verifier *VerifierMockStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) *MockStatusUpdater_UpdateProject_OngoingVerification { + params := []pegomock.Param{ctx, cmdName, status, url, result} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateProject", params, verifier.timeout) return &MockStatusUpdater_UpdateProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -90,8 +90,8 @@ type MockStatusUpdater_UpdateProject_OngoingVerification struct { } func (c *MockStatusUpdater_UpdateProject_OngoingVerification) GetCapturedArguments() (command.ProjectContext, command.Name, models.CommitStatus, string, *command.ProjectResult) { - _param0, _param1, _param2, _param3, _param4 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1] + ctx, cmdName, status, url, result := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], cmdName[len(cmdName)-1], status[len(status)-1], url[len(url)-1], result[len(result)-1] } func (c *MockStatusUpdater_UpdateProject_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []command.Name, _param2 []models.CommitStatus, _param3 []string, _param4 []*command.ProjectResult) { diff --git a/server/core/runtime/mocks/mock_versionedexecutorworkflow.go b/server/core/runtime/mocks/mock_versionedexecutorworkflow.go index 933d11a44..ca6686fe5 100644 --- a/server/core/runtime/mocks/mock_versionedexecutorworkflow.go +++ b/server/core/runtime/mocks/mock_versionedexecutorworkflow.go @@ -5,7 +5,7 @@ package mocks import ( go_version "github.com/hashicorp/go-version" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" logging "github.com/runatlantis/atlantis/server/logging" "reflect" @@ -27,11 +27,11 @@ func NewMockVersionedExecutorWorkflow(options ...pegomock.Option) *MockVersioned func (mock *MockVersionedExecutorWorkflow) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockVersionedExecutorWorkflow) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockVersionedExecutorWorkflow) EnsureExecutorVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) (string, error) { +func (mock *MockVersionedExecutorWorkflow) EnsureExecutorVersion(log logging.SimpleLogging, v *go_version.Version) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockVersionedExecutorWorkflow().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{log, v} result := pegomock.GetGenericMockFrom(mock).Invoke("EnsureExecutorVersion", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -46,11 +46,11 @@ func (mock *MockVersionedExecutorWorkflow) EnsureExecutorVersion(_param0 logging return ret0, ret1 } -func (mock *MockVersionedExecutorWorkflow) Run(_param0 command.ProjectContext, _param1 string, _param2 map[string]string, _param3 string, _param4 []string) (string, error) { +func (mock *MockVersionedExecutorWorkflow) Run(ctx command.ProjectContext, executablePath string, envs map[string]string, workdir string, extraArgs []string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockVersionedExecutorWorkflow().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} + params := []pegomock.Param{ctx, executablePath, envs, workdir, extraArgs} result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -102,8 +102,8 @@ type VerifierMockVersionedExecutorWorkflow struct { timeout time.Duration } -func (verifier *VerifierMockVersionedExecutorWorkflow) EnsureExecutorVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockVersionedExecutorWorkflow) EnsureExecutorVersion(log logging.SimpleLogging, v *go_version.Version) *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification { + params := []pegomock.Param{log, v} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "EnsureExecutorVersion", params, verifier.timeout) return &MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -114,8 +114,8 @@ type MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification str } func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, *go_version.Version) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + log, v := c.GetAllCapturedArguments() + return log[len(log)-1], v[len(v)-1] } func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []*go_version.Version) { @@ -133,8 +133,8 @@ func (c *MockVersionedExecutorWorkflow_EnsureExecutorVersion_OngoingVerification return } -func (verifier *VerifierMockVersionedExecutorWorkflow) Run(_param0 command.ProjectContext, _param1 string, _param2 map[string]string, _param3 string, _param4 []string) *MockVersionedExecutorWorkflow_Run_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} +func (verifier *VerifierMockVersionedExecutorWorkflow) Run(ctx command.ProjectContext, executablePath string, envs map[string]string, workdir string, extraArgs []string) *MockVersionedExecutorWorkflow_Run_OngoingVerification { + params := []pegomock.Param{ctx, executablePath, envs, workdir, extraArgs} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout) return &MockVersionedExecutorWorkflow_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -145,8 +145,8 @@ type MockVersionedExecutorWorkflow_Run_OngoingVerification struct { } func (c *MockVersionedExecutorWorkflow_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, map[string]string, string, []string) { - _param0, _param1, _param2, _param3, _param4 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1] + ctx, executablePath, envs, workdir, extraArgs := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], executablePath[len(executablePath)-1], envs[len(envs)-1], workdir[len(workdir)-1], extraArgs[len(extraArgs)-1] } func (c *MockVersionedExecutorWorkflow_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 []map[string]string, _param3 []string, _param4 [][]string) { diff --git a/server/core/runtime/models/exec.go b/server/core/runtime/models/exec.go index 5e293caaa..4a7df796f 100644 --- a/server/core/runtime/models/exec.go +++ b/server/core/runtime/models/exec.go @@ -7,7 +7,7 @@ import ( "strings" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_exec.go Exec +//go:generate pegomock generate --package mocks -o mocks/mock_exec.go Exec type Exec interface { LookPath(file string) (string, error) diff --git a/server/core/runtime/models/filepath.go b/server/core/runtime/models/filepath.go index 9db37b01e..62eea76b8 100644 --- a/server/core/runtime/models/filepath.go +++ b/server/core/runtime/models/filepath.go @@ -5,7 +5,7 @@ import ( "path/filepath" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_filepath.go FilePath +//go:generate pegomock generate --package mocks -o mocks/mock_filepath.go FilePath type FilePath interface { NotExists() bool diff --git a/server/core/runtime/models/mocks/matchers/map_of_string_to_string.go b/server/core/runtime/models/mocks/matchers/map_of_string_to_string.go deleted file mode 100644 index dacd5d8ae..000000000 --- a/server/core/runtime/models/mocks/matchers/map_of_string_to_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnyMapOfStringToString() map[string]string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(map[string]string))(nil)).Elem())) - var nullValue map[string]string - return nullValue -} - -func EqMapOfStringToString(value map[string]string) map[string]string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue map[string]string - return nullValue -} - -func NotEqMapOfStringToString(value map[string]string) map[string]string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue map[string]string - return nullValue -} - -func MapOfStringToStringThat(matcher pegomock.ArgumentMatcher) map[string]string { - pegomock.RegisterMatcher(matcher) - var nullValue map[string]string - return nullValue -} diff --git a/server/core/runtime/models/mocks/matchers/models_filepath.go b/server/core/runtime/models/mocks/matchers/models_filepath.go deleted file mode 100644 index ac1e1b6b3..000000000 --- a/server/core/runtime/models/mocks/matchers/models_filepath.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/core/runtime/models" -) - -func AnyModelsFilePath() models.FilePath { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.FilePath))(nil)).Elem())) - var nullValue models.FilePath - return nullValue -} - -func EqModelsFilePath(value models.FilePath) models.FilePath { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.FilePath - return nullValue -} - -func NotEqModelsFilePath(value models.FilePath) models.FilePath { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.FilePath - return nullValue -} - -func ModelsFilePathThat(matcher pegomock.ArgumentMatcher) models.FilePath { - pegomock.RegisterMatcher(matcher) - var nullValue models.FilePath - return nullValue -} diff --git a/server/core/runtime/models/mocks/matchers/slice_of_string.go b/server/core/runtime/models/mocks/matchers/slice_of_string.go deleted file mode 100644 index 96b18dd8b..000000000 --- a/server/core/runtime/models/mocks/matchers/slice_of_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySliceOfString() []string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]string))(nil)).Elem())) - var nullValue []string - return nullValue -} - -func EqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func NotEqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func SliceOfStringThat(matcher pegomock.ArgumentMatcher) []string { - pegomock.RegisterMatcher(matcher) - var nullValue []string - return nullValue -} diff --git a/server/core/runtime/models/mocks/mock_exec.go b/server/core/runtime/models/mocks/mock_exec.go index 6bb691fa0..35386315c 100644 --- a/server/core/runtime/models/mocks/mock_exec.go +++ b/server/core/runtime/models/mocks/mock_exec.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -24,11 +24,11 @@ func NewMockExec(options ...pegomock.Option) *MockExec { func (mock *MockExec) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockExec) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockExec) CombinedOutput(_param0 []string, _param1 map[string]string, _param2 string) (string, error) { +func (mock *MockExec) CombinedOutput(args []string, envs map[string]string, workdir string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockExec().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{args, envs, workdir} result := pegomock.GetGenericMockFrom(mock).Invoke("CombinedOutput", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -43,11 +43,11 @@ func (mock *MockExec) CombinedOutput(_param0 []string, _param1 map[string]string return ret0, ret1 } -func (mock *MockExec) LookPath(_param0 string) (string, error) { +func (mock *MockExec) LookPath(file string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockExec().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{file} result := pegomock.GetGenericMockFrom(mock).Invoke("LookPath", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -99,8 +99,8 @@ type VerifierMockExec struct { timeout time.Duration } -func (verifier *VerifierMockExec) CombinedOutput(_param0 []string, _param1 map[string]string, _param2 string) *MockExec_CombinedOutput_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockExec) CombinedOutput(args []string, envs map[string]string, workdir string) *MockExec_CombinedOutput_OngoingVerification { + params := []pegomock.Param{args, envs, workdir} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CombinedOutput", params, verifier.timeout) return &MockExec_CombinedOutput_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -111,8 +111,8 @@ type MockExec_CombinedOutput_OngoingVerification struct { } func (c *MockExec_CombinedOutput_OngoingVerification) GetCapturedArguments() ([]string, map[string]string, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + args, envs, workdir := c.GetAllCapturedArguments() + return args[len(args)-1], envs[len(envs)-1], workdir[len(workdir)-1] } func (c *MockExec_CombinedOutput_OngoingVerification) GetAllCapturedArguments() (_param0 [][]string, _param1 []map[string]string, _param2 []string) { @@ -134,8 +134,8 @@ func (c *MockExec_CombinedOutput_OngoingVerification) GetAllCapturedArguments() return } -func (verifier *VerifierMockExec) LookPath(_param0 string) *MockExec_LookPath_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockExec) LookPath(file string) *MockExec_LookPath_OngoingVerification { + params := []pegomock.Param{file} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "LookPath", params, verifier.timeout) return &MockExec_LookPath_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -146,8 +146,8 @@ type MockExec_LookPath_OngoingVerification struct { } func (c *MockExec_LookPath_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + file := c.GetAllCapturedArguments() + return file[len(file)-1] } func (c *MockExec_LookPath_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { diff --git a/server/core/runtime/models/mocks/mock_filepath.go b/server/core/runtime/models/mocks/mock_filepath.go index c9ec05801..cdfd8995f 100644 --- a/server/core/runtime/models/mocks/mock_filepath.go +++ b/server/core/runtime/models/mocks/mock_filepath.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/core/runtime/models" "reflect" "time" @@ -25,12 +25,12 @@ func NewMockFilePath(options ...pegomock.Option) *MockFilePath { func (mock *MockFilePath) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockFilePath) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockFilePath) Join(_param0 ...string) models.FilePath { +func (mock *MockFilePath) Join(elem ...string) models.FilePath { if mock == nil { panic("mock must not be nil. Use myMock := NewMockFilePath().") } params := []pegomock.Param{} - for _, param := range _param0 { + for _, param := range elem { params = append(params, param) } result := pegomock.GetGenericMockFrom(mock).Invoke("Join", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem()}) @@ -73,11 +73,11 @@ func (mock *MockFilePath) Resolve() string { return ret0 } -func (mock *MockFilePath) Symlink(_param0 string) (models.FilePath, error) { +func (mock *MockFilePath) Symlink(newname string) (models.FilePath, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockFilePath().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{newname} result := pegomock.GetGenericMockFrom(mock).Invoke("Symlink", params, []reflect.Type{reflect.TypeOf((*models.FilePath)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.FilePath var ret1 error @@ -129,9 +129,9 @@ type VerifierMockFilePath struct { timeout time.Duration } -func (verifier *VerifierMockFilePath) Join(_param0 ...string) *MockFilePath_Join_OngoingVerification { +func (verifier *VerifierMockFilePath) Join(elem ...string) *MockFilePath_Join_OngoingVerification { params := []pegomock.Param{} - for _, param := range _param0 { + for _, param := range elem { params = append(params, param) } methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Join", params, verifier.timeout) @@ -144,8 +144,8 @@ type MockFilePath_Join_OngoingVerification struct { } func (c *MockFilePath_Join_OngoingVerification) GetCapturedArguments() []string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + elem := c.GetAllCapturedArguments() + return elem[len(elem)-1] } func (c *MockFilePath_Join_OngoingVerification) GetAllCapturedArguments() (_param0 [][]string) { @@ -198,8 +198,8 @@ func (c *MockFilePath_Resolve_OngoingVerification) GetCapturedArguments() { func (c *MockFilePath_Resolve_OngoingVerification) GetAllCapturedArguments() { } -func (verifier *VerifierMockFilePath) Symlink(_param0 string) *MockFilePath_Symlink_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockFilePath) Symlink(newname string) *MockFilePath_Symlink_OngoingVerification { + params := []pegomock.Param{newname} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Symlink", params, verifier.timeout) return &MockFilePath_Symlink_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -210,8 +210,8 @@ type MockFilePath_Symlink_OngoingVerification struct { } func (c *MockFilePath_Symlink_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + newname := c.GetAllCapturedArguments() + return newname[len(newname)-1] } func (c *MockFilePath_Symlink_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { diff --git a/server/core/runtime/models/shell_command_runner_test.go b/server/core/runtime/models/shell_command_runner_test.go index 730dc2ae1..0555c7144 100644 --- a/server/core/runtime/models/shell_command_runner_test.go +++ b/server/core/runtime/models/shell_command_runner_test.go @@ -6,8 +6,7 @@ import ( "strings" "testing" - . "github.com/petergtz/pegomock/v3" - "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/runtime/models" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/jobs/mocks" @@ -38,7 +37,7 @@ func TestShellCommandRunner_Run(t *testing.T) { t.Run(c.Command, func(t *testing.T) { RegisterMockTestingT(t) log := logmocks.NewMockSimpleLogging() - When(log.With(AnyString(), AnyInterface())).ThenReturn(log) + When(log.With(Any[string](), Any[interface{}]())).ThenReturn(log) ctx := command.ProjectContext{ Log: log, Workspace: "default", @@ -63,7 +62,7 @@ func TestShellCommandRunner_Run(t *testing.T) { projectCmdOutputHandler.VerifyWasCalledOnce().Send(ctx, line, false) } - log.VerifyWasCalledOnce().With(EqString("duration"), AnyInterface()) + log.VerifyWasCalledOnce().With(Eq("duration"), Any[interface{}]()) // And again with streaming disabled. Everything should be the same except the // command output handler should not have received anything @@ -73,9 +72,9 @@ func TestShellCommandRunner_Run(t *testing.T) { output, err = runner.Run(ctx) Ok(t, err) Equals(t, expectedOutput, output) - projectCmdOutputHandler.VerifyWasCalled(Never()).Send(matchers.AnyCommandProjectContext(), AnyString(), EqBool(false)) + projectCmdOutputHandler.VerifyWasCalled(Never()).Send(Any[command.ProjectContext](), Any[string](), Eq(false)) - log.VerifyWasCalled(Twice()).With(EqString("duration"), AnyInterface()) + log.VerifyWasCalled(Twice()).With(Eq("duration"), Any[interface{}]()) }) } } diff --git a/server/core/runtime/multienv_step_runner_test.go b/server/core/runtime/multienv_step_runner_test.go index 16af03670..171f02611 100644 --- a/server/core/runtime/multienv_step_runner_test.go +++ b/server/core/runtime/multienv_step_runner_test.go @@ -4,7 +4,7 @@ import ( "testing" version "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/runtime" "github.com/runatlantis/atlantis/server/core/terraform/mocks" "github.com/runatlantis/atlantis/server/events/command" diff --git a/server/core/runtime/plan_step_runner_test.go b/server/core/runtime/plan_step_runner_test.go index 06f9dac94..0adf4866d 100644 --- a/server/core/runtime/plan_step_runner_test.go +++ b/server/core/runtime/plan_step_runner_test.go @@ -8,15 +8,13 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/pkg/errors" "github.com/runatlantis/atlantis/server/core/runtime" runtimemocks "github.com/runatlantis/atlantis/server/core/runtime/mocks" runtimemodels "github.com/runatlantis/atlantis/server/core/runtime/models" "github.com/runatlantis/atlantis/server/core/terraform/mocks" - matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers" "github.com/runatlantis/atlantis/server/events/command" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/logging" @@ -181,12 +179,12 @@ Terraform will perform the following actions: tfVersion, _ := version.NewVersion("0.10.0") s := runtime.NewPlanStepRunner(terraform, tfVersion, commitStatusUpdater, asyncTfExec) When(terraform.RunCommandWithVersion( - matchers.AnyCommandProjectContext(), - AnyString(), - AnyStringSlice(), - matchers2.AnyMapOfStringToString(), - matchers2.AnyPtrToGoVersionVersion(), - AnyString())). + Any[command.ProjectContext](), + Any[string](), + Any[[]string](), + Any[map[string]string](), + Any[*version.Version](), + Any[string]())). Then(func(params []Param) ReturnValues { // This code allows us to return different values depending on the // tf command being run while still using the wildcard matchers above. @@ -234,12 +232,12 @@ func TestRun_OutputOnErr(t *testing.T) { expOutput := "expected output" expErrMsg := "error!" When(terraform.RunCommandWithVersion( - matchers.AnyCommandProjectContext(), - AnyString(), - AnyStringSlice(), - matchers2.AnyMapOfStringToString(), - matchers2.AnyPtrToGoVersionVersion(), - AnyString())). + Any[command.ProjectContext](), + Any[string](), + Any[[]string](), + Any[map[string]string](), + Any[*version.Version](), + Any[string]())). Then(func(params []Param) ReturnValues { // This code allows us to return different values depending on the // tf command being run while still using the wildcard matchers above. @@ -295,12 +293,12 @@ func TestRun_NoOptionalVarsIn012(t *testing.T) { commitStatusUpdater := runtimemocks.NewMockStatusUpdater() asyncTfExec := runtimemocks.NewMockAsyncTFExec() When(terraform.RunCommandWithVersion( - matchers.AnyCommandProjectContext(), - AnyString(), - AnyStringSlice(), - matchers2.AnyMapOfStringToString(), - matchers2.AnyPtrToGoVersionVersion(), - AnyString())).ThenReturn("output", nil) + Any[command.ProjectContext](), + Any[string](), + Any[[]string](), + Any[map[string]string](), + Any[*version.Version](), + Any[string]())).ThenReturn("output", nil) tfVersion, _ := version.NewVersion(c.tfVersion) s := runtime.NewPlanStepRunner(terraform, tfVersion, commitStatusUpdater, asyncTfExec) diff --git a/server/core/runtime/plan_type_step_runner_delegate_test.go b/server/core/runtime/plan_type_step_runner_delegate_test.go index 1aeb0ae83..286ae9ad4 100644 --- a/server/core/runtime/plan_type_step_runner_delegate_test.go +++ b/server/core/runtime/plan_type_step_runner_delegate_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" . "github.com/runatlantis/atlantis/testing" "github.com/runatlantis/atlantis/server/core/runtime/mocks" diff --git a/server/core/runtime/policy/conftest_client.go b/server/core/runtime/policy/conftest_client.go index ef7ee656a..80ef09883 100644 --- a/server/core/runtime/policy/conftest_client.go +++ b/server/core/runtime/policy/conftest_client.go @@ -78,7 +78,7 @@ func (c ConftestTestCommandArgs) build() ([]string, error) { // SourceResolver resolves the policy set to a local fs path // -//go:generate pegomock generate -m --package mocks -o mocks/mock_conftest_client.go SourceResolver +//go:generate pegomock generate --package mocks -o mocks/mock_conftest_client.go SourceResolver type SourceResolver interface { Resolve(policySet valid.PolicySet) (string, error) } diff --git a/server/core/runtime/policy/conftest_client_test.go b/server/core/runtime/policy/conftest_client_test.go index 21caaa445..171882c25 100644 --- a/server/core/runtime/policy/conftest_client_test.go +++ b/server/core/runtime/policy/conftest_client_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/config/valid" "github.com/runatlantis/atlantis/server/core/runtime/cache/mocks" models_mocks "github.com/runatlantis/atlantis/server/core/runtime/models/mocks" @@ -37,10 +37,10 @@ func TestConfTestVersionDownloader(t *testing.T) { t.Run("success", func(t *testing.T) { - When(mockDownloader.GetFile(EqString(destPath), EqString(fullURL))).ThenReturn(nil) + When(mockDownloader.GetFile(Eq(destPath), Eq(fullURL))).ThenReturn(nil) binPath, err := subject.downloadConfTestVersion(version, destPath) - mockDownloader.VerifyWasCalledOnce().GetAny(EqString(destPath), EqString(fullURL)) + mockDownloader.VerifyWasCalledOnce().GetAny(Eq(destPath), Eq(fullURL)) Ok(t, err) @@ -49,7 +49,7 @@ func TestConfTestVersionDownloader(t *testing.T) { t.Run("error", func(t *testing.T) { - When(mockDownloader.GetAny(EqString(destPath), EqString(fullURL))).ThenReturn(errors.New("err")) + When(mockDownloader.GetAny(Eq(destPath), Eq(fullURL))).ThenReturn(errors.New("err")) _, err := subject.downloadConfTestVersion(version, destPath) Assert(t, err != nil, "err is expected") @@ -73,7 +73,7 @@ func TestEnsureExecutorVersion(t *testing.T) { Exec: mockExec, } - When(mockExec.LookPath(AnyString())).ThenReturn("", errors.New("not found")) + When(mockExec.LookPath(Any[string]())).ThenReturn("", errors.New("not found")) _, err := subject.EnsureExecutorVersion(log, nil) Assert(t, err != nil, "expected error finding version") @@ -84,7 +84,7 @@ func TestEnsureExecutorVersion(t *testing.T) { VersionCache: mockCache, Exec: mockExec, } - When(mockExec.LookPath(AnyString())).ThenReturn(expectedPath, nil) + When(mockExec.LookPath(Any[string]())).ThenReturn(expectedPath, nil) path, err := subject.EnsureExecutorVersion(log, nil) Ok(t, err) Assert(t, path == expectedPath, "path is expected") diff --git a/server/core/runtime/policy/mocks/matchers/valid_policyset.go b/server/core/runtime/policy/mocks/matchers/valid_policyset.go deleted file mode 100644 index 1631e50be..000000000 --- a/server/core/runtime/policy/mocks/matchers/valid_policyset.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - valid "github.com/runatlantis/atlantis/server/core/config/valid" -) - -func AnyValidPolicySet() valid.PolicySet { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(valid.PolicySet))(nil)).Elem())) - var nullValue valid.PolicySet - return nullValue -} - -func EqValidPolicySet(value valid.PolicySet) valid.PolicySet { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue valid.PolicySet - return nullValue -} - -func NotEqValidPolicySet(value valid.PolicySet) valid.PolicySet { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue valid.PolicySet - return nullValue -} - -func ValidPolicySetThat(matcher pegomock.ArgumentMatcher) valid.PolicySet { - pegomock.RegisterMatcher(matcher) - var nullValue valid.PolicySet - return nullValue -} diff --git a/server/core/runtime/policy/mocks/mock_conftest_client.go b/server/core/runtime/policy/mocks/mock_conftest_client.go index 06a815fab..441fc606f 100644 --- a/server/core/runtime/policy/mocks/mock_conftest_client.go +++ b/server/core/runtime/policy/mocks/mock_conftest_client.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" valid "github.com/runatlantis/atlantis/server/core/config/valid" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockSourceResolver(options ...pegomock.Option) *MockSourceResolver { func (mock *MockSourceResolver) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockSourceResolver) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockSourceResolver) Resolve(_param0 valid.PolicySet) (string, error) { +func (mock *MockSourceResolver) Resolve(policySet valid.PolicySet) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSourceResolver().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{policySet} result := pegomock.GetGenericMockFrom(mock).Invoke("Resolve", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -81,8 +81,8 @@ type VerifierMockSourceResolver struct { timeout time.Duration } -func (verifier *VerifierMockSourceResolver) Resolve(_param0 valid.PolicySet) *MockSourceResolver_Resolve_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockSourceResolver) Resolve(policySet valid.PolicySet) *MockSourceResolver_Resolve_OngoingVerification { + params := []pegomock.Param{policySet} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Resolve", params, verifier.timeout) return &MockSourceResolver_Resolve_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockSourceResolver_Resolve_OngoingVerification struct { } func (c *MockSourceResolver_Resolve_OngoingVerification) GetCapturedArguments() valid.PolicySet { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + policySet := c.GetAllCapturedArguments() + return policySet[len(policySet)-1] } func (c *MockSourceResolver_Resolve_OngoingVerification) GetAllCapturedArguments() (_param0 []valid.PolicySet) { diff --git a/server/core/runtime/policy_check_step_runner_test.go b/server/core/runtime/policy_check_step_runner_test.go index f14b6476e..532c3170d 100644 --- a/server/core/runtime/policy_check_step_runner_test.go +++ b/server/core/runtime/policy_check_step_runner_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/config/valid" "github.com/runatlantis/atlantis/server/core/runtime/mocks" "github.com/runatlantis/atlantis/server/events/command" diff --git a/server/core/runtime/post_workflow_hook_runner.go b/server/core/runtime/post_workflow_hook_runner.go index 2bcbfb7da..2261f72ce 100644 --- a/server/core/runtime/post_workflow_hook_runner.go +++ b/server/core/runtime/post_workflow_hook_runner.go @@ -11,7 +11,7 @@ import ( "github.com/runatlantis/atlantis/server/jobs" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_post_workflows_hook_runner.go PostWorkflowHookRunner +//go:generate pegomock generate --package mocks -o mocks/mock_post_workflows_hook_runner.go PostWorkflowHookRunner type PostWorkflowHookRunner interface { Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error) } diff --git a/server/core/runtime/post_workflow_hook_runner_test.go b/server/core/runtime/post_workflow_hook_runner_test.go index 52e9d0c6c..13e2561b5 100644 --- a/server/core/runtime/post_workflow_hook_runner_test.go +++ b/server/core/runtime/post_workflow_hook_runner_test.go @@ -4,12 +4,10 @@ import ( "strings" "testing" - . "github.com/petergtz/pegomock/v3" + "github.com/hashicorp/go-version" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/runtime" - runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers" "github.com/runatlantis/atlantis/server/core/terraform/mocks" - matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks" "github.com/runatlantis/atlantis/server/logging" @@ -92,7 +90,7 @@ func TestPostWorkflowHookRunner_Run(t *testing.T) { RegisterMockTestingT(t) terraform := mocks.NewMockClient() - When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())). + When(terraform.EnsureVersion(Any[logging.SimpleLogging](), Any[*version.Version]())). ThenReturn(nil) logger := logging.NewNoopLogger(t) @@ -137,7 +135,7 @@ func TestPostWorkflowHookRunner_Run(t *testing.T) { Equals(t, c.ExpDescription, desc) expOut := strings.Replace(c.ExpOut, "$DIR", tmpDir, -1) projectCmdOutputHandler.VerifyWasCalledOnce().SendWorkflowHook( - runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(expOut), EqBool(false)) + Any[models.WorkflowHookCommandContext](), Eq(expOut), Eq(false)) }) } } diff --git a/server/core/runtime/pre_workflow_hook_runner.go b/server/core/runtime/pre_workflow_hook_runner.go index c0da72129..04d171062 100644 --- a/server/core/runtime/pre_workflow_hook_runner.go +++ b/server/core/runtime/pre_workflow_hook_runner.go @@ -11,7 +11,7 @@ import ( "github.com/runatlantis/atlantis/server/jobs" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_pre_workflows_hook_runner.go PreWorkflowHookRunner +//go:generate pegomock generate --package mocks -o mocks/mock_pre_workflows_hook_runner.go PreWorkflowHookRunner type PreWorkflowHookRunner interface { Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error) } diff --git a/server/core/runtime/pre_workflow_hook_runner_test.go b/server/core/runtime/pre_workflow_hook_runner_test.go index ac78a77a3..154d0d20c 100644 --- a/server/core/runtime/pre_workflow_hook_runner_test.go +++ b/server/core/runtime/pre_workflow_hook_runner_test.go @@ -4,12 +4,10 @@ import ( "strings" "testing" - . "github.com/petergtz/pegomock/v3" + "github.com/hashicorp/go-version" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/runtime" - runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers" "github.com/runatlantis/atlantis/server/core/terraform/mocks" - matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks" "github.com/runatlantis/atlantis/server/logging" @@ -92,7 +90,7 @@ func TestPreWorkflowHookRunner_Run(t *testing.T) { RegisterMockTestingT(t) terraform := mocks.NewMockClient() - When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())). + When(terraform.EnsureVersion(Any[logging.SimpleLogging](), Any[*version.Version]())). ThenReturn(nil) logger := logging.NewNoopLogger(t) @@ -137,7 +135,7 @@ func TestPreWorkflowHookRunner_Run(t *testing.T) { Equals(t, c.ExpDescription, desc) expOut := strings.Replace(c.ExpOut, "$DIR", tmpDir, -1) projectCmdOutputHandler.VerifyWasCalledOnce().SendWorkflowHook( - runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(expOut), EqBool(false)) + Any[models.WorkflowHookCommandContext](), Eq(expOut), Eq(false)) }) } } diff --git a/server/core/runtime/pull_approved_checker.go b/server/core/runtime/pull_approved_checker.go index 1e61c27d7..d3d9c3908 100644 --- a/server/core/runtime/pull_approved_checker.go +++ b/server/core/runtime/pull_approved_checker.go @@ -4,7 +4,7 @@ import ( "github.com/runatlantis/atlantis/server/events/models" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_pull_approved_checker.go PullApprovedChecker +//go:generate pegomock generate --package mocks -o mocks/mock_pull_approved_checker.go PullApprovedChecker type PullApprovedChecker interface { PullIsApproved(baseRepo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error) diff --git a/server/core/runtime/run_step_runner_test.go b/server/core/runtime/run_step_runner_test.go index 933eafe93..54774c91a 100644 --- a/server/core/runtime/run_step_runner_test.go +++ b/server/core/runtime/run_step_runner_test.go @@ -6,13 +6,11 @@ import ( "strings" "testing" - version "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + "github.com/hashicorp/go-version" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/runtime" "github.com/runatlantis/atlantis/server/core/terraform/mocks" - matchers2 "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers" "github.com/runatlantis/atlantis/server/events/command" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" jobmocks "github.com/runatlantis/atlantis/server/jobs/mocks" "github.com/runatlantis/atlantis/server/logging" @@ -105,7 +103,7 @@ func TestRunStepRunner_Run(t *testing.T) { RegisterMockTestingT(t) terraform := mocks.NewMockClient() - When(terraform.EnsureVersion(matchers.AnyLoggingSimpleLogging(), matchers2.AnyPtrToGoVersionVersion())). + When(terraform.EnsureVersion(Any[logging.SimpleLogging](), Any[*version.Version]())). ThenReturn(nil) logger := logging.NewNoopLogger(t) diff --git a/server/core/runtime/runtime.go b/server/core/runtime/runtime.go index 7cbfbd230..fbef261ce 100644 --- a/server/core/runtime/runtime.go +++ b/server/core/runtime/runtime.go @@ -35,7 +35,7 @@ type TerraformExec interface { // It's split from TerraformExec because due to a bug in pegomock with channels, // we can't generate a mock for it so we hand-write it for this specific method. // -//go:generate pegomock generate -m --package mocks -o mocks/mock_async_tfexec.go AsyncTFExec +//go:generate pegomock generate --package mocks -o mocks/mock_async_tfexec.go AsyncTFExec type AsyncTFExec interface { // RunCommandAsync runs terraform with args. It immediately returns an // input and output channel. Callers can use the output channel to @@ -49,14 +49,14 @@ type AsyncTFExec interface { // StatusUpdater brings the interface from CommitStatusUpdater into this package // without causing circular imports. // -//go:generate pegomock generate -m --package mocks -o mocks/mock_status_updater.go StatusUpdater +//go:generate pegomock generate --package mocks -o mocks/mock_status_updater.go StatusUpdater type StatusUpdater interface { UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) error } // Runner mirrors events.StepRunner as a way to bring it into this package // -//go:generate pegomock generate -m --package mocks -o mocks/mock_runner.go Runner +//go:generate pegomock generate --package mocks -o mocks/mock_runner.go Runner type Runner interface { Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) } diff --git a/server/core/runtime/show_step_runner_test.go b/server/core/runtime/show_step_runner_test.go index c4cf79942..9803efb9f 100644 --- a/server/core/runtime/show_step_runner_test.go +++ b/server/core/runtime/show_step_runner_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/terraform/mocks" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/logging" diff --git a/server/core/runtime/state_rm_step_runner_test.go b/server/core/runtime/state_rm_step_runner_test.go index ecd4c9dbf..df5e1036e 100644 --- a/server/core/runtime/state_rm_step_runner_test.go +++ b/server/core/runtime/state_rm_step_runner_test.go @@ -7,10 +7,8 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" - runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/terraform/mocks" - tfmatchers "github.com/runatlantis/atlantis/server/core/terraform/mocks/matchers" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/logging" . "github.com/runatlantis/atlantis/testing" @@ -35,7 +33,7 @@ func TestStateRmStepRunner_Run_Success(t *testing.T) { tfVersion, _ := version.NewVersion("0.15.0") s := NewStateRmStepRunner(terraform, tfVersion) - When(terraform.RunCommandWithVersion(runtimematchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), tfmatchers.AnyMapOfStringToString(), tfmatchers.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := s.Run(context, []string{}, tmpDir, map[string]string(nil)) Ok(t, err) @@ -65,7 +63,7 @@ func TestStateRmStepRunner_Run_Workspace(t *testing.T) { tfVersion, _ := version.NewVersion("0.15.0") s := NewStateRmStepRunner(terraform, tfVersion) - When(terraform.RunCommandWithVersion(runtimematchers.AnyCommandProjectContext(), AnyString(), AnyStringSlice(), runtimematchers.AnyMapOfStringToString(), runtimematchers.AnyPtrToGoVersionVersion(), AnyString())). + When(terraform.RunCommandWithVersion(Any[command.ProjectContext](), Any[string](), Any[[]string](), Any[map[string]string](), Any[*version.Version](), Any[string]())). ThenReturn("output", nil) output, err := s.Run(context, []string{}, tmpDir, map[string]string(nil)) Ok(t, err) diff --git a/server/core/runtime/version_step_runner_test.go b/server/core/runtime/version_step_runner_test.go index 79b33662e..55c4fc05f 100644 --- a/server/core/runtime/version_step_runner_test.go +++ b/server/core/runtime/version_step_runner_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/terraform/mocks" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/models" diff --git a/server/core/runtime/workspace_step_runner_delegate_test.go b/server/core/runtime/workspace_step_runner_delegate_test.go index 084f560b7..2ef3032d5 100644 --- a/server/core/runtime/workspace_step_runner_delegate_test.go +++ b/server/core/runtime/workspace_step_runner_delegate_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/terraform/mocks" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/models" diff --git a/server/core/terraform/mocks/matchers/command_projectcontext.go b/server/core/terraform/mocks/matchers/command_projectcontext.go deleted file mode 100644 index 53929afd5..000000000 --- a/server/core/terraform/mocks/matchers/command_projectcontext.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandProjectContext() command.ProjectContext { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectContext))(nil)).Elem())) - var nullValue command.ProjectContext - return nullValue -} - -func EqCommandProjectContext(value command.ProjectContext) command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.ProjectContext - return nullValue -} - -func NotEqCommandProjectContext(value command.ProjectContext) command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.ProjectContext - return nullValue -} - -func CommandProjectContextThat(matcher pegomock.ArgumentMatcher) command.ProjectContext { - pegomock.RegisterMatcher(matcher) - var nullValue command.ProjectContext - return nullValue -} diff --git a/server/core/terraform/mocks/matchers/logging_simplelogging.go b/server/core/terraform/mocks/matchers/logging_simplelogging.go deleted file mode 100644 index 6bb3b9ec9..000000000 --- a/server/core/terraform/mocks/matchers/logging_simplelogging.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - logging "github.com/runatlantis/atlantis/server/logging" -) - -func AnyLoggingSimpleLogging() logging.SimpleLogging { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem())) - var nullValue logging.SimpleLogging - return nullValue -} - -func EqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func NotEqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func LoggingSimpleLoggingThat(matcher pegomock.ArgumentMatcher) logging.SimpleLogging { - pegomock.RegisterMatcher(matcher) - var nullValue logging.SimpleLogging - return nullValue -} diff --git a/server/core/terraform/mocks/matchers/map_of_string_to_string.go b/server/core/terraform/mocks/matchers/map_of_string_to_string.go deleted file mode 100644 index dacd5d8ae..000000000 --- a/server/core/terraform/mocks/matchers/map_of_string_to_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnyMapOfStringToString() map[string]string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(map[string]string))(nil)).Elem())) - var nullValue map[string]string - return nullValue -} - -func EqMapOfStringToString(value map[string]string) map[string]string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue map[string]string - return nullValue -} - -func NotEqMapOfStringToString(value map[string]string) map[string]string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue map[string]string - return nullValue -} - -func MapOfStringToStringThat(matcher pegomock.ArgumentMatcher) map[string]string { - pegomock.RegisterMatcher(matcher) - var nullValue map[string]string - return nullValue -} diff --git a/server/core/terraform/mocks/matchers/ptr_to_go_version_version.go b/server/core/terraform/mocks/matchers/ptr_to_go_version_version.go deleted file mode 100644 index bbae04738..000000000 --- a/server/core/terraform/mocks/matchers/ptr_to_go_version_version.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - go_version "github.com/hashicorp/go-version" -) - -func AnyPtrToGoVersionVersion() *go_version.Version { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*go_version.Version))(nil)).Elem())) - var nullValue *go_version.Version - return nullValue -} - -func EqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *go_version.Version - return nullValue -} - -func NotEqPtrToGoVersionVersion(value *go_version.Version) *go_version.Version { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *go_version.Version - return nullValue -} - -func PtrToGoVersionVersionThat(matcher pegomock.ArgumentMatcher) *go_version.Version { - pegomock.RegisterMatcher(matcher) - var nullValue *go_version.Version - return nullValue -} diff --git a/server/core/terraform/mocks/matchers/slice_of_string.go b/server/core/terraform/mocks/matchers/slice_of_string.go deleted file mode 100644 index 96b18dd8b..000000000 --- a/server/core/terraform/mocks/matchers/slice_of_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySliceOfString() []string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]string))(nil)).Elem())) - var nullValue []string - return nullValue -} - -func EqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func NotEqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func SliceOfStringThat(matcher pegomock.ArgumentMatcher) []string { - pegomock.RegisterMatcher(matcher) - var nullValue []string - return nullValue -} diff --git a/server/core/terraform/mocks/mock_downloader.go b/server/core/terraform/mocks/mock_downloader.go index 924cb17ba..ed16db0ef 100644 --- a/server/core/terraform/mocks/mock_downloader.go +++ b/server/core/terraform/mocks/mock_downloader.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -24,11 +24,11 @@ func NewMockDownloader(options ...pegomock.Option) *MockDownloader { func (mock *MockDownloader) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockDownloader) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockDownloader) GetAny(_param0 string, _param1 string) error { +func (mock *MockDownloader) GetAny(dst string, src string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockDownloader().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{dst, src} result := pegomock.GetGenericMockFrom(mock).Invoke("GetAny", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -39,11 +39,11 @@ func (mock *MockDownloader) GetAny(_param0 string, _param1 string) error { return ret0 } -func (mock *MockDownloader) GetFile(_param0 string, _param1 string) error { +func (mock *MockDownloader) GetFile(dst string, src string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockDownloader().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{dst, src} result := pegomock.GetGenericMockFrom(mock).Invoke("GetFile", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -91,8 +91,8 @@ type VerifierMockDownloader struct { timeout time.Duration } -func (verifier *VerifierMockDownloader) GetAny(_param0 string, _param1 string) *MockDownloader_GetAny_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockDownloader) GetAny(dst string, src string) *MockDownloader_GetAny_OngoingVerification { + params := []pegomock.Param{dst, src} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetAny", params, verifier.timeout) return &MockDownloader_GetAny_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -103,8 +103,8 @@ type MockDownloader_GetAny_OngoingVerification struct { } func (c *MockDownloader_GetAny_OngoingVerification) GetCapturedArguments() (string, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + dst, src := c.GetAllCapturedArguments() + return dst[len(dst)-1], src[len(src)-1] } func (c *MockDownloader_GetAny_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) { @@ -122,8 +122,8 @@ func (c *MockDownloader_GetAny_OngoingVerification) GetAllCapturedArguments() (_ return } -func (verifier *VerifierMockDownloader) GetFile(_param0 string, _param1 string) *MockDownloader_GetFile_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockDownloader) GetFile(dst string, src string) *MockDownloader_GetFile_OngoingVerification { + params := []pegomock.Param{dst, src} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetFile", params, verifier.timeout) return &MockDownloader_GetFile_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -134,8 +134,8 @@ type MockDownloader_GetFile_OngoingVerification struct { } func (c *MockDownloader_GetFile_OngoingVerification) GetCapturedArguments() (string, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + dst, src := c.GetAllCapturedArguments() + return dst[len(dst)-1], src[len(src)-1] } func (c *MockDownloader_GetFile_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string) { diff --git a/server/core/terraform/mocks/mock_terraform_client.go b/server/core/terraform/mocks/mock_terraform_client.go index 2a20e132f..f5fe812a3 100644 --- a/server/core/terraform/mocks/mock_terraform_client.go +++ b/server/core/terraform/mocks/mock_terraform_client.go @@ -5,7 +5,7 @@ package mocks import ( go_version "github.com/hashicorp/go-version" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" logging "github.com/runatlantis/atlantis/server/logging" "reflect" @@ -27,11 +27,11 @@ 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) DetectVersion(_param0 logging.SimpleLogging, _param1 string) *go_version.Version { +func (mock *MockClient) DetectVersion(log logging.SimpleLogging, projectDirectory string) *go_version.Version { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{log, projectDirectory} result := pegomock.GetGenericMockFrom(mock).Invoke("DetectVersion", params, []reflect.Type{reflect.TypeOf((**go_version.Version)(nil)).Elem()}) var ret0 *go_version.Version if len(result) != 0 { @@ -42,11 +42,11 @@ func (mock *MockClient) DetectVersion(_param0 logging.SimpleLogging, _param1 str return ret0 } -func (mock *MockClient) EnsureVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) error { +func (mock *MockClient) EnsureVersion(log logging.SimpleLogging, v *go_version.Version) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{log, v} result := pegomock.GetGenericMockFrom(mock).Invoke("EnsureVersion", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -57,11 +57,11 @@ func (mock *MockClient) EnsureVersion(_param0 logging.SimpleLogging, _param1 *go return ret0 } -func (mock *MockClient) ListAvailableVersions(_param0 logging.SimpleLogging) ([]string, error) { +func (mock *MockClient) ListAvailableVersions(log logging.SimpleLogging) ([]string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{log} result := pegomock.GetGenericMockFrom(mock).Invoke("ListAvailableVersions", params, []reflect.Type{reflect.TypeOf((*[]string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []string var ret1 error @@ -76,11 +76,11 @@ func (mock *MockClient) ListAvailableVersions(_param0 logging.SimpleLogging) ([] return ret0, ret1 } -func (mock *MockClient) RunCommandWithVersion(_param0 command.ProjectContext, _param1 string, _param2 []string, _param3 map[string]string, _param4 *go_version.Version, _param5 string) (string, error) { +func (mock *MockClient) RunCommandWithVersion(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *go_version.Version, workspace string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} + params := []pegomock.Param{ctx, path, args, envs, v, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("RunCommandWithVersion", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -132,8 +132,8 @@ type VerifierMockClient struct { timeout time.Duration } -func (verifier *VerifierMockClient) DetectVersion(_param0 logging.SimpleLogging, _param1 string) *MockClient_DetectVersion_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockClient) DetectVersion(log logging.SimpleLogging, projectDirectory string) *MockClient_DetectVersion_OngoingVerification { + params := []pegomock.Param{log, projectDirectory} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DetectVersion", params, verifier.timeout) return &MockClient_DetectVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -144,8 +144,8 @@ type MockClient_DetectVersion_OngoingVerification struct { } func (c *MockClient_DetectVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + log, projectDirectory := c.GetAllCapturedArguments() + return log[len(log)-1], projectDirectory[len(projectDirectory)-1] } func (c *MockClient_DetectVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []string) { @@ -163,8 +163,8 @@ func (c *MockClient_DetectVersion_OngoingVerification) GetAllCapturedArguments() return } -func (verifier *VerifierMockClient) EnsureVersion(_param0 logging.SimpleLogging, _param1 *go_version.Version) *MockClient_EnsureVersion_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockClient) EnsureVersion(log logging.SimpleLogging, v *go_version.Version) *MockClient_EnsureVersion_OngoingVerification { + params := []pegomock.Param{log, v} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "EnsureVersion", params, verifier.timeout) return &MockClient_EnsureVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -175,8 +175,8 @@ type MockClient_EnsureVersion_OngoingVerification struct { } func (c *MockClient_EnsureVersion_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, *go_version.Version) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + log, v := c.GetAllCapturedArguments() + return log[len(log)-1], v[len(v)-1] } func (c *MockClient_EnsureVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []*go_version.Version) { @@ -194,8 +194,8 @@ func (c *MockClient_EnsureVersion_OngoingVerification) GetAllCapturedArguments() return } -func (verifier *VerifierMockClient) ListAvailableVersions(_param0 logging.SimpleLogging) *MockClient_ListAvailableVersions_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockClient) ListAvailableVersions(log logging.SimpleLogging) *MockClient_ListAvailableVersions_OngoingVerification { + params := []pegomock.Param{log} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ListAvailableVersions", params, verifier.timeout) return &MockClient_ListAvailableVersions_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -206,8 +206,8 @@ type MockClient_ListAvailableVersions_OngoingVerification struct { } func (c *MockClient_ListAvailableVersions_OngoingVerification) GetCapturedArguments() logging.SimpleLogging { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + log := c.GetAllCapturedArguments() + return log[len(log)-1] } func (c *MockClient_ListAvailableVersions_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging) { @@ -221,8 +221,8 @@ func (c *MockClient_ListAvailableVersions_OngoingVerification) GetAllCapturedArg return } -func (verifier *VerifierMockClient) RunCommandWithVersion(_param0 command.ProjectContext, _param1 string, _param2 []string, _param3 map[string]string, _param4 *go_version.Version, _param5 string) *MockClient_RunCommandWithVersion_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} +func (verifier *VerifierMockClient) RunCommandWithVersion(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *go_version.Version, workspace string) *MockClient_RunCommandWithVersion_OngoingVerification { + params := []pegomock.Param{ctx, path, args, envs, v, workspace} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunCommandWithVersion", params, verifier.timeout) return &MockClient_RunCommandWithVersion_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -233,8 +233,8 @@ type MockClient_RunCommandWithVersion_OngoingVerification struct { } func (c *MockClient_RunCommandWithVersion_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, []string, map[string]string, *go_version.Version, string) { - _param0, _param1, _param2, _param3, _param4, _param5 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1], _param5[len(_param5)-1] + ctx, path, args, envs, v, workspace := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], path[len(path)-1], args[len(args)-1], envs[len(envs)-1], v[len(v)-1], workspace[len(workspace)-1] } func (c *MockClient_RunCommandWithVersion_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 [][]string, _param3 []map[string]string, _param4 []*go_version.Version, _param5 []string) { diff --git a/server/core/terraform/terraform_client.go b/server/core/terraform/terraform_client.go index 2f57d08cd..7ca6fc727 100644 --- a/server/core/terraform/terraform_client.go +++ b/server/core/terraform/terraform_client.go @@ -46,7 +46,7 @@ import ( var LogStreamingValidCmds = [...]string{"init", "plan", "apply"} -//go:generate pegomock generate -m --package mocks -o mocks/mock_terraform_client.go Client +//go:generate pegomock generate --package mocks -o mocks/mock_terraform_client.go Client type Client interface { // RunCommandWithVersion executes terraform with args in path. If v is nil, @@ -93,7 +93,7 @@ type DefaultClient struct { projectCmdOutputHandler jobs.ProjectCommandOutputHandler } -//go:generate pegomock generate -m --package mocks -o mocks/mock_downloader.go Downloader +//go:generate pegomock generate --package mocks -o mocks/mock_downloader.go Downloader // Downloader is for downloading terraform versions. type Downloader interface { diff --git a/server/core/terraform/terraform_client_internal_test.go b/server/core/terraform/terraform_client_internal_test.go index e0316cd67..6dd4c89e8 100644 --- a/server/core/terraform/terraform_client_internal_test.go +++ b/server/core/terraform/terraform_client_internal_test.go @@ -8,7 +8,7 @@ import ( "testing" version "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" runtimemodels "github.com/runatlantis/atlantis/server/core/runtime/models" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/models" @@ -175,7 +175,7 @@ func TestDefaultClient_RunCommandAsync_Success(t *testing.T) { Ok(t, err) tmp := t.TempDir() logger := logmocks.NewMockSimpleLogging() - When(logger.With(AnyString(), AnyInterface())).ThenReturn(logger) + When(logger.With(Any[string](), Any[interface{}]())).ThenReturn(logger) projectCmdOutputHandler := jobmocks.NewMockProjectCommandOutputHandler() ctx := command.ProjectContext{ @@ -216,7 +216,7 @@ func TestDefaultClient_RunCommandAsync_Success(t *testing.T) { exp := fmt.Sprintf("TF_IN_AUTOMATION=true TF_PLUGIN_CACHE_DIR=%s WORKSPACE=workspace ATLANTIS_TERRAFORM_VERSION=0.11.11 DIR=%s", tmp, tmp) Equals(t, exp, out) - logger.VerifyWasCalledOnce().With(EqString("duration"), AnyInterface()) + logger.VerifyWasCalledOnce().With(Eq("duration"), Any[interface{}]()) } func TestDefaultClient_RunCommandAsync_BigOutput(t *testing.T) { @@ -225,7 +225,7 @@ func TestDefaultClient_RunCommandAsync_BigOutput(t *testing.T) { Ok(t, err) tmp := t.TempDir() logger := logmocks.NewMockSimpleLogging() - When(logger.With(AnyString(), AnyInterface())).ThenReturn(logger) + When(logger.With(Any[string](), Any[interface{}]())).ThenReturn(logger) projectCmdOutputHandler := jobmocks.NewMockProjectCommandOutputHandler() ctx := command.ProjectContext{ @@ -267,7 +267,7 @@ func TestDefaultClient_RunCommandAsync_BigOutput(t *testing.T) { Ok(t, err) Equals(t, strings.TrimRight(exp, "\n"), out) - logger.VerifyWasCalledOnce().With(EqString("duration"), AnyInterface()) + logger.VerifyWasCalledOnce().With(Eq("duration"), Any[interface{}]()) } func TestDefaultClient_RunCommandAsync_StderrOutput(t *testing.T) { @@ -276,7 +276,7 @@ func TestDefaultClient_RunCommandAsync_StderrOutput(t *testing.T) { Ok(t, err) tmp := t.TempDir() logger := logmocks.NewMockSimpleLogging() - When(logger.With(AnyString(), AnyInterface())).ThenReturn(logger) + When(logger.With(Any[string](), Any[interface{}]())).ThenReturn(logger) projectCmdOutputHandler := jobmocks.NewMockProjectCommandOutputHandler() ctx := command.ProjectContext{ @@ -307,7 +307,7 @@ func TestDefaultClient_RunCommandAsync_StderrOutput(t *testing.T) { Ok(t, err) Equals(t, "stderr", out) - logger.VerifyWasCalledOnce().With(EqString("duration"), AnyInterface()) + logger.VerifyWasCalledOnce().With(Eq("duration"), Any[interface{}]()) } func TestDefaultClient_RunCommandAsync_ExitOne(t *testing.T) { @@ -316,7 +316,7 @@ func TestDefaultClient_RunCommandAsync_ExitOne(t *testing.T) { Ok(t, err) tmp := t.TempDir() logger := logmocks.NewMockSimpleLogging() - When(logger.With(AnyString(), AnyInterface())).ThenReturn(logger) + When(logger.With(Any[string](), Any[interface{}]())).ThenReturn(logger) projectCmdOutputHandler := jobmocks.NewMockProjectCommandOutputHandler() ctx := command.ProjectContext{ @@ -348,7 +348,7 @@ func TestDefaultClient_RunCommandAsync_ExitOne(t *testing.T) { // Test that we still get our output. Equals(t, "dying", out) - logger.VerifyWasCalledOnce().With(EqString("duration"), AnyInterface()) + logger.VerifyWasCalledOnce().With(Eq("duration"), Any[interface{}]()) } func TestDefaultClient_RunCommandAsync_Input(t *testing.T) { @@ -357,7 +357,7 @@ func TestDefaultClient_RunCommandAsync_Input(t *testing.T) { Ok(t, err) tmp := t.TempDir() logger := logmocks.NewMockSimpleLogging() - When(logger.With(AnyString(), AnyInterface())).ThenReturn(logger) + When(logger.With(Any[string](), Any[interface{}]())).ThenReturn(logger) projectCmdOutputHandler := jobmocks.NewMockProjectCommandOutputHandler() ctx := command.ProjectContext{ @@ -390,7 +390,7 @@ func TestDefaultClient_RunCommandAsync_Input(t *testing.T) { Ok(t, err) Equals(t, "echo me", out) - logger.VerifyWasCalledOnce().With(EqString("duration"), AnyInterface()) + logger.VerifyWasCalledOnce().With(Eq("duration"), Any[interface{}]()) } func waitCh(ch <-chan runtimemodels.Line) (string, error) { diff --git a/server/core/terraform/terraform_client_test.go b/server/core/terraform/terraform_client_test.go index de72d437b..73251f4aa 100644 --- a/server/core/terraform/terraform_client_test.go +++ b/server/core/terraform/terraform_client_test.go @@ -23,8 +23,8 @@ import ( "time" version "github.com/hashicorp/go-version" - pegomock "github.com/petergtz/pegomock/v3" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" + pegomock "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/cmd" "github.com/runatlantis/atlantis/server/core/terraform" "github.com/runatlantis/atlantis/server/core/terraform/mocks" @@ -211,7 +211,7 @@ func TestNewClient_DefaultTFFlagDownload(t *testing.T) { defer tempSetEnv(t, "PATH", "")() mockDownloader := mocks.NewMockDownloader() - When(mockDownloader.GetFile(AnyString(), AnyString())).Then(func(params []pegomock.Param) pegomock.ReturnValues { + When(mockDownloader.GetFile(Any[string](), Any[string]())).Then(func(params []pegomock.Param) pegomock.ReturnValues { err := os.WriteFile(params[0].(string), []byte("#!/bin/sh\necho '\nTerraform v0.11.10\n'"), 0700) // #nosec G306 return []pegomock.ReturnValue{err} }) diff --git a/server/events/apply_command_runner_test.go b/server/events/apply_command_runner_test.go index 6291d735e..27117008a 100644 --- a/server/events/apply_command_runner_test.go +++ b/server/events/apply_command_runner_test.go @@ -5,12 +5,11 @@ import ( "testing" "github.com/google/go-github/v53/github" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/db" "github.com/runatlantis/atlantis/server/core/locking" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/events/models/testdata" "github.com/runatlantis/atlantis/server/logging" @@ -192,24 +191,24 @@ func TestApplyCommandRunner_IsSilenced(t *testing.T) { timesComment = 0 } - vcsClient.VerifyWasCalled(Times(timesComment)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Times(timesComment)).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) if c.ExpVCSStatusSet { commitUpdater.VerifyWasCalledOnce().UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.EqModelsCommitStatus(models.SuccessCommitStatus), - matchers.EqCommandName(command.Apply), - EqInt(c.ExpVCSStatusSucc), - EqInt(c.ExpVCSStatusTotal), + Any[models.Repo](), + Any[models.PullRequest](), + Eq[models.CommitStatus](models.SuccessCommitStatus), + Eq[command.Name](command.Apply), + Eq(c.ExpVCSStatusSucc), + Eq(c.ExpVCSStatusTotal), ) } else { commitUpdater.VerifyWasCalled(Never()).UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.AnyModelsCommitStatus(), - matchers.EqCommandName(command.Apply), - AnyInt(), - AnyInt(), + Any[models.Repo](), + Any[models.PullRequest](), + Any[models.CommitStatus](), + Eq[command.Name](command.Apply), + Any[int](), + Any[int](), ) } }) diff --git a/server/events/command_requirement_handler.go b/server/events/command_requirement_handler.go index 2fdfbdcd2..ed3cf7ac8 100644 --- a/server/events/command_requirement_handler.go +++ b/server/events/command_requirement_handler.go @@ -6,7 +6,7 @@ import ( "github.com/runatlantis/atlantis/server/events/command" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_command_requirement_handler.go CommandRequirementHandler +//go:generate pegomock generate --package mocks -o mocks/mock_command_requirement_handler.go CommandRequirementHandler type CommandRequirementHandler interface { ValidatePlanProject(repoDir string, ctx command.ProjectContext) (string, error) ValidateApplyProject(repoDir string, ctx command.ProjectContext) (string, error) diff --git a/server/events/command_requirement_handler_test.go b/server/events/command_requirement_handler_test.go index 4fd12f8fa..58364b864 100644 --- a/server/events/command_requirement_handler_test.go +++ b/server/events/command_requirement_handler_test.go @@ -4,13 +4,12 @@ import ( "fmt" "testing" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/config/raw" "github.com/runatlantis/atlantis/server/core/config/valid" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/models" - "github.com/runatlantis/atlantis/server/logging/mocks/matchers" - - . "github.com/petergtz/pegomock/v3" + "github.com/runatlantis/atlantis/server/logging" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/mocks" @@ -48,7 +47,7 @@ func TestAggregateApplyRequirements_ValidatePlanProject(t *testing.T) { ProjectPlanStatus: models.PassedPolicyCheckStatus, }, setup: func(workingDir *mocks.MockWorkingDir) { - When(workingDir.HasDiverged(matchers.AnyLoggingSimpleLogging(), AnyString())).ThenReturn(false) + When(workingDir.HasDiverged(Any[logging.SimpleLogging](), Any[string]())).ThenReturn(false) }, wantErr: assert.NoError, }, @@ -78,7 +77,7 @@ func TestAggregateApplyRequirements_ValidatePlanProject(t *testing.T) { PlanRequirements: []string{raw.UnDivergedRequirement}, }, setup: func(workingDir *mocks.MockWorkingDir) { - When(workingDir.HasDiverged(matchers.AnyLoggingSimpleLogging(), AnyString())).ThenReturn(true) + When(workingDir.HasDiverged(Any[logging.SimpleLogging](), Any[string]())).ThenReturn(true) }, wantFailure: "Default branch must be rebased onto pull request before running plan.", wantErr: assert.NoError, @@ -132,7 +131,7 @@ func TestAggregateApplyRequirements_ValidateApplyProject(t *testing.T) { ProjectPlanStatus: models.PassedPolicyCheckStatus, }, setup: func(workingDir *mocks.MockWorkingDir) { - When(workingDir.HasDiverged(matchers.AnyLoggingSimpleLogging(), AnyString())).ThenReturn(false) + When(workingDir.HasDiverged(Any[logging.SimpleLogging](), Any[string]())).ThenReturn(false) }, wantErr: assert.NoError, }, @@ -186,7 +185,7 @@ func TestAggregateApplyRequirements_ValidateApplyProject(t *testing.T) { ApplyRequirements: []string{raw.UnDivergedRequirement}, }, setup: func(workingDir *mocks.MockWorkingDir) { - When(workingDir.HasDiverged(matchers.AnyLoggingSimpleLogging(), AnyString())).ThenReturn(true) + When(workingDir.HasDiverged(Any[logging.SimpleLogging](), Any[string]())).ThenReturn(true) }, wantFailure: "Default branch must be rebased onto pull request before running apply.", wantErr: assert.NoError, @@ -239,7 +238,7 @@ func TestAggregateApplyRequirements_ValidateImportProject(t *testing.T) { ProjectPlanStatus: models.PassedPolicyCheckStatus, }, setup: func(workingDir *mocks.MockWorkingDir) { - When(workingDir.HasDiverged(matchers.AnyLoggingSimpleLogging(), AnyString())).ThenReturn(false) + When(workingDir.HasDiverged(Any[logging.SimpleLogging](), Any[string]())).ThenReturn(false) }, wantErr: assert.NoError, }, @@ -269,7 +268,7 @@ func TestAggregateApplyRequirements_ValidateImportProject(t *testing.T) { ImportRequirements: []string{raw.UnDivergedRequirement}, }, setup: func(workingDir *mocks.MockWorkingDir) { - When(workingDir.HasDiverged(matchers.AnyLoggingSimpleLogging(), AnyString())).ThenReturn(true) + When(workingDir.HasDiverged(Any[logging.SimpleLogging](), Any[string]())).ThenReturn(true) }, wantFailure: "Default branch must be rebased onto pull request before running import.", wantErr: assert.NoError, diff --git a/server/events/command_runner.go b/server/events/command_runner.go index 72db5d797..680afb425 100644 --- a/server/events/command_runner.go +++ b/server/events/command_runner.go @@ -35,7 +35,7 @@ const ( ShutdownComment = "Atlantis server is shutting down, please try again later." ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_command_runner.go CommandRunner +//go:generate pegomock generate --package mocks -o mocks/mock_command_runner.go CommandRunner // CommandRunner is the first step after a command request has been parsed. type CommandRunner interface { @@ -46,7 +46,7 @@ type CommandRunner interface { RunAutoplanCommand(baseRepo models.Repo, headRepo models.Repo, pull models.PullRequest, user models.User) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_github_pull_getter.go GithubPullGetter +//go:generate pegomock generate --package mocks -o mocks/mock_github_pull_getter.go GithubPullGetter // GithubPullGetter makes API calls to get pull requests. type GithubPullGetter interface { @@ -54,7 +54,7 @@ type GithubPullGetter interface { GetPullRequest(repo models.Repo, pullNum int) (*github.PullRequest, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_azuredevops_pull_getter.go AzureDevopsPullGetter +//go:generate pegomock generate --package mocks -o mocks/mock_azuredevops_pull_getter.go AzureDevopsPullGetter // AzureDevopsPullGetter makes API calls to get pull requests. type AzureDevopsPullGetter interface { @@ -62,7 +62,7 @@ type AzureDevopsPullGetter interface { GetPullRequest(repo models.Repo, pullNum int) (*azuredevops.GitPullRequest, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_gitlab_merge_request_getter.go GitlabMergeRequestGetter +//go:generate pegomock generate --package mocks -o mocks/mock_gitlab_merge_request_getter.go GitlabMergeRequestGetter // GitlabMergeRequestGetter makes API calls to get merge requests. type GitlabMergeRequestGetter interface { diff --git a/server/events/command_runner_test.go b/server/events/command_runner_test.go index 19296243a..f69f01066 100644 --- a/server/events/command_runner_test.go +++ b/server/events/command_runner_test.go @@ -16,7 +16,6 @@ package events_test import ( "errors" "fmt" - "reflect" "regexp" "strings" "testing" @@ -29,15 +28,13 @@ import ( "github.com/runatlantis/atlantis/server/metrics" "github.com/google/go-github/v53/github" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" lockingmocks "github.com/runatlantis/atlantis/server/core/locking/mocks" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/mocks" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/events/models/testdata" vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks" - vcsmatchers "github.com/runatlantis/atlantis/server/events/vcs/mocks/matchers" . "github.com/runatlantis/atlantis/testing" ) @@ -72,11 +69,6 @@ var importCommandRunner *events.ImportCommandRunner var preWorkflowHooksCommandRunner events.PreWorkflowHooksCommandRunner var postWorkflowHooksCommandRunner events.PostWorkflowHooksCommandRunner -func AnyRepo() models.Repo { - RegisterMatcher(NewAnyMatcher(reflect.TypeOf(models.Repo{}))) - return models.Repo{} -} - type TestConfig struct { parallelPoolSize int SilenceNoProjects bool @@ -232,11 +224,11 @@ func setup(t *testing.T, options ...func(testConfig *TestConfig)) *vcsmocks.Mock preWorkflowHooksCommandRunner = mocks.NewMockPreWorkflowHooksCommandRunner() - When(preWorkflowHooksCommandRunner.RunPreHooks(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn(nil) + When(preWorkflowHooksCommandRunner.RunPreHooks(Any[*command.Context](), Any[*events.CommentCommand]())).ThenReturn(nil) postWorkflowHooksCommandRunner = mocks.NewMockPostWorkflowHooksCommandRunner() - When(postWorkflowHooksCommandRunner.RunPostHooks(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn(nil) + When(postWorkflowHooksCommandRunner.RunPostHooks(Any[*command.Context](), Any[*events.CommentCommand]())).ThenReturn(nil) globalCfg := valid.NewGlobalCfgFromArgs(valid.GlobalCfgArgs{}) scope, _, _ := metrics.NewLoggingScope(logger, "atlantis") @@ -267,7 +259,7 @@ func TestRunCommentCommand_LogPanics(t *testing.T) { vcsClient := setup(t) When(githubGetter.GetPullRequest(testdata.GithubRepo, testdata.Pull.Num)).ThenPanic("panic test - if you're seeing this in a test failure this isn't the failing test") ch.RunCommentCommand(testdata.GithubRepo, &testdata.GithubRepo, nil, testdata.User, 1, &events.CommentCommand{Name: command.Plan}) - _, _, comment, _ := vcsClient.VerifyWasCalledOnce().CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()).GetCapturedArguments() + _, _, comment, _ := vcsClient.VerifyWasCalledOnce().CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetCapturedArguments() Assert(t, strings.Contains(comment, "Error: goroutine panic"), fmt.Sprintf("comment should be about a goroutine panic but was %q", comment)) } @@ -373,7 +365,7 @@ func TestRunCommentCommand_ForkPRDisabled_SilenceEnabled(t *testing.T) { When(eventParsing.ParseGithubPull(&pull)).ThenReturn(modelPull, modelPull.BaseRepo, headRepo, nil) ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Plan}) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } func TestRunCommentCommandPlan_NoProjects_SilenceEnabled(t *testing.T) { @@ -386,14 +378,14 @@ func TestRunCommentCommandPlan_NoProjects_SilenceEnabled(t *testing.T) { When(eventParsing.ParseGithubPull(&pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Plan}) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) commitUpdater.VerifyWasCalledOnce().UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.EqModelsCommitStatus(models.SuccessCommitStatus), - matchers.EqCommandName(command.Plan), - EqInt(0), - EqInt(0), + Any[models.Repo](), + Any[models.PullRequest](), + Eq[models.CommitStatus](models.SuccessCommitStatus), + Eq[command.Name](command.Plan), + Eq(0), + Eq(0), ) } @@ -408,14 +400,14 @@ func TestRunCommentCommandPlan_NoProjectsTarget_SilenceEnabled(t *testing.T) { When(eventParsing.ParseGithubPull(&pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Plan, ProjectName: "meow"}) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) commitUpdater.VerifyWasCalledOnce().UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.EqModelsCommitStatus(models.SuccessCommitStatus), - matchers.EqCommandName(command.Plan), - EqInt(0), - EqInt(0), + Any[models.Repo](), + Any[models.PullRequest](), + Eq[models.CommitStatus](models.SuccessCommitStatus), + Eq[command.Name](command.Plan), + Eq(0), + Eq(0), ) } @@ -429,14 +421,14 @@ func TestRunCommentCommandApply_NoProjects_SilenceEnabled(t *testing.T) { When(eventParsing.ParseGithubPull(&pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Apply}) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) commitUpdater.VerifyWasCalledOnce().UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.EqModelsCommitStatus(models.SuccessCommitStatus), - matchers.EqCommandName(command.Apply), - EqInt(0), - EqInt(0), + Any[models.Repo](), + Any[models.PullRequest](), + Eq[models.CommitStatus](models.SuccessCommitStatus), + Eq[command.Name](command.Apply), + Eq(0), + Eq(0), ) } @@ -450,14 +442,14 @@ func TestRunCommentCommandApprovePolicy_NoProjects_SilenceEnabled(t *testing.T) When(eventParsing.ParseGithubPull(&pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.ApprovePolicies}) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) commitUpdater.VerifyWasCalledOnce().UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.EqModelsCommitStatus(models.SuccessCommitStatus), - matchers.EqCommandName(command.PolicyCheck), - EqInt(0), - EqInt(0), + Any[models.Repo](), + Any[models.PullRequest](), + Eq[models.CommitStatus](models.SuccessCommitStatus), + Eq[command.Name](command.PolicyCheck), + Eq(0), + Eq(0), ) } @@ -471,7 +463,7 @@ func TestRunCommentCommandUnlock_NoProjects_SilenceEnabled(t *testing.T) { When(eventParsing.ParseGithubPull(&pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Unlock}) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } func TestRunCommentCommandImport_NoProjects_SilenceEnabled(t *testing.T) { @@ -484,7 +476,7 @@ func TestRunCommentCommandImport_NoProjects_SilenceEnabled(t *testing.T) { When(eventParsing.ParseGithubPull(&pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Import}) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } func TestRunCommentCommand_DisableApplyAllDisabled(t *testing.T) { @@ -509,7 +501,7 @@ func TestRunCommentCommand_DisableDisableAutoplan(t *testing.T) { ch.DisableAutoplan = true defer func() { ch.DisableAutoplan = false }() - When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToCommandContext())). + When(projectCommandBuilder.BuildAutoplanCommands(Any[*command.Context]())). ThenReturn([]command.ProjectContext{ { CommandName: command.Plan, @@ -520,7 +512,7 @@ func TestRunCommentCommand_DisableDisableAutoplan(t *testing.T) { }, nil) ch.RunAutoplanCommand(testdata.GithubRepo, testdata.GithubRepo, testdata.Pull, testdata.User) - projectCommandBuilder.VerifyWasCalled(Never()).BuildAutoplanCommands(matchers.AnyPtrToCommandContext()) + projectCommandBuilder.VerifyWasCalled(Never()).BuildAutoplanCommands(Any[*command.Context]()) } func TestRunCommentCommand_ClosedPull(t *testing.T) { @@ -569,7 +561,7 @@ func TestRunCommentCommand_UnmatchedBranch(t *testing.T) { When(eventParsing.ParseGithubPull(&pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Plan}) - vcsClient.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } func TestRunUnlockCommand_VCSComment(t *testing.T) { @@ -637,7 +629,7 @@ func TestRunAutoplanCommand_DeletePlans(t *testing.T) { autoMerger.GlobalAutomerge = true defer func() { autoMerger.GlobalAutomerge = false }() - When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToCommandContext())). + When(projectCommandBuilder.BuildAutoplanCommands(Any[*command.Context]())). ThenReturn([]command.ProjectContext{ { CommandName: command.Plan, @@ -646,8 +638,8 @@ func TestRunAutoplanCommand_DeletePlans(t *testing.T) { CommandName: command.Plan, }, }, nil) - When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}}) - When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(tmp, nil) + When(projectCommandRunner.Plan(Any[command.ProjectContext]())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}}) + When(workingDir.GetPullDir(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(tmp, nil) testdata.Pull.BaseRepo = testdata.GithubRepo ch.RunAutoplanCommand(testdata.GithubRepo, testdata.GithubRepo, testdata.Pull, testdata.User) pendingPlanFinder.VerifyWasCalledOnce().DeletePlans(tmp) @@ -664,8 +656,8 @@ func TestRunGenericPlanCommand_DeletePlans(t *testing.T) { autoMerger.GlobalAutomerge = true defer func() { autoMerger.GlobalAutomerge = false }() - When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}}) - When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(tmp, nil) + When(projectCommandRunner.Plan(Any[command.ProjectContext]())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}}) + When(workingDir.GetPullDir(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(tmp, nil) pull := &github.PullRequest{State: github.String("open")} modelPull := models.PullRequest{BaseRepo: testdata.GithubRepo, State: models.OpenPullState, Num: testdata.Pull.Num} When(githubGetter.GetPullRequest(testdata.GithubRepo, testdata.Pull.Num)).ThenReturn(pull, nil) @@ -686,8 +678,8 @@ func TestRunSpecificPlanCommandDoesnt_DeletePlans(t *testing.T) { autoMerger.GlobalAutomerge = true defer func() { autoMerger.GlobalAutomerge = false }() - When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}}) - When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(tmp, nil) + When(projectCommandRunner.Plan(Any[command.ProjectContext]())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}}) + When(workingDir.GetPullDir(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(tmp, nil) testdata.Pull.BaseRepo = testdata.GithubRepo ch.RunCommentCommand(testdata.GithubRepo, nil, nil, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Plan, ProjectName: "default"}) pendingPlanFinder.VerifyWasCalled(Never()).DeletePlans(tmp) @@ -706,7 +698,7 @@ func TestRunAutoplanCommandWithError_DeletePlans(t *testing.T) { autoMerger.GlobalAutomerge = true defer func() { autoMerger.GlobalAutomerge = false }() - When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToCommandContext())). + When(projectCommandBuilder.BuildAutoplanCommands(Any[*command.Context]())). ThenReturn([]command.ProjectContext{ { CommandName: command.Plan, @@ -716,7 +708,7 @@ func TestRunAutoplanCommandWithError_DeletePlans(t *testing.T) { }, }, nil) callCount := 0 - When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).Then(func(_ []Param) ReturnValues { + When(projectCommandRunner.Plan(Any[command.ProjectContext]())).Then(func(_ []Param) ReturnValues { if callCount == 0 { // The first call, we return a successful result. callCount++ @@ -734,14 +726,14 @@ func TestRunAutoplanCommandWithError_DeletePlans(t *testing.T) { } }) - When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())). + When(workingDir.GetPullDir(Any[models.Repo](), Any[models.PullRequest]())). ThenReturn(tmp, nil) testdata.Pull.BaseRepo = testdata.GithubRepo ch.RunAutoplanCommand(testdata.GithubRepo, testdata.GithubRepo, testdata.Pull, testdata.User) // gets called twice: the first time before the plan starts, the second time after the plan errors pendingPlanFinder.VerifyWasCalled(Times(2)).DeletePlans(tmp) - vcsClient.VerifyWasCalled(Times(0)).DiscardReviews(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest()) + vcsClient.VerifyWasCalled(Times(0)).DiscardReviews(Any[models.Repo](), Any[models.PullRequest]()) } func TestRunGenericPlanCommand_DiscardApprovals(t *testing.T) { @@ -757,8 +749,8 @@ func TestRunGenericPlanCommand_DiscardApprovals(t *testing.T) { autoMerger.GlobalAutomerge = true defer func() { autoMerger.GlobalAutomerge = false }() - When(projectCommandRunner.Plan(matchers.AnyCommandProjectContext())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}}) - When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(tmp, nil) + When(projectCommandRunner.Plan(Any[command.ProjectContext]())).ThenReturn(command.ProjectResult{PlanSuccess: &models.PlanSuccess{}}) + When(workingDir.GetPullDir(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(tmp, nil) pull := &github.PullRequest{State: github.String("open")} modelPull := models.PullRequest{BaseRepo: testdata.GithubRepo, State: models.OpenPullState, Num: testdata.Pull.Num} When(githubGetter.GetPullRequest(testdata.GithubRepo, testdata.Pull.Num)).ThenReturn(pull, nil) @@ -768,7 +760,7 @@ func TestRunGenericPlanCommand_DiscardApprovals(t *testing.T) { pendingPlanFinder.VerifyWasCalledOnce().DeletePlans(tmp) lockingLocker.VerifyWasCalledOnce().UnlockByPull(testdata.Pull.BaseRepo.FullName, testdata.Pull.Num) - vcsClient.VerifyWasCalledOnce().DiscardReviews(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest()) + vcsClient.VerifyWasCalledOnce().DiscardReviews(Any[models.Repo](), Any[models.PullRequest]()) } func TestFailedApprovalCreatesFailedStatusUpdate(t *testing.T) { @@ -794,7 +786,7 @@ func TestFailedApprovalCreatesFailedStatusUpdate(t *testing.T) { When(githubGetter.GetPullRequest(testdata.GithubRepo, testdata.Pull.Num)).ThenReturn(pull, nil) When(eventParsing.ParseGithubPull(pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) - When(projectCommandBuilder.BuildApprovePoliciesCommands(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn([]command.ProjectContext{ + When(projectCommandBuilder.BuildApprovePoliciesCommands(Any[*command.Context](), Any[*events.CommentCommand]())).ThenReturn([]command.ProjectContext{ { CommandName: command.ApprovePolicies, }, @@ -807,12 +799,12 @@ func TestFailedApprovalCreatesFailedStatusUpdate(t *testing.T) { ch.RunCommentCommand(testdata.GithubRepo, &testdata.GithubRepo, &testdata.Pull, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.ApprovePolicies}) commitUpdater.VerifyWasCalledOnce().UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.EqModelsCommitStatus(models.SuccessCommitStatus), - matchers.EqCommandName(command.PolicyCheck), - EqInt(0), - EqInt(2), + Any[models.Repo](), + Any[models.PullRequest](), + Eq[models.CommitStatus](models.SuccessCommitStatus), + Eq[command.Name](command.PolicyCheck), + Eq(0), + Eq(2), ) } @@ -839,7 +831,7 @@ func TestApprovedPoliciesUpdateFailedPolicyStatus(t *testing.T) { When(githubGetter.GetPullRequest(testdata.GithubRepo, testdata.Pull.Num)).ThenReturn(pull, nil) When(eventParsing.ParseGithubPull(pull)).ThenReturn(modelPull, modelPull.BaseRepo, testdata.GithubRepo, nil) - When(projectCommandBuilder.BuildApprovePoliciesCommands(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).ThenReturn([]command.ProjectContext{ + When(projectCommandBuilder.BuildApprovePoliciesCommands(Any[*command.Context](), Any[*events.CommentCommand]())).ThenReturn([]command.ProjectContext{ { CommandName: command.ApprovePolicies, PolicySets: valid.PolicySets{ @@ -851,7 +843,7 @@ func TestApprovedPoliciesUpdateFailedPolicyStatus(t *testing.T) { }, nil) When(workingDir.GetPullDir(testdata.GithubRepo, testdata.Pull)).ThenReturn(tmp, nil) - When(projectCommandRunner.ApprovePolicies(matchers.AnyCommandProjectContext())).Then(func(_ []Param) ReturnValues { + When(projectCommandRunner.ApprovePolicies(Any[command.ProjectContext]())).Then(func(_ []Param) ReturnValues { return ReturnValues{ command.ProjectResult{ Command: command.PolicyCheck, @@ -862,12 +854,12 @@ func TestApprovedPoliciesUpdateFailedPolicyStatus(t *testing.T) { ch.RunCommentCommand(testdata.GithubRepo, &testdata.GithubRepo, &testdata.Pull, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.ApprovePolicies}) commitUpdater.VerifyWasCalledOnce().UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.EqModelsCommitStatus(models.SuccessCommitStatus), - matchers.EqCommandName(command.PolicyCheck), - EqInt(1), - EqInt(1), + Any[models.Repo](), + Any[models.PullRequest](), + Eq[models.CommitStatus](models.SuccessCommitStatus), + Eq[command.Name](command.PolicyCheck), + Eq(1), + Eq(1), ) } @@ -906,7 +898,7 @@ func TestApplyMergeablityWhenPolicyCheckFails(t *testing.T) { When(ch.VCSClient.PullIsMergeable(testdata.GithubRepo, modelPull, "atlantis-test")).ThenReturn(true, nil) - When(projectCommandBuilder.BuildApplyCommands(matchers.AnyPtrToCommandContext(), matchers.AnyPtrToEventsCommentCommand())).Then(func(args []Param) ReturnValues { + When(projectCommandBuilder.BuildApplyCommands(Any[*command.Context](), Any[*events.CommentCommand]())).Then(func(args []Param) ReturnValues { return ReturnValues{ []command.ProjectContext{ { @@ -977,11 +969,11 @@ func TestRunApply_DiscardedProjects(t *testing.T) { } When(githubGetter.GetPullRequest(testdata.GithubRepo, testdata.Pull.Num)).ThenReturn(ghPull, nil) When(eventParsing.ParseGithubPull(ghPull)).ThenReturn(pull, pull.BaseRepo, testdata.GithubRepo, nil) - When(workingDir.GetPullDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())). + When(workingDir.GetPullDir(Any[models.Repo](), Any[models.PullRequest]())). ThenReturn(tmp, nil) ch.RunCommentCommand(testdata.GithubRepo, &testdata.GithubRepo, &pull, testdata.User, testdata.Pull.Num, &events.CommentCommand{Name: command.Apply}) - vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), vcsmatchers.AnyModelsPullRequestOptions()) + vcsClient.VerifyWasCalled(Never()).MergePull(Any[models.PullRequest](), Any[models.PullRequestOptions]()) } func TestRunCommentCommand_DrainOngoing(t *testing.T) { @@ -1013,8 +1005,8 @@ func TestRunAutoplanCommand_DrainNotOngoing(t *testing.T) { t.Log("if drain is not ongoing then remove ongoing operation must be called even if panic occurred") setup(t) testdata.Pull.BaseRepo = testdata.GithubRepo - When(projectCommandBuilder.BuildAutoplanCommands(matchers.AnyPtrToCommandContext())).ThenPanic("panic test - if you're seeing this in a test failure this isn't the failing test") + When(projectCommandBuilder.BuildAutoplanCommands(Any[*command.Context]())).ThenPanic("panic test - if you're seeing this in a test failure this isn't the failing test") ch.RunAutoplanCommand(testdata.GithubRepo, testdata.GithubRepo, testdata.Pull, testdata.User) - projectCommandBuilder.VerifyWasCalledOnce().BuildAutoplanCommands(matchers.AnyPtrToCommandContext()) + projectCommandBuilder.VerifyWasCalledOnce().BuildAutoplanCommands(Any[*command.Context]()) Equals(t, 0, drainer.GetStatus().InProgressOps) } diff --git a/server/events/comment_parser.go b/server/events/comment_parser.go index d2336102b..c4ec87bb6 100644 --- a/server/events/comment_parser.go +++ b/server/events/comment_parser.go @@ -54,7 +54,7 @@ const ( // and pasting GitHub comments. var multiLineRegex = regexp.MustCompile(`.*\r?\n[^\r\n]+`) -//go:generate pegomock generate -m --package mocks -o mocks/mock_comment_parsing.go CommentParsing +//go:generate pegomock generate --package mocks -o mocks/mock_comment_parsing.go CommentParsing // CommentParsing handles parsing pull request comments. type CommentParsing interface { @@ -63,7 +63,7 @@ type CommentParsing interface { Parse(comment string, vcsHost models.VCSHostType) CommentParseResult } -//go:generate pegomock generate -m --package mocks -o mocks/mock_comment_building.go CommentBuilder +//go:generate pegomock generate --package mocks -o mocks/mock_comment_building.go CommentBuilder // CommentBuilder builds comment commands that can be used on pull requests. type CommentBuilder interface { diff --git a/server/events/commit_status_updater.go b/server/events/commit_status_updater.go index e84023a9e..07c97b184 100644 --- a/server/events/commit_status_updater.go +++ b/server/events/commit_status_updater.go @@ -24,7 +24,7 @@ import ( "golang.org/x/text/language" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_commit_status_updater.go CommitStatusUpdater +//go:generate pegomock generate --package mocks -o mocks/mock_commit_status_updater.go CommitStatusUpdater // CommitStatusUpdater updates the status of a commit with the VCS host. We set // the status to signify whether the plan/apply succeeds. diff --git a/server/events/commit_status_updater_test.go b/server/events/commit_status_updater_test.go index 9461ca2d2..a84f1ced1 100644 --- a/server/events/commit_status_updater_test.go +++ b/server/events/commit_status_updater_test.go @@ -17,7 +17,7 @@ import ( "fmt" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/models" diff --git a/server/events/delete_lock_command.go b/server/events/delete_lock_command.go index 17f93332f..cf3eee8af 100644 --- a/server/events/delete_lock_command.go +++ b/server/events/delete_lock_command.go @@ -6,7 +6,7 @@ import ( "github.com/runatlantis/atlantis/server/logging" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_delete_lock_command.go DeleteLockCommand +//go:generate pegomock generate --package mocks -o mocks/mock_delete_lock_command.go DeleteLockCommand // DeleteLockCommand is the first step after a command request has been parsed. type DeleteLockCommand interface { diff --git a/server/events/delete_lock_command_test.go b/server/events/delete_lock_command_test.go index 19f6480fb..631ec629d 100644 --- a/server/events/delete_lock_command_test.go +++ b/server/events/delete_lock_command_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/db" lockmocks "github.com/runatlantis/atlantis/server/core/locking/mocks" "github.com/runatlantis/atlantis/server/events" diff --git a/server/events/event_parser.go b/server/events/event_parser.go index 48d4978ad..f759a4661 100644 --- a/server/events/event_parser.go +++ b/server/events/event_parser.go @@ -179,7 +179,7 @@ func NewCommentCommand(repoRelDir string, flags []string, name command.Name, sub } } -//go:generate pegomock generate -m --package mocks -o mocks/mock_event_parsing.go EventParsing +//go:generate pegomock generate --package mocks -o mocks/mock_event_parsing.go EventParsing // EventParsing parses webhook events from different VCS hosts into their // respective Atlantis models. diff --git a/server/events/github_app_working_dir_test.go b/server/events/github_app_working_dir_test.go index 7e0900379..80f462600 100644 --- a/server/events/github_app_working_dir_test.go +++ b/server/events/github_app_working_dir_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - . "github.com/petergtz/pegomock/v3" - pegomock "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" + pegomock "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/events" eventMocks "github.com/runatlantis/atlantis/server/events/mocks" "github.com/runatlantis/atlantis/server/events/models" diff --git a/server/events/import_command_runner_test.go b/server/events/import_command_runner_test.go index d1a9875f1..140fb8668 100644 --- a/server/events/import_command_runner_test.go +++ b/server/events/import_command_runner_test.go @@ -3,7 +3,7 @@ package events_test import ( "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/models" @@ -79,7 +79,7 @@ func TestImportCommandRunner_Run(t *testing.T) { Assert(t, ctx.PullRequestStatus.Mergeable == true, "PullRequestStatus must be set for import_requirements") if tt.expNoComment { - vcsClient.VerifyWasCalled(Never()).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } else { vcsClient.VerifyWasCalledOnce().CreateComment(testdata.GithubRepo, modelPull.Num, tt.expComment, "import") } diff --git a/server/events/matchers/logging_simplelogging.go b/server/events/matchers/logging_simplelogging.go deleted file mode 100644 index 6bb3b9ec9..000000000 --- a/server/events/matchers/logging_simplelogging.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - logging "github.com/runatlantis/atlantis/server/logging" -) - -func AnyLoggingSimpleLogging() logging.SimpleLogging { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem())) - var nullValue logging.SimpleLogging - return nullValue -} - -func EqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func NotEqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func LoggingSimpleLoggingThat(matcher pegomock.ArgumentMatcher) logging.SimpleLogging { - pegomock.RegisterMatcher(matcher) - var nullValue logging.SimpleLogging - return nullValue -} diff --git a/server/events/matchers/models_pullrequest.go b/server/events/matchers/models_pullrequest.go deleted file mode 100644 index 16b40e0e6..000000000 --- a/server/events/matchers/models_pullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullRequest() models.PullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullRequest))(nil)).Elem())) - var nullValue models.PullRequest - return nullValue -} - -func EqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func NotEqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func ModelsPullRequestThat(matcher pegomock.ArgumentMatcher) models.PullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullRequest - return nullValue -} diff --git a/server/events/matchers/models_repo.go b/server/events/matchers/models_repo.go deleted file mode 100644 index 0f0b59bbb..000000000 --- a/server/events/matchers/models_repo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsRepo() models.Repo { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.Repo))(nil)).Elem())) - var nullValue models.Repo - return nullValue -} - -func EqModelsRepo(value models.Repo) models.Repo { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.Repo - return nullValue -} - -func NotEqModelsRepo(value models.Repo) models.Repo { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.Repo - return nullValue -} - -func ModelsRepoThat(matcher pegomock.ArgumentMatcher) models.Repo { - pegomock.RegisterMatcher(matcher) - var nullValue models.Repo - return nullValue -} diff --git a/server/events/matchers/ptr_to_logging_simplelogger.go b/server/events/matchers/ptr_to_logging_simplelogger.go deleted file mode 100644 index 6ae3cbd4b..000000000 --- a/server/events/matchers/ptr_to_logging_simplelogger.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - logging "github.com/runatlantis/atlantis/server/logging" -) - -func EqPtrToLoggingSimpleLogger(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} diff --git a/server/events/mock_workingdir_test.go b/server/events/mock_workingdir_test.go index b25421b3d..d58fc4477 100644 --- a/server/events/mock_workingdir_test.go +++ b/server/events/mock_workingdir_test.go @@ -4,11 +4,12 @@ package events import ( - pegomock "github.com/petergtz/pegomock/v3" - models "github.com/runatlantis/atlantis/server/events/models" - logging "github.com/runatlantis/atlantis/server/logging" "reflect" "time" + + pegomock "github.com/petergtz/pegomock/v4" + models "github.com/runatlantis/atlantis/server/events/models" + logging "github.com/runatlantis/atlantis/server/logging" ) type MockWorkingDir struct { @@ -26,11 +27,11 @@ func NewMockWorkingDir(options ...pegomock.Option) *MockWorkingDir { func (mock *MockWorkingDir) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockWorkingDir) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockWorkingDir) Clone(_param0 logging.SimpleLogging, _param1 models.Repo, _param2 models.PullRequest, _param3 string) (string, bool, error) { +func (mock *MockWorkingDir) Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) (string, bool, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{log, headRepo, p, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("Clone", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 bool @@ -49,11 +50,11 @@ func (mock *MockWorkingDir) Clone(_param0 logging.SimpleLogging, _param1 models. return ret0, ret1, ret2 } -func (mock *MockWorkingDir) Delete(_param0 models.Repo, _param1 models.PullRequest) error { +func (mock *MockWorkingDir) Delete(r models.Repo, p models.PullRequest) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{r, p} result := pegomock.GetGenericMockFrom(mock).Invoke("Delete", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -64,11 +65,11 @@ func (mock *MockWorkingDir) Delete(_param0 models.Repo, _param1 models.PullReque return ret0 } -func (mock *MockWorkingDir) DeleteForWorkspace(_param0 models.Repo, _param1 models.PullRequest, _param2 string) error { +func (mock *MockWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{r, p, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("DeleteForWorkspace", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -79,11 +80,11 @@ func (mock *MockWorkingDir) DeleteForWorkspace(_param0 models.Repo, _param1 mode return ret0 } -func (mock *MockWorkingDir) GetPullDir(_param0 models.Repo, _param1 models.PullRequest) (string, error) { +func (mock *MockWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{r, p} result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullDir", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -98,11 +99,11 @@ func (mock *MockWorkingDir) GetPullDir(_param0 models.Repo, _param1 models.PullR return ret0, ret1 } -func (mock *MockWorkingDir) GetWorkingDir(_param0 models.Repo, _param1 models.PullRequest, _param2 string) (string, error) { +func (mock *MockWorkingDir) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{r, p, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("GetWorkingDir", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -117,11 +118,11 @@ func (mock *MockWorkingDir) GetWorkingDir(_param0 models.Repo, _param1 models.Pu return ret0, ret1 } -func (mock *MockWorkingDir) HasDiverged(_param0 logging.SimpleLogging, _param1 string) bool { +func (mock *MockWorkingDir) HasDiverged(log logging.SimpleLogging, cloneDir string) bool { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{log, cloneDir} result := pegomock.GetGenericMockFrom(mock).Invoke("HasDiverged", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()}) var ret0 bool if len(result) != 0 { @@ -177,8 +178,8 @@ type VerifierMockWorkingDir struct { timeout time.Duration } -func (verifier *VerifierMockWorkingDir) Clone(_param0 logging.SimpleLogging, _param1 models.Repo, _param2 models.PullRequest, _param3 string) *MockWorkingDir_Clone_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockWorkingDir) Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_Clone_OngoingVerification { + params := []pegomock.Param{log, headRepo, p, workspace} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Clone", params, verifier.timeout) return &MockWorkingDir_Clone_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -189,8 +190,8 @@ type MockWorkingDir_Clone_OngoingVerification struct { } func (c *MockWorkingDir_Clone_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, models.Repo, models.PullRequest, string) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + log, headRepo, p, workspace := c.GetAllCapturedArguments() + return log[len(log)-1], headRepo[len(headRepo)-1], p[len(p)-1], workspace[len(workspace)-1] } func (c *MockWorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []models.Repo, _param2 []models.PullRequest, _param3 []string) { @@ -216,8 +217,8 @@ func (c *MockWorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_p return } -func (verifier *VerifierMockWorkingDir) Delete(_param0 models.Repo, _param1 models.PullRequest) *MockWorkingDir_Delete_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockWorkingDir_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -228,8 +229,8 @@ type MockWorkingDir_Delete_OngoingVerification struct { } func (c *MockWorkingDir_Delete_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + r, p := c.GetAllCapturedArguments() + return r[len(r)-1], p[len(p)-1] } func (c *MockWorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { @@ -247,8 +248,8 @@ func (c *MockWorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_ return } -func (verifier *VerifierMockWorkingDir) DeleteForWorkspace(_param0 models.Repo, _param1 models.PullRequest, _param2 string) *MockWorkingDir_DeleteForWorkspace_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +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 &MockWorkingDir_DeleteForWorkspace_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -259,8 +260,8 @@ type MockWorkingDir_DeleteForWorkspace_OngoingVerification struct { } func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + r, p, workspace := c.GetAllCapturedArguments() + return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1] } func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) { @@ -282,8 +283,8 @@ func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedAr return } -func (verifier *VerifierMockWorkingDir) GetPullDir(_param0 models.Repo, _param1 models.PullRequest) *MockWorkingDir_GetPullDir_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockWorkingDir_GetPullDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -294,8 +295,8 @@ type MockWorkingDir_GetPullDir_OngoingVerification struct { } func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + r, p := c.GetAllCapturedArguments() + return r[len(r)-1], p[len(p)-1] } func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { @@ -313,8 +314,8 @@ func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments( return } -func (verifier *VerifierMockWorkingDir) GetWorkingDir(_param0 models.Repo, _param1 models.PullRequest, _param2 string) *MockWorkingDir_GetWorkingDir_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +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 &MockWorkingDir_GetWorkingDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -325,8 +326,8 @@ type MockWorkingDir_GetWorkingDir_OngoingVerification struct { } func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + r, p, workspace := c.GetAllCapturedArguments() + return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1] } func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) { @@ -348,8 +349,8 @@ func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArgumen return } -func (verifier *VerifierMockWorkingDir) HasDiverged(_param0 logging.SimpleLogging, _param1 string) *MockWorkingDir_HasDiverged_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockWorkingDir) HasDiverged(log logging.SimpleLogging, cloneDir string) *MockWorkingDir_HasDiverged_OngoingVerification { + params := []pegomock.Param{log, cloneDir} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasDiverged", params, verifier.timeout) return &MockWorkingDir_HasDiverged_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -360,8 +361,8 @@ type MockWorkingDir_HasDiverged_OngoingVerification struct { } func (c *MockWorkingDir_HasDiverged_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + log, cloneDir := c.GetAllCapturedArguments() + return log[len(log)-1], cloneDir[len(cloneDir)-1] } func (c *MockWorkingDir_HasDiverged_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []string) { diff --git a/server/events/mocks/matchers/azuredevops_event.go b/server/events/mocks/matchers/azuredevops_event.go deleted file mode 100644 index b14e942b9..000000000 --- a/server/events/mocks/matchers/azuredevops_event.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - azuredevops "github.com/mcdafydd/go-azuredevops/azuredevops" -) - -func AnyAzuredevopsEvent() azuredevops.Event { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(azuredevops.Event))(nil)).Elem())) - var nullValue azuredevops.Event - return nullValue -} - -func EqAzuredevopsEvent(value azuredevops.Event) azuredevops.Event { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue azuredevops.Event - return nullValue -} - -func NotEqAzuredevopsEvent(value azuredevops.Event) azuredevops.Event { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue azuredevops.Event - return nullValue -} - -func AzuredevopsEventThat(matcher pegomock.ArgumentMatcher) azuredevops.Event { - pegomock.RegisterMatcher(matcher) - var nullValue azuredevops.Event - return nullValue -} diff --git a/server/events/mocks/matchers/command_name.go b/server/events/mocks/matchers/command_name.go deleted file mode 100644 index f0c39dc39..000000000 --- a/server/events/mocks/matchers/command_name.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandName() command.Name { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.Name))(nil)).Elem())) - var nullValue command.Name - return nullValue -} - -func EqCommandName(value command.Name) command.Name { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.Name - return nullValue -} - -func NotEqCommandName(value command.Name) command.Name { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.Name - return nullValue -} - -func CommandNameThat(matcher pegomock.ArgumentMatcher) command.Name { - pegomock.RegisterMatcher(matcher) - var nullValue command.Name - return nullValue -} diff --git a/server/events/mocks/matchers/command_projectcontext.go b/server/events/mocks/matchers/command_projectcontext.go deleted file mode 100644 index 53929afd5..000000000 --- a/server/events/mocks/matchers/command_projectcontext.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandProjectContext() command.ProjectContext { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectContext))(nil)).Elem())) - var nullValue command.ProjectContext - return nullValue -} - -func EqCommandProjectContext(value command.ProjectContext) command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.ProjectContext - return nullValue -} - -func NotEqCommandProjectContext(value command.ProjectContext) command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.ProjectContext - return nullValue -} - -func CommandProjectContextThat(matcher pegomock.ArgumentMatcher) command.ProjectContext { - pegomock.RegisterMatcher(matcher) - var nullValue command.ProjectContext - return nullValue -} diff --git a/server/events/mocks/matchers/command_projectresult.go b/server/events/mocks/matchers/command_projectresult.go deleted file mode 100644 index c4a59f8b3..000000000 --- a/server/events/mocks/matchers/command_projectresult.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandProjectResult() command.ProjectResult { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectResult))(nil)).Elem())) - var nullValue command.ProjectResult - return nullValue -} - -func EqCommandProjectResult(value command.ProjectResult) command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.ProjectResult - return nullValue -} - -func NotEqCommandProjectResult(value command.ProjectResult) command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.ProjectResult - return nullValue -} - -func CommandProjectResultThat(matcher pegomock.ArgumentMatcher) command.ProjectResult { - pegomock.RegisterMatcher(matcher) - var nullValue command.ProjectResult - return nullValue -} diff --git a/server/events/mocks/matchers/events_commentparseresult.go b/server/events/mocks/matchers/events_commentparseresult.go deleted file mode 100644 index 4f0ea32ba..000000000 --- a/server/events/mocks/matchers/events_commentparseresult.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - events "github.com/runatlantis/atlantis/server/events" -) - -func AnyEventsCommentParseResult() events.CommentParseResult { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(events.CommentParseResult))(nil)).Elem())) - var nullValue events.CommentParseResult - return nullValue -} - -func EqEventsCommentParseResult(value events.CommentParseResult) events.CommentParseResult { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue events.CommentParseResult - return nullValue -} - -func NotEqEventsCommentParseResult(value events.CommentParseResult) events.CommentParseResult { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue events.CommentParseResult - return nullValue -} - -func EventsCommentParseResultThat(matcher pegomock.ArgumentMatcher) events.CommentParseResult { - pegomock.RegisterMatcher(matcher) - var nullValue events.CommentParseResult - return nullValue -} diff --git a/server/events/mocks/matchers/go_gitlab_mergecommentevent.go b/server/events/mocks/matchers/go_gitlab_mergecommentevent.go deleted file mode 100644 index 26ecafdf6..000000000 --- a/server/events/mocks/matchers/go_gitlab_mergecommentevent.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - go_gitlab "github.com/xanzy/go-gitlab" -) - -func AnyGoGitlabMergeCommentEvent() go_gitlab.MergeCommentEvent { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(go_gitlab.MergeCommentEvent))(nil)).Elem())) - var nullValue go_gitlab.MergeCommentEvent - return nullValue -} - -func EqGoGitlabMergeCommentEvent(value go_gitlab.MergeCommentEvent) go_gitlab.MergeCommentEvent { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue go_gitlab.MergeCommentEvent - return nullValue -} - -func NotEqGoGitlabMergeCommentEvent(value go_gitlab.MergeCommentEvent) go_gitlab.MergeCommentEvent { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue go_gitlab.MergeCommentEvent - return nullValue -} - -func GoGitlabMergeCommentEventThat(matcher pegomock.ArgumentMatcher) go_gitlab.MergeCommentEvent { - pegomock.RegisterMatcher(matcher) - var nullValue go_gitlab.MergeCommentEvent - return nullValue -} diff --git a/server/events/mocks/matchers/go_gitlab_mergeevent.go b/server/events/mocks/matchers/go_gitlab_mergeevent.go deleted file mode 100644 index 868bc4c30..000000000 --- a/server/events/mocks/matchers/go_gitlab_mergeevent.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - go_gitlab "github.com/xanzy/go-gitlab" -) - -func AnyGoGitlabMergeEvent() go_gitlab.MergeEvent { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(go_gitlab.MergeEvent))(nil)).Elem())) - var nullValue go_gitlab.MergeEvent - return nullValue -} - -func EqGoGitlabMergeEvent(value go_gitlab.MergeEvent) go_gitlab.MergeEvent { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue go_gitlab.MergeEvent - return nullValue -} - -func NotEqGoGitlabMergeEvent(value go_gitlab.MergeEvent) go_gitlab.MergeEvent { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue go_gitlab.MergeEvent - return nullValue -} - -func GoGitlabMergeEventThat(matcher pegomock.ArgumentMatcher) go_gitlab.MergeEvent { - pegomock.RegisterMatcher(matcher) - var nullValue go_gitlab.MergeEvent - return nullValue -} diff --git a/server/events/mocks/matchers/jobs_pullinfo.go b/server/events/mocks/matchers/jobs_pullinfo.go deleted file mode 100644 index c635381a6..000000000 --- a/server/events/mocks/matchers/jobs_pullinfo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - jobs "github.com/runatlantis/atlantis/server/jobs" -) - -func AnyJobsPullInfo() jobs.PullInfo { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(jobs.PullInfo))(nil)).Elem())) - var nullValue jobs.PullInfo - return nullValue -} - -func EqJobsPullInfo(value jobs.PullInfo) jobs.PullInfo { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue jobs.PullInfo - return nullValue -} - -func NotEqJobsPullInfo(value jobs.PullInfo) jobs.PullInfo { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue jobs.PullInfo - return nullValue -} - -func JobsPullInfoThat(matcher pegomock.ArgumentMatcher) jobs.PullInfo { - pegomock.RegisterMatcher(matcher) - var nullValue jobs.PullInfo - return nullValue -} diff --git a/server/events/mocks/matchers/logging_simplelogging.go b/server/events/mocks/matchers/logging_simplelogging.go deleted file mode 100644 index 6bb3b9ec9..000000000 --- a/server/events/mocks/matchers/logging_simplelogging.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - logging "github.com/runatlantis/atlantis/server/logging" -) - -func AnyLoggingSimpleLogging() logging.SimpleLogging { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem())) - var nullValue logging.SimpleLogging - return nullValue -} - -func EqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func NotEqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func LoggingSimpleLoggingThat(matcher pegomock.ArgumentMatcher) logging.SimpleLogging { - pegomock.RegisterMatcher(matcher) - var nullValue logging.SimpleLogging - return nullValue -} diff --git a/server/events/mocks/matchers/map_of_string_to_string.go b/server/events/mocks/matchers/map_of_string_to_string.go deleted file mode 100644 index dacd5d8ae..000000000 --- a/server/events/mocks/matchers/map_of_string_to_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnyMapOfStringToString() map[string]string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(map[string]string))(nil)).Elem())) - var nullValue map[string]string - return nullValue -} - -func EqMapOfStringToString(value map[string]string) map[string]string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue map[string]string - return nullValue -} - -func NotEqMapOfStringToString(value map[string]string) map[string]string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue map[string]string - return nullValue -} - -func MapOfStringToStringThat(matcher pegomock.ArgumentMatcher) map[string]string { - pegomock.RegisterMatcher(matcher) - var nullValue map[string]string - return nullValue -} diff --git a/server/events/mocks/matchers/models_commitstatus.go b/server/events/mocks/matchers/models_commitstatus.go deleted file mode 100644 index f72ee4dc8..000000000 --- a/server/events/mocks/matchers/models_commitstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsCommitStatus() models.CommitStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.CommitStatus))(nil)).Elem())) - var nullValue models.CommitStatus - return nullValue -} - -func EqModelsCommitStatus(value models.CommitStatus) models.CommitStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.CommitStatus - return nullValue -} - -func NotEqModelsCommitStatus(value models.CommitStatus) models.CommitStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.CommitStatus - return nullValue -} - -func ModelsCommitStatusThat(matcher pegomock.ArgumentMatcher) models.CommitStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.CommitStatus - return nullValue -} diff --git a/server/events/mocks/matchers/models_project.go b/server/events/mocks/matchers/models_project.go deleted file mode 100644 index 5366370f1..000000000 --- a/server/events/mocks/matchers/models_project.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsProject() models.Project { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.Project))(nil)).Elem())) - var nullValue models.Project - return nullValue -} - -func EqModelsProject(value models.Project) models.Project { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.Project - return nullValue -} - -func NotEqModelsProject(value models.Project) models.Project { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.Project - return nullValue -} - -func ModelsProjectThat(matcher pegomock.ArgumentMatcher) models.Project { - pegomock.RegisterMatcher(matcher) - var nullValue models.Project - return nullValue -} diff --git a/server/events/mocks/matchers/models_pullrequest.go b/server/events/mocks/matchers/models_pullrequest.go deleted file mode 100644 index 16b40e0e6..000000000 --- a/server/events/mocks/matchers/models_pullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullRequest() models.PullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullRequest))(nil)).Elem())) - var nullValue models.PullRequest - return nullValue -} - -func EqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func NotEqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func ModelsPullRequestThat(matcher pegomock.ArgumentMatcher) models.PullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullRequest - return nullValue -} diff --git a/server/events/mocks/matchers/models_pullrequesteventtype.go b/server/events/mocks/matchers/models_pullrequesteventtype.go deleted file mode 100644 index 1ca7c1be0..000000000 --- a/server/events/mocks/matchers/models_pullrequesteventtype.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullRequestEventType() models.PullRequestEventType { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullRequestEventType))(nil)).Elem())) - var nullValue models.PullRequestEventType - return nullValue -} - -func EqModelsPullRequestEventType(value models.PullRequestEventType) models.PullRequestEventType { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullRequestEventType - return nullValue -} - -func NotEqModelsPullRequestEventType(value models.PullRequestEventType) models.PullRequestEventType { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullRequestEventType - return nullValue -} - -func ModelsPullRequestEventTypeThat(matcher pegomock.ArgumentMatcher) models.PullRequestEventType { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullRequestEventType - return nullValue -} diff --git a/server/events/mocks/matchers/models_repo.go b/server/events/mocks/matchers/models_repo.go deleted file mode 100644 index 0f0b59bbb..000000000 --- a/server/events/mocks/matchers/models_repo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsRepo() models.Repo { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.Repo))(nil)).Elem())) - var nullValue models.Repo - return nullValue -} - -func EqModelsRepo(value models.Repo) models.Repo { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.Repo - return nullValue -} - -func NotEqModelsRepo(value models.Repo) models.Repo { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.Repo - return nullValue -} - -func ModelsRepoThat(matcher pegomock.ArgumentMatcher) models.Repo { - pegomock.RegisterMatcher(matcher) - var nullValue models.Repo - return nullValue -} diff --git a/server/events/mocks/matchers/models_user.go b/server/events/mocks/matchers/models_user.go deleted file mode 100644 index 958cb1e83..000000000 --- a/server/events/mocks/matchers/models_user.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsUser() models.User { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.User))(nil)).Elem())) - var nullValue models.User - return nullValue -} - -func EqModelsUser(value models.User) models.User { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.User - return nullValue -} - -func NotEqModelsUser(value models.User) models.User { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.User - return nullValue -} - -func ModelsUserThat(matcher pegomock.ArgumentMatcher) models.User { - pegomock.RegisterMatcher(matcher) - var nullValue models.User - return nullValue -} diff --git a/server/events/mocks/matchers/models_vcshosttype.go b/server/events/mocks/matchers/models_vcshosttype.go deleted file mode 100644 index ffec7628e..000000000 --- a/server/events/mocks/matchers/models_vcshosttype.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsVCSHostType() models.VCSHostType { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.VCSHostType))(nil)).Elem())) - var nullValue models.VCSHostType - return nullValue -} - -func EqModelsVCSHostType(value models.VCSHostType) models.VCSHostType { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.VCSHostType - return nullValue -} - -func NotEqModelsVCSHostType(value models.VCSHostType) models.VCSHostType { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.VCSHostType - return nullValue -} - -func ModelsVCSHostTypeThat(matcher pegomock.ArgumentMatcher) models.VCSHostType { - pegomock.RegisterMatcher(matcher) - var nullValue models.VCSHostType - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_azuredevops_gitpullrequest.go b/server/events/mocks/matchers/ptr_to_azuredevops_gitpullrequest.go deleted file mode 100644 index b3f66b396..000000000 --- a/server/events/mocks/matchers/ptr_to_azuredevops_gitpullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - azuredevops "github.com/mcdafydd/go-azuredevops/azuredevops" -) - -func AnyPtrToAzuredevopsGitPullRequest() *azuredevops.GitPullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*azuredevops.GitPullRequest))(nil)).Elem())) - var nullValue *azuredevops.GitPullRequest - return nullValue -} - -func EqPtrToAzuredevopsGitPullRequest(value *azuredevops.GitPullRequest) *azuredevops.GitPullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *azuredevops.GitPullRequest - return nullValue -} - -func NotEqPtrToAzuredevopsGitPullRequest(value *azuredevops.GitPullRequest) *azuredevops.GitPullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *azuredevops.GitPullRequest - return nullValue -} - -func PtrToAzuredevopsGitPullRequestThat(matcher pegomock.ArgumentMatcher) *azuredevops.GitPullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue *azuredevops.GitPullRequest - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_azuredevops_gitrepository.go b/server/events/mocks/matchers/ptr_to_azuredevops_gitrepository.go deleted file mode 100644 index 7670479a3..000000000 --- a/server/events/mocks/matchers/ptr_to_azuredevops_gitrepository.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - azuredevops "github.com/mcdafydd/go-azuredevops/azuredevops" -) - -func AnyPtrToAzuredevopsGitRepository() *azuredevops.GitRepository { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*azuredevops.GitRepository))(nil)).Elem())) - var nullValue *azuredevops.GitRepository - return nullValue -} - -func EqPtrToAzuredevopsGitRepository(value *azuredevops.GitRepository) *azuredevops.GitRepository { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *azuredevops.GitRepository - return nullValue -} - -func NotEqPtrToAzuredevopsGitRepository(value *azuredevops.GitRepository) *azuredevops.GitRepository { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *azuredevops.GitRepository - return nullValue -} - -func PtrToAzuredevopsGitRepositoryThat(matcher pegomock.ArgumentMatcher) *azuredevops.GitRepository { - pegomock.RegisterMatcher(matcher) - var nullValue *azuredevops.GitRepository - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_command_context.go b/server/events/mocks/matchers/ptr_to_command_context.go deleted file mode 100644 index 46b522ef3..000000000 --- a/server/events/mocks/matchers/ptr_to_command_context.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyPtrToCommandContext() *command.Context { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*command.Context))(nil)).Elem())) - var nullValue *command.Context - return nullValue -} - -func EqPtrToCommandContext(value *command.Context) *command.Context { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *command.Context - return nullValue -} - -func NotEqPtrToCommandContext(value *command.Context) *command.Context { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *command.Context - return nullValue -} - -func PtrToCommandContextThat(matcher pegomock.ArgumentMatcher) *command.Context { - pegomock.RegisterMatcher(matcher) - var nullValue *command.Context - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_command_projectresult.go b/server/events/mocks/matchers/ptr_to_command_projectresult.go deleted file mode 100644 index ca9d37187..000000000 --- a/server/events/mocks/matchers/ptr_to_command_projectresult.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyPtrToCommandProjectResult() *command.ProjectResult { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*command.ProjectResult))(nil)).Elem())) - var nullValue *command.ProjectResult - return nullValue -} - -func EqPtrToCommandProjectResult(value *command.ProjectResult) *command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *command.ProjectResult - return nullValue -} - -func NotEqPtrToCommandProjectResult(value *command.ProjectResult) *command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *command.ProjectResult - return nullValue -} - -func PtrToCommandProjectResultThat(matcher pegomock.ArgumentMatcher) *command.ProjectResult { - pegomock.RegisterMatcher(matcher) - var nullValue *command.ProjectResult - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_events_commentcommand.go b/server/events/mocks/matchers/ptr_to_events_commentcommand.go deleted file mode 100644 index 44d3c879d..000000000 --- a/server/events/mocks/matchers/ptr_to_events_commentcommand.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - events "github.com/runatlantis/atlantis/server/events" -) - -func AnyPtrToEventsCommentCommand() *events.CommentCommand { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*events.CommentCommand))(nil)).Elem())) - var nullValue *events.CommentCommand - return nullValue -} - -func EqPtrToEventsCommentCommand(value *events.CommentCommand) *events.CommentCommand { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *events.CommentCommand - return nullValue -} - -func NotEqPtrToEventsCommentCommand(value *events.CommentCommand) *events.CommentCommand { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *events.CommentCommand - return nullValue -} - -func PtrToEventsCommentCommandThat(matcher pegomock.ArgumentMatcher) *events.CommentCommand { - pegomock.RegisterMatcher(matcher) - var nullValue *events.CommentCommand - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_events_trylockresponse.go b/server/events/mocks/matchers/ptr_to_events_trylockresponse.go deleted file mode 100644 index 21ac6c12d..000000000 --- a/server/events/mocks/matchers/ptr_to_events_trylockresponse.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - events "github.com/runatlantis/atlantis/server/events" -) - -func AnyPtrToEventsTryLockResponse() *events.TryLockResponse { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*events.TryLockResponse))(nil)).Elem())) - var nullValue *events.TryLockResponse - return nullValue -} - -func EqPtrToEventsTryLockResponse(value *events.TryLockResponse) *events.TryLockResponse { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *events.TryLockResponse - return nullValue -} - -func NotEqPtrToEventsTryLockResponse(value *events.TryLockResponse) *events.TryLockResponse { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *events.TryLockResponse - return nullValue -} - -func PtrToEventsTryLockResponseThat(matcher pegomock.ArgumentMatcher) *events.TryLockResponse { - pegomock.RegisterMatcher(matcher) - var nullValue *events.TryLockResponse - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_github_issuecommentevent.go b/server/events/mocks/matchers/ptr_to_github_issuecommentevent.go deleted file mode 100644 index f5f8eaf1c..000000000 --- a/server/events/mocks/matchers/ptr_to_github_issuecommentevent.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - github "github.com/google/go-github/v53/github" -) - -func AnyPtrToGithubIssueCommentEvent() *github.IssueCommentEvent { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*github.IssueCommentEvent))(nil)).Elem())) - var nullValue *github.IssueCommentEvent - return nullValue -} - -func EqPtrToGithubIssueCommentEvent(value *github.IssueCommentEvent) *github.IssueCommentEvent { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *github.IssueCommentEvent - return nullValue -} - -func NotEqPtrToGithubIssueCommentEvent(value *github.IssueCommentEvent) *github.IssueCommentEvent { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *github.IssueCommentEvent - return nullValue -} - -func PtrToGithubIssueCommentEventThat(matcher pegomock.ArgumentMatcher) *github.IssueCommentEvent { - pegomock.RegisterMatcher(matcher) - var nullValue *github.IssueCommentEvent - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_github_pullrequest.go b/server/events/mocks/matchers/ptr_to_github_pullrequest.go deleted file mode 100644 index 39dc3e9aa..000000000 --- a/server/events/mocks/matchers/ptr_to_github_pullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - github "github.com/google/go-github/v53/github" -) - -func AnyPtrToGithubPullRequest() *github.PullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*github.PullRequest))(nil)).Elem())) - var nullValue *github.PullRequest - return nullValue -} - -func EqPtrToGithubPullRequest(value *github.PullRequest) *github.PullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *github.PullRequest - return nullValue -} - -func NotEqPtrToGithubPullRequest(value *github.PullRequest) *github.PullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *github.PullRequest - return nullValue -} - -func PtrToGithubPullRequestThat(matcher pegomock.ArgumentMatcher) *github.PullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue *github.PullRequest - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_github_pullrequestevent.go b/server/events/mocks/matchers/ptr_to_github_pullrequestevent.go deleted file mode 100644 index 473f43a99..000000000 --- a/server/events/mocks/matchers/ptr_to_github_pullrequestevent.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - github "github.com/google/go-github/v53/github" -) - -func AnyPtrToGithubPullRequestEvent() *github.PullRequestEvent { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*github.PullRequestEvent))(nil)).Elem())) - var nullValue *github.PullRequestEvent - return nullValue -} - -func EqPtrToGithubPullRequestEvent(value *github.PullRequestEvent) *github.PullRequestEvent { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *github.PullRequestEvent - return nullValue -} - -func NotEqPtrToGithubPullRequestEvent(value *github.PullRequestEvent) *github.PullRequestEvent { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *github.PullRequestEvent - return nullValue -} - -func PtrToGithubPullRequestEventThat(matcher pegomock.ArgumentMatcher) *github.PullRequestEvent { - pegomock.RegisterMatcher(matcher) - var nullValue *github.PullRequestEvent - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_github_repository.go b/server/events/mocks/matchers/ptr_to_github_repository.go deleted file mode 100644 index a92f2dc02..000000000 --- a/server/events/mocks/matchers/ptr_to_github_repository.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - github "github.com/google/go-github/v53/github" -) - -func AnyPtrToGithubRepository() *github.Repository { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*github.Repository))(nil)).Elem())) - var nullValue *github.Repository - return nullValue -} - -func EqPtrToGithubRepository(value *github.Repository) *github.Repository { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *github.Repository - return nullValue -} - -func NotEqPtrToGithubRepository(value *github.Repository) *github.Repository { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *github.Repository - return nullValue -} - -func PtrToGithubRepositoryThat(matcher pegomock.ArgumentMatcher) *github.Repository { - pegomock.RegisterMatcher(matcher) - var nullValue *github.Repository - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_go_gitlab_mergerequest.go b/server/events/mocks/matchers/ptr_to_go_gitlab_mergerequest.go deleted file mode 100644 index 308f60692..000000000 --- a/server/events/mocks/matchers/ptr_to_go_gitlab_mergerequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - go_gitlab "github.com/xanzy/go-gitlab" -) - -func AnyPtrToGoGitlabMergeRequest() *go_gitlab.MergeRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*go_gitlab.MergeRequest))(nil)).Elem())) - var nullValue *go_gitlab.MergeRequest - return nullValue -} - -func EqPtrToGoGitlabMergeRequest(value *go_gitlab.MergeRequest) *go_gitlab.MergeRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *go_gitlab.MergeRequest - return nullValue -} - -func NotEqPtrToGoGitlabMergeRequest(value *go_gitlab.MergeRequest) *go_gitlab.MergeRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *go_gitlab.MergeRequest - return nullValue -} - -func PtrToGoGitlabMergeRequestThat(matcher pegomock.ArgumentMatcher) *go_gitlab.MergeRequest { - pegomock.RegisterMatcher(matcher) - var nullValue *go_gitlab.MergeRequest - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_models_projectlock.go b/server/events/mocks/matchers/ptr_to_models_projectlock.go deleted file mode 100644 index ec5ccf148..000000000 --- a/server/events/mocks/matchers/ptr_to_models_projectlock.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyPtrToModelsProjectLock() *models.ProjectLock { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*models.ProjectLock))(nil)).Elem())) - var nullValue *models.ProjectLock - return nullValue -} - -func EqPtrToModelsProjectLock(value *models.ProjectLock) *models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *models.ProjectLock - return nullValue -} - -func NotEqPtrToModelsProjectLock(value *models.ProjectLock) *models.ProjectLock { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *models.ProjectLock - return nullValue -} - -func PtrToModelsProjectLockThat(matcher pegomock.ArgumentMatcher) *models.ProjectLock { - pegomock.RegisterMatcher(matcher) - var nullValue *models.ProjectLock - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_models_pullrequest.go b/server/events/mocks/matchers/ptr_to_models_pullrequest.go deleted file mode 100644 index 33124267f..000000000 --- a/server/events/mocks/matchers/ptr_to_models_pullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyPtrToModelsPullRequest() *models.PullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*models.PullRequest))(nil)).Elem())) - var nullValue *models.PullRequest - return nullValue -} - -func EqPtrToModelsPullRequest(value *models.PullRequest) *models.PullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *models.PullRequest - return nullValue -} - -func NotEqPtrToModelsPullRequest(value *models.PullRequest) *models.PullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *models.PullRequest - return nullValue -} - -func PtrToModelsPullRequestThat(matcher pegomock.ArgumentMatcher) *models.PullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue *models.PullRequest - return nullValue -} diff --git a/server/events/mocks/matchers/ptr_to_models_repo.go b/server/events/mocks/matchers/ptr_to_models_repo.go deleted file mode 100644 index fa45edbed..000000000 --- a/server/events/mocks/matchers/ptr_to_models_repo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyPtrToModelsRepo() *models.Repo { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*models.Repo))(nil)).Elem())) - var nullValue *models.Repo - return nullValue -} - -func EqPtrToModelsRepo(value *models.Repo) *models.Repo { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *models.Repo - return nullValue -} - -func NotEqPtrToModelsRepo(value *models.Repo) *models.Repo { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *models.Repo - return nullValue -} - -func PtrToModelsRepoThat(matcher pegomock.ArgumentMatcher) *models.Repo { - pegomock.RegisterMatcher(matcher) - var nullValue *models.Repo - return nullValue -} diff --git a/server/events/mocks/matchers/slice_of_byte.go b/server/events/mocks/matchers/slice_of_byte.go deleted file mode 100644 index b71a45767..000000000 --- a/server/events/mocks/matchers/slice_of_byte.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySliceOfByte() []byte { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]byte))(nil)).Elem())) - var nullValue []byte - return nullValue -} - -func EqSliceOfByte(value []byte) []byte { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []byte - return nullValue -} - -func NotEqSliceOfByte(value []byte) []byte { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []byte - return nullValue -} - -func SliceOfByteThat(matcher pegomock.ArgumentMatcher) []byte { - pegomock.RegisterMatcher(matcher) - var nullValue []byte - return nullValue -} diff --git a/server/events/mocks/matchers/slice_of_command_projectcontext.go b/server/events/mocks/matchers/slice_of_command_projectcontext.go deleted file mode 100644 index 9e6922ffb..000000000 --- a/server/events/mocks/matchers/slice_of_command_projectcontext.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnySliceOfCommandProjectContext() []command.ProjectContext { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]command.ProjectContext))(nil)).Elem())) - var nullValue []command.ProjectContext - return nullValue -} - -func EqSliceOfCommandProjectContext(value []command.ProjectContext) []command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []command.ProjectContext - return nullValue -} - -func NotEqSliceOfCommandProjectContext(value []command.ProjectContext) []command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []command.ProjectContext - return nullValue -} - -func SliceOfCommandProjectContextThat(matcher pegomock.ArgumentMatcher) []command.ProjectContext { - pegomock.RegisterMatcher(matcher) - var nullValue []command.ProjectContext - return nullValue -} diff --git a/server/events/mocks/matchers/slice_of_events_pendingplan.go b/server/events/mocks/matchers/slice_of_events_pendingplan.go deleted file mode 100644 index ebfadd5ff..000000000 --- a/server/events/mocks/matchers/slice_of_events_pendingplan.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - events "github.com/runatlantis/atlantis/server/events" -) - -func AnySliceOfEventsPendingPlan() []events.PendingPlan { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]events.PendingPlan))(nil)).Elem())) - var nullValue []events.PendingPlan - return nullValue -} - -func EqSliceOfEventsPendingPlan(value []events.PendingPlan) []events.PendingPlan { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []events.PendingPlan - return nullValue -} - -func NotEqSliceOfEventsPendingPlan(value []events.PendingPlan) []events.PendingPlan { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []events.PendingPlan - return nullValue -} - -func SliceOfEventsPendingPlanThat(matcher pegomock.ArgumentMatcher) []events.PendingPlan { - pegomock.RegisterMatcher(matcher) - var nullValue []events.PendingPlan - return nullValue -} diff --git a/server/events/mocks/matchers/slice_of_string.go b/server/events/mocks/matchers/slice_of_string.go deleted file mode 100644 index 96b18dd8b..000000000 --- a/server/events/mocks/matchers/slice_of_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySliceOfString() []string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]string))(nil)).Elem())) - var nullValue []string - return nullValue -} - -func EqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func NotEqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func SliceOfStringThat(matcher pegomock.ArgumentMatcher) []string { - pegomock.RegisterMatcher(matcher) - var nullValue []string - return nullValue -} diff --git a/server/events/mocks/matchers/webhooks_applyresult.go b/server/events/mocks/matchers/webhooks_applyresult.go deleted file mode 100644 index 8d884a5f2..000000000 --- a/server/events/mocks/matchers/webhooks_applyresult.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - webhooks "github.com/runatlantis/atlantis/server/events/webhooks" -) - -func AnyWebhooksApplyResult() webhooks.ApplyResult { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(webhooks.ApplyResult))(nil)).Elem())) - var nullValue webhooks.ApplyResult - return nullValue -} - -func EqWebhooksApplyResult(value webhooks.ApplyResult) webhooks.ApplyResult { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue webhooks.ApplyResult - return nullValue -} - -func NotEqWebhooksApplyResult(value webhooks.ApplyResult) webhooks.ApplyResult { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue webhooks.ApplyResult - return nullValue -} - -func WebhooksApplyResultThat(matcher pegomock.ArgumentMatcher) webhooks.ApplyResult { - pegomock.RegisterMatcher(matcher) - var nullValue webhooks.ApplyResult - return nullValue -} diff --git a/server/events/mocks/mock_azuredevops_pull_getter.go b/server/events/mocks/mock_azuredevops_pull_getter.go index 0d4fff7e7..ce3a618b8 100644 --- a/server/events/mocks/mock_azuredevops_pull_getter.go +++ b/server/events/mocks/mock_azuredevops_pull_getter.go @@ -5,7 +5,7 @@ package mocks import ( azuredevops "github.com/mcdafydd/go-azuredevops/azuredevops" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -26,11 +26,11 @@ func NewMockAzureDevopsPullGetter(options ...pegomock.Option) *MockAzureDevopsPu func (mock *MockAzureDevopsPullGetter) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockAzureDevopsPullGetter) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockAzureDevopsPullGetter) GetPullRequest(_param0 models.Repo, _param1 int) (*azuredevops.GitPullRequest, error) { +func (mock *MockAzureDevopsPullGetter) GetPullRequest(repo models.Repo, pullNum int) (*azuredevops.GitPullRequest, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockAzureDevopsPullGetter().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repo, pullNum} result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullRequest", params, []reflect.Type{reflect.TypeOf((**azuredevops.GitPullRequest)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *azuredevops.GitPullRequest var ret1 error @@ -82,8 +82,8 @@ type VerifierMockAzureDevopsPullGetter struct { timeout time.Duration } -func (verifier *VerifierMockAzureDevopsPullGetter) GetPullRequest(_param0 models.Repo, _param1 int) *MockAzureDevopsPullGetter_GetPullRequest_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockAzureDevopsPullGetter) GetPullRequest(repo models.Repo, pullNum int) *MockAzureDevopsPullGetter_GetPullRequest_OngoingVerification { + params := []pegomock.Param{repo, pullNum} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullRequest", params, verifier.timeout) return &MockAzureDevopsPullGetter_GetPullRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -94,8 +94,8 @@ type MockAzureDevopsPullGetter_GetPullRequest_OngoingVerification struct { } func (c *MockAzureDevopsPullGetter_GetPullRequest_OngoingVerification) GetCapturedArguments() (models.Repo, int) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repo, pullNum := c.GetAllCapturedArguments() + return repo[len(repo)-1], pullNum[len(pullNum)-1] } func (c *MockAzureDevopsPullGetter_GetPullRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int) { diff --git a/server/events/mocks/mock_command_requirement_handler.go b/server/events/mocks/mock_command_requirement_handler.go index 152b356da..8b6dd3c77 100644 --- a/server/events/mocks/mock_command_requirement_handler.go +++ b/server/events/mocks/mock_command_requirement_handler.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockCommandRequirementHandler(options ...pegomock.Option) *MockCommandRe func (mock *MockCommandRequirementHandler) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockCommandRequirementHandler) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockCommandRequirementHandler) ValidateApplyProject(_param0 string, _param1 command.ProjectContext) (string, error) { +func (mock *MockCommandRequirementHandler) ValidateApplyProject(repoDir string, ctx command.ProjectContext) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommandRequirementHandler().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repoDir, ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("ValidateApplyProject", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -44,11 +44,11 @@ func (mock *MockCommandRequirementHandler) ValidateApplyProject(_param0 string, return ret0, ret1 } -func (mock *MockCommandRequirementHandler) ValidateImportProject(_param0 string, _param1 command.ProjectContext) (string, error) { +func (mock *MockCommandRequirementHandler) ValidateImportProject(repoDir string, ctx command.ProjectContext) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommandRequirementHandler().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repoDir, ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("ValidateImportProject", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -63,11 +63,11 @@ func (mock *MockCommandRequirementHandler) ValidateImportProject(_param0 string, return ret0, ret1 } -func (mock *MockCommandRequirementHandler) ValidatePlanProject(_param0 string, _param1 command.ProjectContext) (string, error) { +func (mock *MockCommandRequirementHandler) ValidatePlanProject(repoDir string, ctx command.ProjectContext) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommandRequirementHandler().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repoDir, ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("ValidatePlanProject", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -119,8 +119,8 @@ type VerifierMockCommandRequirementHandler struct { timeout time.Duration } -func (verifier *VerifierMockCommandRequirementHandler) ValidateApplyProject(_param0 string, _param1 command.ProjectContext) *MockCommandRequirementHandler_ValidateApplyProject_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockCommandRequirementHandler) ValidateApplyProject(repoDir string, ctx command.ProjectContext) *MockCommandRequirementHandler_ValidateApplyProject_OngoingVerification { + params := []pegomock.Param{repoDir, ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ValidateApplyProject", params, verifier.timeout) return &MockCommandRequirementHandler_ValidateApplyProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -131,8 +131,8 @@ type MockCommandRequirementHandler_ValidateApplyProject_OngoingVerification stru } func (c *MockCommandRequirementHandler_ValidateApplyProject_OngoingVerification) GetCapturedArguments() (string, command.ProjectContext) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repoDir, ctx := c.GetAllCapturedArguments() + return repoDir[len(repoDir)-1], ctx[len(ctx)-1] } func (c *MockCommandRequirementHandler_ValidateApplyProject_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []command.ProjectContext) { @@ -150,8 +150,8 @@ func (c *MockCommandRequirementHandler_ValidateApplyProject_OngoingVerification) return } -func (verifier *VerifierMockCommandRequirementHandler) ValidateImportProject(_param0 string, _param1 command.ProjectContext) *MockCommandRequirementHandler_ValidateImportProject_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockCommandRequirementHandler) ValidateImportProject(repoDir string, ctx command.ProjectContext) *MockCommandRequirementHandler_ValidateImportProject_OngoingVerification { + params := []pegomock.Param{repoDir, ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ValidateImportProject", params, verifier.timeout) return &MockCommandRequirementHandler_ValidateImportProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -162,8 +162,8 @@ type MockCommandRequirementHandler_ValidateImportProject_OngoingVerification str } func (c *MockCommandRequirementHandler_ValidateImportProject_OngoingVerification) GetCapturedArguments() (string, command.ProjectContext) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repoDir, ctx := c.GetAllCapturedArguments() + return repoDir[len(repoDir)-1], ctx[len(ctx)-1] } func (c *MockCommandRequirementHandler_ValidateImportProject_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []command.ProjectContext) { @@ -181,8 +181,8 @@ func (c *MockCommandRequirementHandler_ValidateImportProject_OngoingVerification return } -func (verifier *VerifierMockCommandRequirementHandler) ValidatePlanProject(_param0 string, _param1 command.ProjectContext) *MockCommandRequirementHandler_ValidatePlanProject_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockCommandRequirementHandler) ValidatePlanProject(repoDir string, ctx command.ProjectContext) *MockCommandRequirementHandler_ValidatePlanProject_OngoingVerification { + params := []pegomock.Param{repoDir, ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ValidatePlanProject", params, verifier.timeout) return &MockCommandRequirementHandler_ValidatePlanProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -193,8 +193,8 @@ type MockCommandRequirementHandler_ValidatePlanProject_OngoingVerification struc } func (c *MockCommandRequirementHandler_ValidatePlanProject_OngoingVerification) GetCapturedArguments() (string, command.ProjectContext) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repoDir, ctx := c.GetAllCapturedArguments() + return repoDir[len(repoDir)-1], ctx[len(ctx)-1] } func (c *MockCommandRequirementHandler_ValidatePlanProject_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []command.ProjectContext) { diff --git a/server/events/mocks/mock_command_runner.go b/server/events/mocks/mock_command_runner.go index 1fe756993..c0267c222 100644 --- a/server/events/mocks/mock_command_runner.go +++ b/server/events/mocks/mock_command_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" events "github.com/runatlantis/atlantis/server/events" models "github.com/runatlantis/atlantis/server/events/models" "reflect" @@ -26,19 +26,19 @@ func NewMockCommandRunner(options ...pegomock.Option) *MockCommandRunner { func (mock *MockCommandRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockCommandRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockCommandRunner) RunAutoplanCommand(_param0 models.Repo, _param1 models.Repo, _param2 models.PullRequest, _param3 models.User) { +func (mock *MockCommandRunner) RunAutoplanCommand(baseRepo models.Repo, headRepo models.Repo, pull models.PullRequest, user models.User) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommandRunner().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{baseRepo, headRepo, pull, user} pegomock.GetGenericMockFrom(mock).Invoke("RunAutoplanCommand", params, []reflect.Type{}) } -func (mock *MockCommandRunner) RunCommentCommand(_param0 models.Repo, _param1 *models.Repo, _param2 *models.PullRequest, _param3 models.User, _param4 int, _param5 *events.CommentCommand) { +func (mock *MockCommandRunner) RunCommentCommand(baseRepo models.Repo, maybeHeadRepo *models.Repo, maybePull *models.PullRequest, user models.User, pullNum int, cmd *events.CommentCommand) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommandRunner().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} + params := []pegomock.Param{baseRepo, maybeHeadRepo, maybePull, user, pullNum, cmd} pegomock.GetGenericMockFrom(mock).Invoke("RunCommentCommand", params, []reflect.Type{}) } @@ -79,8 +79,8 @@ type VerifierMockCommandRunner struct { timeout time.Duration } -func (verifier *VerifierMockCommandRunner) RunAutoplanCommand(_param0 models.Repo, _param1 models.Repo, _param2 models.PullRequest, _param3 models.User) *MockCommandRunner_RunAutoplanCommand_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +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 &MockCommandRunner_RunAutoplanCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -91,8 +91,8 @@ type MockCommandRunner_RunAutoplanCommand_OngoingVerification struct { } func (c *MockCommandRunner_RunAutoplanCommand_OngoingVerification) GetCapturedArguments() (models.Repo, models.Repo, models.PullRequest, models.User) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + 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 *MockCommandRunner_RunAutoplanCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.Repo, _param2 []models.PullRequest, _param3 []models.User) { @@ -118,8 +118,8 @@ func (c *MockCommandRunner_RunAutoplanCommand_OngoingVerification) GetAllCapture return } -func (verifier *VerifierMockCommandRunner) RunCommentCommand(_param0 models.Repo, _param1 *models.Repo, _param2 *models.PullRequest, _param3 models.User, _param4 int, _param5 *events.CommentCommand) *MockCommandRunner_RunCommentCommand_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} +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 &MockCommandRunner_RunCommentCommand_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -130,8 +130,8 @@ type MockCommandRunner_RunCommentCommand_OngoingVerification struct { } func (c *MockCommandRunner_RunCommentCommand_OngoingVerification) GetCapturedArguments() (models.Repo, *models.Repo, *models.PullRequest, models.User, int, *events.CommentCommand) { - _param0, _param1, _param2, _param3, _param4, _param5 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1], _param5[len(_param5)-1] + 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 *MockCommandRunner_RunCommentCommand_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []*models.Repo, _param2 []*models.PullRequest, _param3 []models.User, _param4 []int, _param5 []*events.CommentCommand) { diff --git a/server/events/mocks/mock_comment_building.go b/server/events/mocks/mock_comment_building.go index b9878385d..1e461a07e 100644 --- a/server/events/mocks/mock_comment_building.go +++ b/server/events/mocks/mock_comment_building.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -24,11 +24,11 @@ func NewMockCommentBuilder(options ...pegomock.Option) *MockCommentBuilder { func (mock *MockCommentBuilder) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockCommentBuilder) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockCommentBuilder) BuildApplyComment(_param0 string, _param1 string, _param2 string, _param3 bool) string { +func (mock *MockCommentBuilder) BuildApplyComment(repoRelDir string, workspace string, project string, autoMergeDisabled bool) string { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommentBuilder().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{repoRelDir, workspace, project, autoMergeDisabled} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildApplyComment", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem()}) var ret0 string if len(result) != 0 { @@ -39,11 +39,11 @@ func (mock *MockCommentBuilder) BuildApplyComment(_param0 string, _param1 string return ret0 } -func (mock *MockCommentBuilder) BuildApprovePoliciesComment(_param0 string, _param1 string, _param2 string) string { +func (mock *MockCommentBuilder) BuildApprovePoliciesComment(repoRelDir string, workspace string, project string) string { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommentBuilder().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{repoRelDir, workspace, project} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildApprovePoliciesComment", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem()}) var ret0 string if len(result) != 0 { @@ -54,11 +54,11 @@ func (mock *MockCommentBuilder) BuildApprovePoliciesComment(_param0 string, _par return ret0 } -func (mock *MockCommentBuilder) BuildPlanComment(_param0 string, _param1 string, _param2 string, _param3 []string) string { +func (mock *MockCommentBuilder) BuildPlanComment(repoRelDir string, workspace string, project string, commentArgs []string) string { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommentBuilder().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{repoRelDir, workspace, project, commentArgs} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildPlanComment", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem()}) var ret0 string if len(result) != 0 { @@ -106,8 +106,8 @@ type VerifierMockCommentBuilder struct { timeout time.Duration } -func (verifier *VerifierMockCommentBuilder) BuildApplyComment(_param0 string, _param1 string, _param2 string, _param3 bool) *MockCommentBuilder_BuildApplyComment_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockCommentBuilder) BuildApplyComment(repoRelDir string, workspace string, project string, autoMergeDisabled bool) *MockCommentBuilder_BuildApplyComment_OngoingVerification { + params := []pegomock.Param{repoRelDir, workspace, project, autoMergeDisabled} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildApplyComment", params, verifier.timeout) return &MockCommentBuilder_BuildApplyComment_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -118,8 +118,8 @@ type MockCommentBuilder_BuildApplyComment_OngoingVerification struct { } func (c *MockCommentBuilder_BuildApplyComment_OngoingVerification) GetCapturedArguments() (string, string, string, bool) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + repoRelDir, workspace, project, autoMergeDisabled := c.GetAllCapturedArguments() + return repoRelDir[len(repoRelDir)-1], workspace[len(workspace)-1], project[len(project)-1], autoMergeDisabled[len(autoMergeDisabled)-1] } func (c *MockCommentBuilder_BuildApplyComment_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []string, _param3 []bool) { @@ -145,8 +145,8 @@ func (c *MockCommentBuilder_BuildApplyComment_OngoingVerification) GetAllCapture return } -func (verifier *VerifierMockCommentBuilder) BuildApprovePoliciesComment(_param0 string, _param1 string, _param2 string) *MockCommentBuilder_BuildApprovePoliciesComment_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockCommentBuilder) BuildApprovePoliciesComment(repoRelDir string, workspace string, project string) *MockCommentBuilder_BuildApprovePoliciesComment_OngoingVerification { + params := []pegomock.Param{repoRelDir, workspace, project} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildApprovePoliciesComment", params, verifier.timeout) return &MockCommentBuilder_BuildApprovePoliciesComment_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -157,8 +157,8 @@ type MockCommentBuilder_BuildApprovePoliciesComment_OngoingVerification struct { } func (c *MockCommentBuilder_BuildApprovePoliciesComment_OngoingVerification) GetCapturedArguments() (string, string, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + repoRelDir, workspace, project := c.GetAllCapturedArguments() + return repoRelDir[len(repoRelDir)-1], workspace[len(workspace)-1], project[len(project)-1] } func (c *MockCommentBuilder_BuildApprovePoliciesComment_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []string) { @@ -180,8 +180,8 @@ func (c *MockCommentBuilder_BuildApprovePoliciesComment_OngoingVerification) Get return } -func (verifier *VerifierMockCommentBuilder) BuildPlanComment(_param0 string, _param1 string, _param2 string, _param3 []string) *MockCommentBuilder_BuildPlanComment_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockCommentBuilder) BuildPlanComment(repoRelDir string, workspace string, project string, commentArgs []string) *MockCommentBuilder_BuildPlanComment_OngoingVerification { + params := []pegomock.Param{repoRelDir, workspace, project, commentArgs} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildPlanComment", params, verifier.timeout) return &MockCommentBuilder_BuildPlanComment_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -192,8 +192,8 @@ type MockCommentBuilder_BuildPlanComment_OngoingVerification struct { } func (c *MockCommentBuilder_BuildPlanComment_OngoingVerification) GetCapturedArguments() (string, string, string, []string) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + repoRelDir, workspace, project, commentArgs := c.GetAllCapturedArguments() + return repoRelDir[len(repoRelDir)-1], workspace[len(workspace)-1], project[len(project)-1], commentArgs[len(commentArgs)-1] } func (c *MockCommentBuilder_BuildPlanComment_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []string, _param3 [][]string) { diff --git a/server/events/mocks/mock_comment_parsing.go b/server/events/mocks/mock_comment_parsing.go index 4b56ba1ca..73a26e00a 100644 --- a/server/events/mocks/mock_comment_parsing.go +++ b/server/events/mocks/mock_comment_parsing.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" events "github.com/runatlantis/atlantis/server/events" models "github.com/runatlantis/atlantis/server/events/models" "reflect" @@ -26,11 +26,11 @@ func NewMockCommentParsing(options ...pegomock.Option) *MockCommentParsing { func (mock *MockCommentParsing) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockCommentParsing) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockCommentParsing) Parse(_param0 string, _param1 models.VCSHostType) events.CommentParseResult { +func (mock *MockCommentParsing) Parse(comment string, vcsHost models.VCSHostType) events.CommentParseResult { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommentParsing().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{comment, vcsHost} result := pegomock.GetGenericMockFrom(mock).Invoke("Parse", params, []reflect.Type{reflect.TypeOf((*events.CommentParseResult)(nil)).Elem()}) var ret0 events.CommentParseResult if len(result) != 0 { @@ -78,8 +78,8 @@ type VerifierMockCommentParsing struct { timeout time.Duration } -func (verifier *VerifierMockCommentParsing) Parse(_param0 string, _param1 models.VCSHostType) *MockCommentParsing_Parse_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockCommentParsing_Parse_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -90,8 +90,8 @@ type MockCommentParsing_Parse_OngoingVerification struct { } func (c *MockCommentParsing_Parse_OngoingVerification) GetCapturedArguments() (string, models.VCSHostType) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + comment, vcsHost := c.GetAllCapturedArguments() + return comment[len(comment)-1], vcsHost[len(vcsHost)-1] } func (c *MockCommentParsing_Parse_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []models.VCSHostType) { diff --git a/server/events/mocks/mock_commit_status_updater.go b/server/events/mocks/mock_commit_status_updater.go index ee5d57a31..9525b9846 100644 --- a/server/events/mocks/mock_commit_status_updater.go +++ b/server/events/mocks/mock_commit_status_updater.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" models "github.com/runatlantis/atlantis/server/events/models" "reflect" @@ -26,11 +26,11 @@ func NewMockCommitStatusUpdater(options ...pegomock.Option) *MockCommitStatusUpd func (mock *MockCommitStatusUpdater) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockCommitStatusUpdater) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockCommitStatusUpdater) UpdateCombined(_param0 models.Repo, _param1 models.PullRequest, _param2 models.CommitStatus, _param3 command.Name) error { +func (mock *MockCommitStatusUpdater) UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmdName command.Name) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommitStatusUpdater().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{repo, pull, status, cmdName} result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateCombined", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -41,11 +41,11 @@ func (mock *MockCommitStatusUpdater) UpdateCombined(_param0 models.Repo, _param1 return ret0 } -func (mock *MockCommitStatusUpdater) UpdateCombinedCount(_param0 models.Repo, _param1 models.PullRequest, _param2 models.CommitStatus, _param3 command.Name, _param4 int, _param5 int) error { +func (mock *MockCommitStatusUpdater) UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmdName command.Name, numSuccess int, numTotal int) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommitStatusUpdater().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} + params := []pegomock.Param{repo, pull, status, cmdName, numSuccess, numTotal} result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateCombinedCount", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -56,11 +56,11 @@ func (mock *MockCommitStatusUpdater) UpdateCombinedCount(_param0 models.Repo, _p return ret0 } -func (mock *MockCommitStatusUpdater) UpdatePostWorkflowHook(_param0 models.PullRequest, _param1 models.CommitStatus, _param2 string, _param3 string, _param4 string) error { +func (mock *MockCommitStatusUpdater) UpdatePostWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, runtimeDescription string, url string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommitStatusUpdater().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} + params := []pegomock.Param{pull, status, hookDescription, runtimeDescription, url} result := pegomock.GetGenericMockFrom(mock).Invoke("UpdatePostWorkflowHook", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -71,11 +71,11 @@ func (mock *MockCommitStatusUpdater) UpdatePostWorkflowHook(_param0 models.PullR return ret0 } -func (mock *MockCommitStatusUpdater) UpdatePreWorkflowHook(_param0 models.PullRequest, _param1 models.CommitStatus, _param2 string, _param3 string, _param4 string) error { +func (mock *MockCommitStatusUpdater) UpdatePreWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, runtimeDescription string, url string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCommitStatusUpdater().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} + params := []pegomock.Param{pull, status, hookDescription, runtimeDescription, url} result := pegomock.GetGenericMockFrom(mock).Invoke("UpdatePreWorkflowHook", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -123,8 +123,8 @@ type VerifierMockCommitStatusUpdater struct { timeout time.Duration } -func (verifier *VerifierMockCommitStatusUpdater) UpdateCombined(_param0 models.Repo, _param1 models.PullRequest, _param2 models.CommitStatus, _param3 command.Name) *MockCommitStatusUpdater_UpdateCombined_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockCommitStatusUpdater) UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmdName command.Name) *MockCommitStatusUpdater_UpdateCombined_OngoingVerification { + params := []pegomock.Param{repo, pull, status, cmdName} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateCombined", params, verifier.timeout) return &MockCommitStatusUpdater_UpdateCombined_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -135,8 +135,8 @@ type MockCommitStatusUpdater_UpdateCombined_OngoingVerification struct { } func (c *MockCommitStatusUpdater_UpdateCombined_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, command.Name) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + repo, pull, status, cmdName := c.GetAllCapturedArguments() + return repo[len(repo)-1], pull[len(pull)-1], status[len(status)-1], cmdName[len(cmdName)-1] } func (c *MockCommitStatusUpdater_UpdateCombined_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []command.Name) { @@ -162,8 +162,8 @@ func (c *MockCommitStatusUpdater_UpdateCombined_OngoingVerification) GetAllCaptu return } -func (verifier *VerifierMockCommitStatusUpdater) UpdateCombinedCount(_param0 models.Repo, _param1 models.PullRequest, _param2 models.CommitStatus, _param3 command.Name, _param4 int, _param5 int) *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} +func (verifier *VerifierMockCommitStatusUpdater) UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmdName command.Name, numSuccess int, numTotal int) *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification { + params := []pegomock.Param{repo, pull, status, cmdName, numSuccess, numTotal} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateCombinedCount", params, verifier.timeout) return &MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -174,8 +174,8 @@ type MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification struct { } func (c *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, command.Name, int, int) { - _param0, _param1, _param2, _param3, _param4, _param5 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1], _param5[len(_param5)-1] + repo, pull, status, cmdName, numSuccess, numTotal := c.GetAllCapturedArguments() + return repo[len(repo)-1], pull[len(pull)-1], status[len(status)-1], cmdName[len(cmdName)-1], numSuccess[len(numSuccess)-1], numTotal[len(numTotal)-1] } func (c *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []command.Name, _param4 []int, _param5 []int) { @@ -209,8 +209,8 @@ func (c *MockCommitStatusUpdater_UpdateCombinedCount_OngoingVerification) GetAll return } -func (verifier *VerifierMockCommitStatusUpdater) UpdatePostWorkflowHook(_param0 models.PullRequest, _param1 models.CommitStatus, _param2 string, _param3 string, _param4 string) *MockCommitStatusUpdater_UpdatePostWorkflowHook_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} +func (verifier *VerifierMockCommitStatusUpdater) UpdatePostWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, runtimeDescription string, url string) *MockCommitStatusUpdater_UpdatePostWorkflowHook_OngoingVerification { + params := []pegomock.Param{pull, status, hookDescription, runtimeDescription, url} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdatePostWorkflowHook", params, verifier.timeout) return &MockCommitStatusUpdater_UpdatePostWorkflowHook_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -221,8 +221,8 @@ type MockCommitStatusUpdater_UpdatePostWorkflowHook_OngoingVerification struct { } func (c *MockCommitStatusUpdater_UpdatePostWorkflowHook_OngoingVerification) GetCapturedArguments() (models.PullRequest, models.CommitStatus, string, string, string) { - _param0, _param1, _param2, _param3, _param4 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1] + pull, status, hookDescription, runtimeDescription, url := c.GetAllCapturedArguments() + return pull[len(pull)-1], status[len(status)-1], hookDescription[len(hookDescription)-1], runtimeDescription[len(runtimeDescription)-1], url[len(url)-1] } func (c *MockCommitStatusUpdater_UpdatePostWorkflowHook_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 []models.CommitStatus, _param2 []string, _param3 []string, _param4 []string) { @@ -252,8 +252,8 @@ func (c *MockCommitStatusUpdater_UpdatePostWorkflowHook_OngoingVerification) Get return } -func (verifier *VerifierMockCommitStatusUpdater) UpdatePreWorkflowHook(_param0 models.PullRequest, _param1 models.CommitStatus, _param2 string, _param3 string, _param4 string) *MockCommitStatusUpdater_UpdatePreWorkflowHook_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} +func (verifier *VerifierMockCommitStatusUpdater) UpdatePreWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, runtimeDescription string, url string) *MockCommitStatusUpdater_UpdatePreWorkflowHook_OngoingVerification { + params := []pegomock.Param{pull, status, hookDescription, runtimeDescription, url} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdatePreWorkflowHook", params, verifier.timeout) return &MockCommitStatusUpdater_UpdatePreWorkflowHook_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -264,8 +264,8 @@ type MockCommitStatusUpdater_UpdatePreWorkflowHook_OngoingVerification struct { } func (c *MockCommitStatusUpdater_UpdatePreWorkflowHook_OngoingVerification) GetCapturedArguments() (models.PullRequest, models.CommitStatus, string, string, string) { - _param0, _param1, _param2, _param3, _param4 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1] + pull, status, hookDescription, runtimeDescription, url := c.GetAllCapturedArguments() + return pull[len(pull)-1], status[len(status)-1], hookDescription[len(hookDescription)-1], runtimeDescription[len(runtimeDescription)-1], url[len(url)-1] } func (c *MockCommitStatusUpdater_UpdatePreWorkflowHook_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 []models.CommitStatus, _param2 []string, _param3 []string, _param4 []string) { diff --git a/server/events/mocks/mock_custom_step_runner.go b/server/events/mocks/mock_custom_step_runner.go index fbc1a3de3..02a5a04fc 100644 --- a/server/events/mocks/mock_custom_step_runner.go +++ b/server/events/mocks/mock_custom_step_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockCustomStepRunner(options ...pegomock.Option) *MockCustomStepRunner { func (mock *MockCustomStepRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockCustomStepRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockCustomStepRunner) Run(_param0 command.ProjectContext, _param1 string, _param2 string, _param3 map[string]string, _param4 bool) (string, error) { +func (mock *MockCustomStepRunner) Run(ctx command.ProjectContext, cmd string, path string, envs map[string]string, streamOutput bool) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockCustomStepRunner().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} + params := []pegomock.Param{ctx, cmd, path, envs, streamOutput} result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -81,8 +81,8 @@ type VerifierMockCustomStepRunner struct { timeout time.Duration } -func (verifier *VerifierMockCustomStepRunner) Run(_param0 command.ProjectContext, _param1 string, _param2 string, _param3 map[string]string, _param4 bool) *MockCustomStepRunner_Run_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} +func (verifier *VerifierMockCustomStepRunner) Run(ctx command.ProjectContext, cmd string, path string, envs map[string]string, streamOutput bool) *MockCustomStepRunner_Run_OngoingVerification { + params := []pegomock.Param{ctx, cmd, path, envs, streamOutput} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout) return &MockCustomStepRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockCustomStepRunner_Run_OngoingVerification struct { } func (c *MockCustomStepRunner_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, string, map[string]string, bool) { - _param0, _param1, _param2, _param3, _param4 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1] + ctx, cmd, path, envs, streamOutput := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], cmd[len(cmd)-1], path[len(path)-1], envs[len(envs)-1], streamOutput[len(streamOutput)-1] } func (c *MockCustomStepRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 []string, _param3 []map[string]string, _param4 []bool) { diff --git a/server/events/mocks/mock_delete_lock_command.go b/server/events/mocks/mock_delete_lock_command.go index 4018a80ff..ce1afd3b7 100644 --- a/server/events/mocks/mock_delete_lock_command.go +++ b/server/events/mocks/mock_delete_lock_command.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockDeleteLockCommand(options ...pegomock.Option) *MockDeleteLockCommand func (mock *MockDeleteLockCommand) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockDeleteLockCommand) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockDeleteLockCommand) DeleteLock(_param0 string) (*models.ProjectLock, error) { +func (mock *MockDeleteLockCommand) DeleteLock(id string) (*models.ProjectLock, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockDeleteLockCommand().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{id} result := pegomock.GetGenericMockFrom(mock).Invoke("DeleteLock", params, []reflect.Type{reflect.TypeOf((**models.ProjectLock)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *models.ProjectLock var ret1 error @@ -44,11 +44,11 @@ func (mock *MockDeleteLockCommand) DeleteLock(_param0 string) (*models.ProjectLo return ret0, ret1 } -func (mock *MockDeleteLockCommand) DeleteLocksByPull(_param0 string, _param1 int) (int, error) { +func (mock *MockDeleteLockCommand) DeleteLocksByPull(repoFullName string, pullNum int) (int, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockDeleteLockCommand().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repoFullName, pullNum} result := pegomock.GetGenericMockFrom(mock).Invoke("DeleteLocksByPull", params, []reflect.Type{reflect.TypeOf((*int)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 int var ret1 error @@ -100,8 +100,8 @@ type VerifierMockDeleteLockCommand struct { timeout time.Duration } -func (verifier *VerifierMockDeleteLockCommand) DeleteLock(_param0 string) *MockDeleteLockCommand_DeleteLock_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockDeleteLockCommand) DeleteLock(id string) *MockDeleteLockCommand_DeleteLock_OngoingVerification { + params := []pegomock.Param{id} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeleteLock", params, verifier.timeout) return &MockDeleteLockCommand_DeleteLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -112,8 +112,8 @@ type MockDeleteLockCommand_DeleteLock_OngoingVerification struct { } func (c *MockDeleteLockCommand_DeleteLock_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + id := c.GetAllCapturedArguments() + return id[len(id)-1] } func (c *MockDeleteLockCommand_DeleteLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { @@ -127,8 +127,8 @@ func (c *MockDeleteLockCommand_DeleteLock_OngoingVerification) GetAllCapturedArg return } -func (verifier *VerifierMockDeleteLockCommand) DeleteLocksByPull(_param0 string, _param1 int) *MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockDeleteLockCommand) DeleteLocksByPull(repoFullName string, pullNum int) *MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification { + params := []pegomock.Param{repoFullName, pullNum} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DeleteLocksByPull", params, verifier.timeout) return &MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -139,8 +139,8 @@ type MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification struct { } func (c *MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification) GetCapturedArguments() (string, int) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repoFullName, pullNum := c.GetAllCapturedArguments() + return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1] } func (c *MockDeleteLockCommand_DeleteLocksByPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) { diff --git a/server/events/mocks/mock_env_step_runner.go b/server/events/mocks/mock_env_step_runner.go index 8d4517cbb..bfc7f97a5 100644 --- a/server/events/mocks/mock_env_step_runner.go +++ b/server/events/mocks/mock_env_step_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockEnvStepRunner(options ...pegomock.Option) *MockEnvStepRunner { func (mock *MockEnvStepRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockEnvStepRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockEnvStepRunner) Run(_param0 command.ProjectContext, _param1 string, _param2 string, _param3 string, _param4 map[string]string) (string, error) { +func (mock *MockEnvStepRunner) Run(ctx command.ProjectContext, cmd string, value string, path string, envs map[string]string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEnvStepRunner().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} + params := []pegomock.Param{ctx, cmd, value, path, envs} result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -81,8 +81,8 @@ type VerifierMockEnvStepRunner struct { timeout time.Duration } -func (verifier *VerifierMockEnvStepRunner) Run(_param0 command.ProjectContext, _param1 string, _param2 string, _param3 string, _param4 map[string]string) *MockEnvStepRunner_Run_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} +func (verifier *VerifierMockEnvStepRunner) Run(ctx command.ProjectContext, cmd string, value string, path string, envs map[string]string) *MockEnvStepRunner_Run_OngoingVerification { + params := []pegomock.Param{ctx, cmd, value, path, envs} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout) return &MockEnvStepRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockEnvStepRunner_Run_OngoingVerification struct { } func (c *MockEnvStepRunner_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, string, string, map[string]string) { - _param0, _param1, _param2, _param3, _param4 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1] + ctx, cmd, value, path, envs := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], cmd[len(cmd)-1], value[len(value)-1], path[len(path)-1], envs[len(envs)-1] } func (c *MockEnvStepRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 []string, _param3 []string, _param4 []map[string]string) { diff --git a/server/events/mocks/mock_event_parsing.go b/server/events/mocks/mock_event_parsing.go index 2bfb2f6e0..c2433a1f3 100644 --- a/server/events/mocks/mock_event_parsing.go +++ b/server/events/mocks/mock_event_parsing.go @@ -6,7 +6,7 @@ package mocks import ( github "github.com/google/go-github/v53/github" azuredevops "github.com/mcdafydd/go-azuredevops/azuredevops" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" go_gitlab "github.com/xanzy/go-gitlab" "reflect" @@ -28,11 +28,11 @@ func NewMockEventParsing(options ...pegomock.Option) *MockEventParsing { func (mock *MockEventParsing) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockEventParsing) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockEventParsing) GetBitbucketCloudPullEventType(_param0 string) models.PullRequestEventType { +func (mock *MockEventParsing) GetBitbucketCloudPullEventType(eventTypeHeader string) models.PullRequestEventType { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{eventTypeHeader} result := pegomock.GetGenericMockFrom(mock).Invoke("GetBitbucketCloudPullEventType", params, []reflect.Type{reflect.TypeOf((*models.PullRequestEventType)(nil)).Elem()}) var ret0 models.PullRequestEventType if len(result) != 0 { @@ -43,11 +43,11 @@ func (mock *MockEventParsing) GetBitbucketCloudPullEventType(_param0 string) mod return ret0 } -func (mock *MockEventParsing) GetBitbucketServerPullEventType(_param0 string) models.PullRequestEventType { +func (mock *MockEventParsing) GetBitbucketServerPullEventType(eventTypeHeader string) models.PullRequestEventType { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{eventTypeHeader} result := pegomock.GetGenericMockFrom(mock).Invoke("GetBitbucketServerPullEventType", params, []reflect.Type{reflect.TypeOf((*models.PullRequestEventType)(nil)).Elem()}) var ret0 models.PullRequestEventType if len(result) != 0 { @@ -58,11 +58,11 @@ func (mock *MockEventParsing) GetBitbucketServerPullEventType(_param0 string) mo return ret0 } -func (mock *MockEventParsing) ParseAPIPlanRequest(_param0 models.VCSHostType, _param1 string, _param2 string) (models.Repo, error) { +func (mock *MockEventParsing) ParseAPIPlanRequest(vcsHostType models.VCSHostType, path string, cloneURL string) (models.Repo, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{vcsHostType, path, cloneURL} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseAPIPlanRequest", params, []reflect.Type{reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.Repo var ret1 error @@ -77,11 +77,11 @@ func (mock *MockEventParsing) ParseAPIPlanRequest(_param0 models.VCSHostType, _p return ret0, ret1 } -func (mock *MockEventParsing) ParseAzureDevopsPull(_param0 *azuredevops.GitPullRequest) (models.PullRequest, models.Repo, models.Repo, error) { +func (mock *MockEventParsing) ParseAzureDevopsPull(adPull *azuredevops.GitPullRequest) (models.PullRequest, models.Repo, models.Repo, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{adPull} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseAzureDevopsPull", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.Repo @@ -104,11 +104,11 @@ func (mock *MockEventParsing) ParseAzureDevopsPull(_param0 *azuredevops.GitPullR return ret0, ret1, ret2, ret3 } -func (mock *MockEventParsing) ParseAzureDevopsPullEvent(_param0 azuredevops.Event) (models.PullRequest, models.PullRequestEventType, models.Repo, models.Repo, models.User, error) { +func (mock *MockEventParsing) ParseAzureDevopsPullEvent(pullEvent azuredevops.Event) (models.PullRequest, models.PullRequestEventType, models.Repo, models.Repo, models.User, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pullEvent} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseAzureDevopsPullEvent", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.PullRequestEventType)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.PullRequestEventType @@ -139,11 +139,11 @@ func (mock *MockEventParsing) ParseAzureDevopsPullEvent(_param0 azuredevops.Even return ret0, ret1, ret2, ret3, ret4, ret5 } -func (mock *MockEventParsing) ParseAzureDevopsRepo(_param0 *azuredevops.GitRepository) (models.Repo, error) { +func (mock *MockEventParsing) ParseAzureDevopsRepo(adRepo *azuredevops.GitRepository) (models.Repo, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{adRepo} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseAzureDevopsRepo", params, []reflect.Type{reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.Repo var ret1 error @@ -158,11 +158,11 @@ func (mock *MockEventParsing) ParseAzureDevopsRepo(_param0 *azuredevops.GitRepos return ret0, ret1 } -func (mock *MockEventParsing) ParseBitbucketCloudPullCommentEvent(_param0 []byte) (models.PullRequest, models.Repo, models.Repo, models.User, string, error) { +func (mock *MockEventParsing) ParseBitbucketCloudPullCommentEvent(body []byte) (models.PullRequest, models.Repo, models.Repo, models.User, string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{body} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseBitbucketCloudPullCommentEvent", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.Repo @@ -193,11 +193,11 @@ func (mock *MockEventParsing) ParseBitbucketCloudPullCommentEvent(_param0 []byte return ret0, ret1, ret2, ret3, ret4, ret5 } -func (mock *MockEventParsing) ParseBitbucketCloudPullEvent(_param0 []byte) (models.PullRequest, models.Repo, models.Repo, models.User, error) { +func (mock *MockEventParsing) ParseBitbucketCloudPullEvent(body []byte) (models.PullRequest, models.Repo, models.Repo, models.User, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{body} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseBitbucketCloudPullEvent", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.Repo @@ -224,11 +224,11 @@ func (mock *MockEventParsing) ParseBitbucketCloudPullEvent(_param0 []byte) (mode return ret0, ret1, ret2, ret3, ret4 } -func (mock *MockEventParsing) ParseBitbucketServerPullCommentEvent(_param0 []byte) (models.PullRequest, models.Repo, models.Repo, models.User, string, error) { +func (mock *MockEventParsing) ParseBitbucketServerPullCommentEvent(body []byte) (models.PullRequest, models.Repo, models.Repo, models.User, string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{body} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseBitbucketServerPullCommentEvent", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.Repo @@ -259,11 +259,11 @@ func (mock *MockEventParsing) ParseBitbucketServerPullCommentEvent(_param0 []byt return ret0, ret1, ret2, ret3, ret4, ret5 } -func (mock *MockEventParsing) ParseBitbucketServerPullEvent(_param0 []byte) (models.PullRequest, models.Repo, models.Repo, models.User, error) { +func (mock *MockEventParsing) ParseBitbucketServerPullEvent(body []byte) (models.PullRequest, models.Repo, models.Repo, models.User, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{body} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseBitbucketServerPullEvent", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.Repo @@ -290,11 +290,11 @@ func (mock *MockEventParsing) ParseBitbucketServerPullEvent(_param0 []byte) (mod return ret0, ret1, ret2, ret3, ret4 } -func (mock *MockEventParsing) ParseGithubIssueCommentEvent(_param0 *github.IssueCommentEvent) (models.Repo, models.User, int, error) { +func (mock *MockEventParsing) ParseGithubIssueCommentEvent(comment *github.IssueCommentEvent) (models.Repo, models.User, int, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{comment} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseGithubIssueCommentEvent", params, []reflect.Type{reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*int)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.Repo var ret1 models.User @@ -317,11 +317,11 @@ func (mock *MockEventParsing) ParseGithubIssueCommentEvent(_param0 *github.Issue return ret0, ret1, ret2, ret3 } -func (mock *MockEventParsing) ParseGithubPull(_param0 *github.PullRequest) (models.PullRequest, models.Repo, models.Repo, error) { +func (mock *MockEventParsing) ParseGithubPull(ghPull *github.PullRequest) (models.PullRequest, models.Repo, models.Repo, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ghPull} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseGithubPull", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.Repo @@ -344,11 +344,11 @@ func (mock *MockEventParsing) ParseGithubPull(_param0 *github.PullRequest) (mode return ret0, ret1, ret2, ret3 } -func (mock *MockEventParsing) ParseGithubPullEvent(_param0 *github.PullRequestEvent) (models.PullRequest, models.PullRequestEventType, models.Repo, models.Repo, models.User, error) { +func (mock *MockEventParsing) ParseGithubPullEvent(pullEvent *github.PullRequestEvent) (models.PullRequest, models.PullRequestEventType, models.Repo, models.Repo, models.User, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pullEvent} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseGithubPullEvent", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.PullRequestEventType)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.PullRequestEventType @@ -379,11 +379,11 @@ func (mock *MockEventParsing) ParseGithubPullEvent(_param0 *github.PullRequestEv return ret0, ret1, ret2, ret3, ret4, ret5 } -func (mock *MockEventParsing) ParseGithubRepo(_param0 *github.Repository) (models.Repo, error) { +func (mock *MockEventParsing) ParseGithubRepo(ghRepo *github.Repository) (models.Repo, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ghRepo} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseGithubRepo", params, []reflect.Type{reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.Repo var ret1 error @@ -398,11 +398,11 @@ func (mock *MockEventParsing) ParseGithubRepo(_param0 *github.Repository) (model return ret0, ret1 } -func (mock *MockEventParsing) ParseGitlabMergeRequest(_param0 *go_gitlab.MergeRequest, _param1 models.Repo) models.PullRequest { +func (mock *MockEventParsing) ParseGitlabMergeRequest(mr *go_gitlab.MergeRequest, baseRepo models.Repo) models.PullRequest { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{mr, baseRepo} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseGitlabMergeRequest", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem()}) var ret0 models.PullRequest if len(result) != 0 { @@ -413,11 +413,11 @@ func (mock *MockEventParsing) ParseGitlabMergeRequest(_param0 *go_gitlab.MergeRe return ret0 } -func (mock *MockEventParsing) ParseGitlabMergeRequestCommentEvent(_param0 go_gitlab.MergeCommentEvent) (models.Repo, models.Repo, int, models.User, error) { +func (mock *MockEventParsing) ParseGitlabMergeRequestCommentEvent(event go_gitlab.MergeCommentEvent) (models.Repo, models.Repo, int, models.User, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{event} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseGitlabMergeRequestCommentEvent", params, []reflect.Type{reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*int)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.Repo var ret1 models.Repo @@ -444,11 +444,11 @@ func (mock *MockEventParsing) ParseGitlabMergeRequestCommentEvent(_param0 go_git return ret0, ret1, ret2, ret3, ret4 } -func (mock *MockEventParsing) ParseGitlabMergeRequestEvent(_param0 go_gitlab.MergeEvent) (models.PullRequest, models.PullRequestEventType, models.Repo, models.Repo, models.User, error) { +func (mock *MockEventParsing) ParseGitlabMergeRequestEvent(event go_gitlab.MergeEvent) (models.PullRequest, models.PullRequestEventType, models.Repo, models.Repo, models.User, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{event} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseGitlabMergeRequestEvent", params, []reflect.Type{reflect.TypeOf((*models.PullRequest)(nil)).Elem(), reflect.TypeOf((*models.PullRequestEventType)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.Repo)(nil)).Elem(), reflect.TypeOf((*models.User)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullRequest var ret1 models.PullRequestEventType @@ -479,11 +479,11 @@ func (mock *MockEventParsing) ParseGitlabMergeRequestEvent(_param0 go_gitlab.Mer return ret0, ret1, ret2, ret3, ret4, ret5 } -func (mock *MockEventParsing) ParseGitlabMergeRequestUpdateEvent(_param0 go_gitlab.MergeEvent) models.PullRequestEventType { +func (mock *MockEventParsing) ParseGitlabMergeRequestUpdateEvent(event go_gitlab.MergeEvent) models.PullRequestEventType { if mock == nil { panic("mock must not be nil. Use myMock := NewMockEventParsing().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{event} result := pegomock.GetGenericMockFrom(mock).Invoke("ParseGitlabMergeRequestUpdateEvent", params, []reflect.Type{reflect.TypeOf((*models.PullRequestEventType)(nil)).Elem()}) var ret0 models.PullRequestEventType if len(result) != 0 { @@ -531,8 +531,8 @@ type VerifierMockEventParsing struct { timeout time.Duration } -func (verifier *VerifierMockEventParsing) GetBitbucketCloudPullEventType(_param0 string) *MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -543,8 +543,8 @@ type MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification struct } func (c *MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + eventTypeHeader := c.GetAllCapturedArguments() + return eventTypeHeader[len(eventTypeHeader)-1] } func (c *MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { @@ -558,8 +558,8 @@ func (c *MockEventParsing_GetBitbucketCloudPullEventType_OngoingVerification) Ge return } -func (verifier *VerifierMockEventParsing) GetBitbucketServerPullEventType(_param0 string) *MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -570,8 +570,8 @@ type MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification struct } func (c *MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + eventTypeHeader := c.GetAllCapturedArguments() + return eventTypeHeader[len(eventTypeHeader)-1] } func (c *MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { @@ -585,8 +585,8 @@ func (c *MockEventParsing_GetBitbucketServerPullEventType_OngoingVerification) G return } -func (verifier *VerifierMockEventParsing) ParseAPIPlanRequest(_param0 models.VCSHostType, _param1 string, _param2 string) *MockEventParsing_ParseAPIPlanRequest_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockEventParsing) ParseAPIPlanRequest(vcsHostType models.VCSHostType, path string, cloneURL string) *MockEventParsing_ParseAPIPlanRequest_OngoingVerification { + params := []pegomock.Param{vcsHostType, path, cloneURL} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseAPIPlanRequest", params, verifier.timeout) return &MockEventParsing_ParseAPIPlanRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -597,8 +597,8 @@ type MockEventParsing_ParseAPIPlanRequest_OngoingVerification struct { } func (c *MockEventParsing_ParseAPIPlanRequest_OngoingVerification) GetCapturedArguments() (models.VCSHostType, string, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + vcsHostType, path, cloneURL := c.GetAllCapturedArguments() + return vcsHostType[len(vcsHostType)-1], path[len(path)-1], cloneURL[len(cloneURL)-1] } func (c *MockEventParsing_ParseAPIPlanRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []models.VCSHostType, _param1 []string, _param2 []string) { @@ -620,8 +620,8 @@ func (c *MockEventParsing_ParseAPIPlanRequest_OngoingVerification) GetAllCapture return } -func (verifier *VerifierMockEventParsing) ParseAzureDevopsPull(_param0 *azuredevops.GitPullRequest) *MockEventParsing_ParseAzureDevopsPull_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockEventParsing) ParseAzureDevopsPull(adPull *azuredevops.GitPullRequest) *MockEventParsing_ParseAzureDevopsPull_OngoingVerification { + params := []pegomock.Param{adPull} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseAzureDevopsPull", params, verifier.timeout) return &MockEventParsing_ParseAzureDevopsPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -632,8 +632,8 @@ type MockEventParsing_ParseAzureDevopsPull_OngoingVerification struct { } func (c *MockEventParsing_ParseAzureDevopsPull_OngoingVerification) GetCapturedArguments() *azuredevops.GitPullRequest { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + adPull := c.GetAllCapturedArguments() + return adPull[len(adPull)-1] } func (c *MockEventParsing_ParseAzureDevopsPull_OngoingVerification) GetAllCapturedArguments() (_param0 []*azuredevops.GitPullRequest) { @@ -647,8 +647,8 @@ func (c *MockEventParsing_ParseAzureDevopsPull_OngoingVerification) GetAllCaptur return } -func (verifier *VerifierMockEventParsing) ParseAzureDevopsPullEvent(_param0 azuredevops.Event) *MockEventParsing_ParseAzureDevopsPullEvent_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockEventParsing) ParseAzureDevopsPullEvent(pullEvent azuredevops.Event) *MockEventParsing_ParseAzureDevopsPullEvent_OngoingVerification { + params := []pegomock.Param{pullEvent} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseAzureDevopsPullEvent", params, verifier.timeout) return &MockEventParsing_ParseAzureDevopsPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -659,8 +659,8 @@ type MockEventParsing_ParseAzureDevopsPullEvent_OngoingVerification struct { } func (c *MockEventParsing_ParseAzureDevopsPullEvent_OngoingVerification) GetCapturedArguments() azuredevops.Event { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pullEvent := c.GetAllCapturedArguments() + return pullEvent[len(pullEvent)-1] } func (c *MockEventParsing_ParseAzureDevopsPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []azuredevops.Event) { @@ -674,8 +674,8 @@ func (c *MockEventParsing_ParseAzureDevopsPullEvent_OngoingVerification) GetAllC return } -func (verifier *VerifierMockEventParsing) ParseAzureDevopsRepo(_param0 *azuredevops.GitRepository) *MockEventParsing_ParseAzureDevopsRepo_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockEventParsing) ParseAzureDevopsRepo(adRepo *azuredevops.GitRepository) *MockEventParsing_ParseAzureDevopsRepo_OngoingVerification { + params := []pegomock.Param{adRepo} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseAzureDevopsRepo", params, verifier.timeout) return &MockEventParsing_ParseAzureDevopsRepo_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -686,8 +686,8 @@ type MockEventParsing_ParseAzureDevopsRepo_OngoingVerification struct { } func (c *MockEventParsing_ParseAzureDevopsRepo_OngoingVerification) GetCapturedArguments() *azuredevops.GitRepository { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + adRepo := c.GetAllCapturedArguments() + return adRepo[len(adRepo)-1] } func (c *MockEventParsing_ParseAzureDevopsRepo_OngoingVerification) GetAllCapturedArguments() (_param0 []*azuredevops.GitRepository) { @@ -701,8 +701,8 @@ func (c *MockEventParsing_ParseAzureDevopsRepo_OngoingVerification) GetAllCaptur return } -func (verifier *VerifierMockEventParsing) ParseBitbucketCloudPullCommentEvent(_param0 []byte) *MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -713,8 +713,8 @@ type MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification st } func (c *MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification) GetCapturedArguments() []byte { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + body := c.GetAllCapturedArguments() + return body[len(body)-1] } func (c *MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) { @@ -728,8 +728,8 @@ func (c *MockEventParsing_ParseBitbucketCloudPullCommentEvent_OngoingVerificatio return } -func (verifier *VerifierMockEventParsing) ParseBitbucketCloudPullEvent(_param0 []byte) *MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -740,8 +740,8 @@ type MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification struct { } func (c *MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification) GetCapturedArguments() []byte { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + body := c.GetAllCapturedArguments() + return body[len(body)-1] } func (c *MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) { @@ -755,8 +755,8 @@ func (c *MockEventParsing_ParseBitbucketCloudPullEvent_OngoingVerification) GetA return } -func (verifier *VerifierMockEventParsing) ParseBitbucketServerPullCommentEvent(_param0 []byte) *MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -767,8 +767,8 @@ type MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification s } func (c *MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification) GetCapturedArguments() []byte { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + body := c.GetAllCapturedArguments() + return body[len(body)-1] } func (c *MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) { @@ -782,8 +782,8 @@ func (c *MockEventParsing_ParseBitbucketServerPullCommentEvent_OngoingVerificati return } -func (verifier *VerifierMockEventParsing) ParseBitbucketServerPullEvent(_param0 []byte) *MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -794,8 +794,8 @@ type MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification struct { } func (c *MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification) GetCapturedArguments() []byte { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + body := c.GetAllCapturedArguments() + return body[len(body)-1] } func (c *MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 [][]byte) { @@ -809,8 +809,8 @@ func (c *MockEventParsing_ParseBitbucketServerPullEvent_OngoingVerification) Get return } -func (verifier *VerifierMockEventParsing) ParseGithubIssueCommentEvent(_param0 *github.IssueCommentEvent) *MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -821,8 +821,8 @@ type MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification struct { } func (c *MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification) GetCapturedArguments() *github.IssueCommentEvent { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + comment := c.GetAllCapturedArguments() + return comment[len(comment)-1] } func (c *MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.IssueCommentEvent) { @@ -836,8 +836,8 @@ func (c *MockEventParsing_ParseGithubIssueCommentEvent_OngoingVerification) GetA return } -func (verifier *VerifierMockEventParsing) ParseGithubPull(_param0 *github.PullRequest) *MockEventParsing_ParseGithubPull_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseGithubPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -848,8 +848,8 @@ type MockEventParsing_ParseGithubPull_OngoingVerification struct { } func (c *MockEventParsing_ParseGithubPull_OngoingVerification) GetCapturedArguments() *github.PullRequest { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ghPull := c.GetAllCapturedArguments() + return ghPull[len(ghPull)-1] } func (c *MockEventParsing_ParseGithubPull_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.PullRequest) { @@ -863,8 +863,8 @@ func (c *MockEventParsing_ParseGithubPull_OngoingVerification) GetAllCapturedArg return } -func (verifier *VerifierMockEventParsing) ParseGithubPullEvent(_param0 *github.PullRequestEvent) *MockEventParsing_ParseGithubPullEvent_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseGithubPullEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -875,8 +875,8 @@ type MockEventParsing_ParseGithubPullEvent_OngoingVerification struct { } func (c *MockEventParsing_ParseGithubPullEvent_OngoingVerification) GetCapturedArguments() *github.PullRequestEvent { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pullEvent := c.GetAllCapturedArguments() + return pullEvent[len(pullEvent)-1] } func (c *MockEventParsing_ParseGithubPullEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.PullRequestEvent) { @@ -890,8 +890,8 @@ func (c *MockEventParsing_ParseGithubPullEvent_OngoingVerification) GetAllCaptur return } -func (verifier *VerifierMockEventParsing) ParseGithubRepo(_param0 *github.Repository) *MockEventParsing_ParseGithubRepo_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseGithubRepo_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -902,8 +902,8 @@ type MockEventParsing_ParseGithubRepo_OngoingVerification struct { } func (c *MockEventParsing_ParseGithubRepo_OngoingVerification) GetCapturedArguments() *github.Repository { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ghRepo := c.GetAllCapturedArguments() + return ghRepo[len(ghRepo)-1] } func (c *MockEventParsing_ParseGithubRepo_OngoingVerification) GetAllCapturedArguments() (_param0 []*github.Repository) { @@ -917,8 +917,8 @@ func (c *MockEventParsing_ParseGithubRepo_OngoingVerification) GetAllCapturedArg return } -func (verifier *VerifierMockEventParsing) ParseGitlabMergeRequest(_param0 *go_gitlab.MergeRequest, _param1 models.Repo) *MockEventParsing_ParseGitlabMergeRequest_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockEventParsing_ParseGitlabMergeRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -929,8 +929,8 @@ type MockEventParsing_ParseGitlabMergeRequest_OngoingVerification struct { } func (c *MockEventParsing_ParseGitlabMergeRequest_OngoingVerification) GetCapturedArguments() (*go_gitlab.MergeRequest, models.Repo) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + mr, baseRepo := c.GetAllCapturedArguments() + return mr[len(mr)-1], baseRepo[len(baseRepo)-1] } func (c *MockEventParsing_ParseGitlabMergeRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []*go_gitlab.MergeRequest, _param1 []models.Repo) { @@ -948,8 +948,8 @@ func (c *MockEventParsing_ParseGitlabMergeRequest_OngoingVerification) GetAllCap return } -func (verifier *VerifierMockEventParsing) ParseGitlabMergeRequestCommentEvent(_param0 go_gitlab.MergeCommentEvent) *MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -960,8 +960,8 @@ type MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification st } func (c *MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification) GetCapturedArguments() go_gitlab.MergeCommentEvent { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + event := c.GetAllCapturedArguments() + return event[len(event)-1] } func (c *MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []go_gitlab.MergeCommentEvent) { @@ -975,8 +975,8 @@ func (c *MockEventParsing_ParseGitlabMergeRequestCommentEvent_OngoingVerificatio return } -func (verifier *VerifierMockEventParsing) ParseGitlabMergeRequestEvent(_param0 go_gitlab.MergeEvent) *MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -987,8 +987,8 @@ type MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification struct { } func (c *MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification) GetCapturedArguments() go_gitlab.MergeEvent { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + event := c.GetAllCapturedArguments() + return event[len(event)-1] } func (c *MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []go_gitlab.MergeEvent) { @@ -1002,8 +1002,8 @@ func (c *MockEventParsing_ParseGitlabMergeRequestEvent_OngoingVerification) GetA return } -func (verifier *VerifierMockEventParsing) ParseGitlabMergeRequestUpdateEvent(_param0 go_gitlab.MergeEvent) *MockEventParsing_ParseGitlabMergeRequestUpdateEvent_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockEventParsing) ParseGitlabMergeRequestUpdateEvent(event go_gitlab.MergeEvent) *MockEventParsing_ParseGitlabMergeRequestUpdateEvent_OngoingVerification { + params := []pegomock.Param{event} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ParseGitlabMergeRequestUpdateEvent", params, verifier.timeout) return &MockEventParsing_ParseGitlabMergeRequestUpdateEvent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -1014,8 +1014,8 @@ type MockEventParsing_ParseGitlabMergeRequestUpdateEvent_OngoingVerification str } func (c *MockEventParsing_ParseGitlabMergeRequestUpdateEvent_OngoingVerification) GetCapturedArguments() go_gitlab.MergeEvent { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + event := c.GetAllCapturedArguments() + return event[len(event)-1] } func (c *MockEventParsing_ParseGitlabMergeRequestUpdateEvent_OngoingVerification) GetAllCapturedArguments() (_param0 []go_gitlab.MergeEvent) { diff --git a/server/events/mocks/mock_github_pull_getter.go b/server/events/mocks/mock_github_pull_getter.go index 97676764e..8a0201d43 100644 --- a/server/events/mocks/mock_github_pull_getter.go +++ b/server/events/mocks/mock_github_pull_getter.go @@ -5,7 +5,7 @@ package mocks import ( github "github.com/google/go-github/v53/github" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -26,11 +26,11 @@ func NewMockGithubPullGetter(options ...pegomock.Option) *MockGithubPullGetter { func (mock *MockGithubPullGetter) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockGithubPullGetter) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockGithubPullGetter) GetPullRequest(_param0 models.Repo, _param1 int) (*github.PullRequest, error) { +func (mock *MockGithubPullGetter) GetPullRequest(repo models.Repo, pullNum int) (*github.PullRequest, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockGithubPullGetter().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repo, pullNum} result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullRequest", params, []reflect.Type{reflect.TypeOf((**github.PullRequest)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *github.PullRequest var ret1 error @@ -82,8 +82,8 @@ type VerifierMockGithubPullGetter struct { timeout time.Duration } -func (verifier *VerifierMockGithubPullGetter) GetPullRequest(_param0 models.Repo, _param1 int) *MockGithubPullGetter_GetPullRequest_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockGithubPullGetter_GetPullRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -94,8 +94,8 @@ type MockGithubPullGetter_GetPullRequest_OngoingVerification struct { } func (c *MockGithubPullGetter_GetPullRequest_OngoingVerification) GetCapturedArguments() (models.Repo, int) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repo, pullNum := c.GetAllCapturedArguments() + return repo[len(repo)-1], pullNum[len(pullNum)-1] } func (c *MockGithubPullGetter_GetPullRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int) { diff --git a/server/events/mocks/mock_gitlab_merge_request_getter.go b/server/events/mocks/mock_gitlab_merge_request_getter.go index 1dd131d9a..76cc8565b 100644 --- a/server/events/mocks/mock_gitlab_merge_request_getter.go +++ b/server/events/mocks/mock_gitlab_merge_request_getter.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" go_gitlab "github.com/xanzy/go-gitlab" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockGitlabMergeRequestGetter(options ...pegomock.Option) *MockGitlabMerg func (mock *MockGitlabMergeRequestGetter) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockGitlabMergeRequestGetter) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockGitlabMergeRequestGetter) GetMergeRequest(_param0 string, _param1 int) (*go_gitlab.MergeRequest, error) { +func (mock *MockGitlabMergeRequestGetter) GetMergeRequest(repoFullName string, pullNum int) (*go_gitlab.MergeRequest, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockGitlabMergeRequestGetter().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repoFullName, pullNum} result := pegomock.GetGenericMockFrom(mock).Invoke("GetMergeRequest", params, []reflect.Type{reflect.TypeOf((**go_gitlab.MergeRequest)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *go_gitlab.MergeRequest var ret1 error @@ -81,8 +81,8 @@ type VerifierMockGitlabMergeRequestGetter struct { timeout time.Duration } -func (verifier *VerifierMockGitlabMergeRequestGetter) GetMergeRequest(_param0 string, _param1 int) *MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification struct { } func (c *MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification) GetCapturedArguments() (string, int) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repoFullName, pullNum := c.GetAllCapturedArguments() + return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1] } func (c *MockGitlabMergeRequestGetter_GetMergeRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) { diff --git a/server/events/mocks/mock_job_message_sender.go b/server/events/mocks/mock_job_message_sender.go index f190efc3b..380cd2267 100644 --- a/server/events/mocks/mock_job_message_sender.go +++ b/server/events/mocks/mock_job_message_sender.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockJobMessageSender(options ...pegomock.Option) *MockJobMessageSender { func (mock *MockJobMessageSender) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockJobMessageSender) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockJobMessageSender) Send(_param0 command.ProjectContext, _param1 string, _param2 bool) { +func (mock *MockJobMessageSender) Send(ctx command.ProjectContext, msg string, operationComplete bool) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockJobMessageSender().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{ctx, msg, operationComplete} pegomock.GetGenericMockFrom(mock).Invoke("Send", params, []reflect.Type{}) } @@ -70,8 +70,8 @@ type VerifierMockJobMessageSender struct { timeout time.Duration } -func (verifier *VerifierMockJobMessageSender) Send(_param0 command.ProjectContext, _param1 string, _param2 bool) *MockJobMessageSender_Send_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockJobMessageSender) Send(ctx command.ProjectContext, msg string, operationComplete bool) *MockJobMessageSender_Send_OngoingVerification { + params := []pegomock.Param{ctx, msg, operationComplete} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Send", params, verifier.timeout) return &MockJobMessageSender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -82,8 +82,8 @@ type MockJobMessageSender_Send_OngoingVerification struct { } func (c *MockJobMessageSender_Send_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, bool) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + ctx, msg, operationComplete := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], msg[len(msg)-1], operationComplete[len(operationComplete)-1] } func (c *MockJobMessageSender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 []bool) { diff --git a/server/events/mocks/mock_job_url_setter.go b/server/events/mocks/mock_job_url_setter.go index 60c8b0fcc..6d37bf9c7 100644 --- a/server/events/mocks/mock_job_url_setter.go +++ b/server/events/mocks/mock_job_url_setter.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" models "github.com/runatlantis/atlantis/server/events/models" "reflect" @@ -26,16 +26,16 @@ func NewMockJobURLSetter(options ...pegomock.Option) *MockJobURLSetter { func (mock *MockJobURLSetter) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockJobURLSetter) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockJobURLSetter) SetJobURLWithStatus(_param0 command.ProjectContext, _param1 command.Name, _param2 models.CommitStatus, _param3 *command.ProjectResult) error { +func (mock *MockJobURLSetter) SetJobURLWithStatus(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, result *command.ProjectResult) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockJobURLSetter().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} - result := pegomock.GetGenericMockFrom(mock).Invoke("SetJobURLWithStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) + params := []pegomock.Param{ctx, cmdName, status, result} + pegomockResult := pegomock.GetGenericMockFrom(mock).Invoke("SetJobURLWithStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error - if len(result) != 0 { - if result[0] != nil { - ret0 = result[0].(error) + if len(pegomockResult) != 0 { + if pegomockResult[0] != nil { + ret0 = pegomockResult[0].(error) } } return ret0 @@ -78,8 +78,8 @@ type VerifierMockJobURLSetter struct { timeout time.Duration } -func (verifier *VerifierMockJobURLSetter) SetJobURLWithStatus(_param0 command.ProjectContext, _param1 command.Name, _param2 models.CommitStatus, _param3 *command.ProjectResult) *MockJobURLSetter_SetJobURLWithStatus_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockJobURLSetter) SetJobURLWithStatus(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, result *command.ProjectResult) *MockJobURLSetter_SetJobURLWithStatus_OngoingVerification { + params := []pegomock.Param{ctx, cmdName, status, result} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SetJobURLWithStatus", params, verifier.timeout) return &MockJobURLSetter_SetJobURLWithStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -90,8 +90,8 @@ type MockJobURLSetter_SetJobURLWithStatus_OngoingVerification struct { } func (c *MockJobURLSetter_SetJobURLWithStatus_OngoingVerification) GetCapturedArguments() (command.ProjectContext, command.Name, models.CommitStatus, *command.ProjectResult) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + ctx, cmdName, status, result := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], cmdName[len(cmdName)-1], status[len(status)-1], result[len(result)-1] } func (c *MockJobURLSetter_SetJobURLWithStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []command.Name, _param2 []models.CommitStatus, _param3 []*command.ProjectResult) { diff --git a/server/events/mocks/mock_lock_url_generator.go b/server/events/mocks/mock_lock_url_generator.go index 70289fd44..bb3f40a49 100644 --- a/server/events/mocks/mock_lock_url_generator.go +++ b/server/events/mocks/mock_lock_url_generator.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -24,11 +24,11 @@ func NewMockLockURLGenerator(options ...pegomock.Option) *MockLockURLGenerator { func (mock *MockLockURLGenerator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockLockURLGenerator) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockLockURLGenerator) GenerateLockURL(_param0 string) string { +func (mock *MockLockURLGenerator) GenerateLockURL(lockID string) string { if mock == nil { panic("mock must not be nil. Use myMock := NewMockLockURLGenerator().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{lockID} result := pegomock.GetGenericMockFrom(mock).Invoke("GenerateLockURL", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem()}) var ret0 string if len(result) != 0 { @@ -76,8 +76,8 @@ type VerifierMockLockURLGenerator struct { timeout time.Duration } -func (verifier *VerifierMockLockURLGenerator) GenerateLockURL(_param0 string) *MockLockURLGenerator_GenerateLockURL_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockLockURLGenerator_GenerateLockURL_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -88,8 +88,8 @@ type MockLockURLGenerator_GenerateLockURL_OngoingVerification struct { } func (c *MockLockURLGenerator_GenerateLockURL_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + lockID := c.GetAllCapturedArguments() + return lockID[len(lockID)-1] } func (c *MockLockURLGenerator_GenerateLockURL_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { diff --git a/server/events/mocks/mock_pending_plan_finder.go b/server/events/mocks/mock_pending_plan_finder.go index c95011044..51cc57f07 100644 --- a/server/events/mocks/mock_pending_plan_finder.go +++ b/server/events/mocks/mock_pending_plan_finder.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" events "github.com/runatlantis/atlantis/server/events" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockPendingPlanFinder(options ...pegomock.Option) *MockPendingPlanFinder func (mock *MockPendingPlanFinder) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockPendingPlanFinder) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPendingPlanFinder) DeletePlans(_param0 string) error { +func (mock *MockPendingPlanFinder) DeletePlans(pullDir string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPendingPlanFinder().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pullDir} result := pegomock.GetGenericMockFrom(mock).Invoke("DeletePlans", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -40,11 +40,11 @@ func (mock *MockPendingPlanFinder) DeletePlans(_param0 string) error { return ret0 } -func (mock *MockPendingPlanFinder) Find(_param0 string) ([]events.PendingPlan, error) { +func (mock *MockPendingPlanFinder) Find(pullDir string) ([]events.PendingPlan, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPendingPlanFinder().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pullDir} result := pegomock.GetGenericMockFrom(mock).Invoke("Find", params, []reflect.Type{reflect.TypeOf((*[]events.PendingPlan)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []events.PendingPlan var ret1 error @@ -96,8 +96,8 @@ type VerifierMockPendingPlanFinder struct { timeout time.Duration } -func (verifier *VerifierMockPendingPlanFinder) DeletePlans(_param0 string) *MockPendingPlanFinder_DeletePlans_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockPendingPlanFinder_DeletePlans_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -108,8 +108,8 @@ type MockPendingPlanFinder_DeletePlans_OngoingVerification struct { } func (c *MockPendingPlanFinder_DeletePlans_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pullDir := c.GetAllCapturedArguments() + return pullDir[len(pullDir)-1] } func (c *MockPendingPlanFinder_DeletePlans_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { @@ -123,8 +123,8 @@ func (c *MockPendingPlanFinder_DeletePlans_OngoingVerification) GetAllCapturedAr return } -func (verifier *VerifierMockPendingPlanFinder) Find(_param0 string) *MockPendingPlanFinder_Find_OngoingVerification { - params := []pegomock.Param{_param0} +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 &MockPendingPlanFinder_Find_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -135,8 +135,8 @@ type MockPendingPlanFinder_Find_OngoingVerification struct { } func (c *MockPendingPlanFinder_Find_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pullDir := c.GetAllCapturedArguments() + return pullDir[len(pullDir)-1] } func (c *MockPendingPlanFinder_Find_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { diff --git a/server/events/mocks/mock_post_workflow_hook_url_generator.go b/server/events/mocks/mock_post_workflow_hook_url_generator.go index 321c3dedc..dce0a9356 100644 --- a/server/events/mocks/mock_post_workflow_hook_url_generator.go +++ b/server/events/mocks/mock_post_workflow_hook_url_generator.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -24,11 +24,11 @@ func NewMockPostWorkflowHookURLGenerator(options ...pegomock.Option) *MockPostWo func (mock *MockPostWorkflowHookURLGenerator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockPostWorkflowHookURLGenerator) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPostWorkflowHookURLGenerator) GenerateProjectWorkflowHookURL(_param0 string) (string, error) { +func (mock *MockPostWorkflowHookURLGenerator) GenerateProjectWorkflowHookURL(hookID string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPostWorkflowHookURLGenerator().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{hookID} result := pegomock.GetGenericMockFrom(mock).Invoke("GenerateProjectWorkflowHookURL", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -80,8 +80,8 @@ type VerifierMockPostWorkflowHookURLGenerator struct { timeout time.Duration } -func (verifier *VerifierMockPostWorkflowHookURLGenerator) GenerateProjectWorkflowHookURL(_param0 string) *MockPostWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockPostWorkflowHookURLGenerator) GenerateProjectWorkflowHookURL(hookID string) *MockPostWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification { + params := []pegomock.Param{hookID} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GenerateProjectWorkflowHookURL", params, verifier.timeout) return &MockPostWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -92,8 +92,8 @@ type MockPostWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVeri } func (c *MockPostWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + hookID := c.GetAllCapturedArguments() + return hookID[len(hookID)-1] } func (c *MockPostWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { diff --git a/server/events/mocks/mock_post_workflows_hooks_command_runner.go b/server/events/mocks/mock_post_workflows_hooks_command_runner.go index c3d8b576a..3163ccb52 100644 --- a/server/events/mocks/mock_post_workflows_hooks_command_runner.go +++ b/server/events/mocks/mock_post_workflows_hooks_command_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" events "github.com/runatlantis/atlantis/server/events" command "github.com/runatlantis/atlantis/server/events/command" "reflect" @@ -28,11 +28,11 @@ func (mock *MockPostWorkflowHooksCommandRunner) SetFailHandler(fh pegomock.FailH } func (mock *MockPostWorkflowHooksCommandRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPostWorkflowHooksCommandRunner) RunPostHooks(_param0 *command.Context, _param1 *events.CommentCommand) error { +func (mock *MockPostWorkflowHooksCommandRunner) RunPostHooks(ctx *command.Context, cmd *events.CommentCommand) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPostWorkflowHooksCommandRunner().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{ctx, cmd} result := pegomock.GetGenericMockFrom(mock).Invoke("RunPostHooks", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -80,8 +80,8 @@ type VerifierMockPostWorkflowHooksCommandRunner struct { timeout time.Duration } -func (verifier *VerifierMockPostWorkflowHooksCommandRunner) RunPostHooks(_param0 *command.Context, _param1 *events.CommentCommand) *MockPostWorkflowHooksCommandRunner_RunPostHooks_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockPostWorkflowHooksCommandRunner) RunPostHooks(ctx *command.Context, cmd *events.CommentCommand) *MockPostWorkflowHooksCommandRunner_RunPostHooks_OngoingVerification { + params := []pegomock.Param{ctx, cmd} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunPostHooks", params, verifier.timeout) return &MockPostWorkflowHooksCommandRunner_RunPostHooks_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -92,8 +92,8 @@ type MockPostWorkflowHooksCommandRunner_RunPostHooks_OngoingVerification struct } func (c *MockPostWorkflowHooksCommandRunner_RunPostHooks_OngoingVerification) GetCapturedArguments() (*command.Context, *events.CommentCommand) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + ctx, cmd := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], cmd[len(cmd)-1] } func (c *MockPostWorkflowHooksCommandRunner_RunPostHooks_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context, _param1 []*events.CommentCommand) { diff --git a/server/events/mocks/mock_pre_workflow_hook_url_generator.go b/server/events/mocks/mock_pre_workflow_hook_url_generator.go index c7cd47f7c..389562b40 100644 --- a/server/events/mocks/mock_pre_workflow_hook_url_generator.go +++ b/server/events/mocks/mock_pre_workflow_hook_url_generator.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -24,11 +24,11 @@ func NewMockPreWorkflowHookURLGenerator(options ...pegomock.Option) *MockPreWork func (mock *MockPreWorkflowHookURLGenerator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockPreWorkflowHookURLGenerator) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPreWorkflowHookURLGenerator) GenerateProjectWorkflowHookURL(_param0 string) (string, error) { +func (mock *MockPreWorkflowHookURLGenerator) GenerateProjectWorkflowHookURL(hookID string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPreWorkflowHookURLGenerator().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{hookID} result := pegomock.GetGenericMockFrom(mock).Invoke("GenerateProjectWorkflowHookURL", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -80,8 +80,8 @@ type VerifierMockPreWorkflowHookURLGenerator struct { timeout time.Duration } -func (verifier *VerifierMockPreWorkflowHookURLGenerator) GenerateProjectWorkflowHookURL(_param0 string) *MockPreWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockPreWorkflowHookURLGenerator) GenerateProjectWorkflowHookURL(hookID string) *MockPreWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification { + params := []pegomock.Param{hookID} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GenerateProjectWorkflowHookURL", params, verifier.timeout) return &MockPreWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -92,8 +92,8 @@ type MockPreWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerif } func (c *MockPreWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + hookID := c.GetAllCapturedArguments() + return hookID[len(hookID)-1] } func (c *MockPreWorkflowHookURLGenerator_GenerateProjectWorkflowHookURL_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { diff --git a/server/events/mocks/mock_pre_workflows_hooks_command_runner.go b/server/events/mocks/mock_pre_workflows_hooks_command_runner.go index 7110dcc33..da4c7b289 100644 --- a/server/events/mocks/mock_pre_workflows_hooks_command_runner.go +++ b/server/events/mocks/mock_pre_workflows_hooks_command_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" events "github.com/runatlantis/atlantis/server/events" command "github.com/runatlantis/atlantis/server/events/command" "reflect" @@ -28,11 +28,11 @@ func (mock *MockPreWorkflowHooksCommandRunner) SetFailHandler(fh pegomock.FailHa } func (mock *MockPreWorkflowHooksCommandRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPreWorkflowHooksCommandRunner) RunPreHooks(_param0 *command.Context, _param1 *events.CommentCommand) error { +func (mock *MockPreWorkflowHooksCommandRunner) RunPreHooks(ctx *command.Context, cmd *events.CommentCommand) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPreWorkflowHooksCommandRunner().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{ctx, cmd} result := pegomock.GetGenericMockFrom(mock).Invoke("RunPreHooks", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -80,8 +80,8 @@ type VerifierMockPreWorkflowHooksCommandRunner struct { timeout time.Duration } -func (verifier *VerifierMockPreWorkflowHooksCommandRunner) RunPreHooks(_param0 *command.Context, _param1 *events.CommentCommand) *MockPreWorkflowHooksCommandRunner_RunPreHooks_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockPreWorkflowHooksCommandRunner) RunPreHooks(ctx *command.Context, cmd *events.CommentCommand) *MockPreWorkflowHooksCommandRunner_RunPreHooks_OngoingVerification { + params := []pegomock.Param{ctx, cmd} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "RunPreHooks", params, verifier.timeout) return &MockPreWorkflowHooksCommandRunner_RunPreHooks_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -92,8 +92,8 @@ type MockPreWorkflowHooksCommandRunner_RunPreHooks_OngoingVerification struct { } func (c *MockPreWorkflowHooksCommandRunner_RunPreHooks_OngoingVerification) GetCapturedArguments() (*command.Context, *events.CommentCommand) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + ctx, cmd := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], cmd[len(cmd)-1] } func (c *MockPreWorkflowHooksCommandRunner_RunPreHooks_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context, _param1 []*events.CommentCommand) { diff --git a/server/events/mocks/mock_project_command_builder.go b/server/events/mocks/mock_project_command_builder.go index b746e18b0..6a68f048b 100644 --- a/server/events/mocks/mock_project_command_builder.go +++ b/server/events/mocks/mock_project_command_builder.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" events "github.com/runatlantis/atlantis/server/events" command "github.com/runatlantis/atlantis/server/events/command" "reflect" @@ -26,11 +26,11 @@ func NewMockProjectCommandBuilder(options ...pegomock.Option) *MockProjectComman func (mock *MockProjectCommandBuilder) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockProjectCommandBuilder) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockProjectCommandBuilder) BuildApplyCommands(_param0 *command.Context, _param1 *events.CommentCommand) ([]command.ProjectContext, error) { +func (mock *MockProjectCommandBuilder) BuildApplyCommands(ctx *command.Context, comment *events.CommentCommand) ([]command.ProjectContext, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{ctx, comment} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildApplyCommands", params, []reflect.Type{reflect.TypeOf((*[]command.ProjectContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []command.ProjectContext var ret1 error @@ -45,11 +45,11 @@ func (mock *MockProjectCommandBuilder) BuildApplyCommands(_param0 *command.Conte return ret0, ret1 } -func (mock *MockProjectCommandBuilder) BuildApprovePoliciesCommands(_param0 *command.Context, _param1 *events.CommentCommand) ([]command.ProjectContext, error) { +func (mock *MockProjectCommandBuilder) BuildApprovePoliciesCommands(ctx *command.Context, comment *events.CommentCommand) ([]command.ProjectContext, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{ctx, comment} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildApprovePoliciesCommands", params, []reflect.Type{reflect.TypeOf((*[]command.ProjectContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []command.ProjectContext var ret1 error @@ -64,11 +64,11 @@ func (mock *MockProjectCommandBuilder) BuildApprovePoliciesCommands(_param0 *com return ret0, ret1 } -func (mock *MockProjectCommandBuilder) BuildAutoplanCommands(_param0 *command.Context) ([]command.ProjectContext, error) { +func (mock *MockProjectCommandBuilder) BuildAutoplanCommands(ctx *command.Context) ([]command.ProjectContext, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildAutoplanCommands", params, []reflect.Type{reflect.TypeOf((*[]command.ProjectContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []command.ProjectContext var ret1 error @@ -83,11 +83,11 @@ func (mock *MockProjectCommandBuilder) BuildAutoplanCommands(_param0 *command.Co return ret0, ret1 } -func (mock *MockProjectCommandBuilder) BuildImportCommands(_param0 *command.Context, _param1 *events.CommentCommand) ([]command.ProjectContext, error) { +func (mock *MockProjectCommandBuilder) BuildImportCommands(ctx *command.Context, comment *events.CommentCommand) ([]command.ProjectContext, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{ctx, comment} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildImportCommands", params, []reflect.Type{reflect.TypeOf((*[]command.ProjectContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []command.ProjectContext var ret1 error @@ -102,11 +102,11 @@ func (mock *MockProjectCommandBuilder) BuildImportCommands(_param0 *command.Cont return ret0, ret1 } -func (mock *MockProjectCommandBuilder) BuildPlanCommands(_param0 *command.Context, _param1 *events.CommentCommand) ([]command.ProjectContext, error) { +func (mock *MockProjectCommandBuilder) BuildPlanCommands(ctx *command.Context, comment *events.CommentCommand) ([]command.ProjectContext, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{ctx, comment} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildPlanCommands", params, []reflect.Type{reflect.TypeOf((*[]command.ProjectContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []command.ProjectContext var ret1 error @@ -121,11 +121,11 @@ func (mock *MockProjectCommandBuilder) BuildPlanCommands(_param0 *command.Contex return ret0, ret1 } -func (mock *MockProjectCommandBuilder) BuildStateRmCommands(_param0 *command.Context, _param1 *events.CommentCommand) ([]command.ProjectContext, error) { +func (mock *MockProjectCommandBuilder) BuildStateRmCommands(ctx *command.Context, comment *events.CommentCommand) ([]command.ProjectContext, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{ctx, comment} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildStateRmCommands", params, []reflect.Type{reflect.TypeOf((*[]command.ProjectContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []command.ProjectContext var ret1 error @@ -140,11 +140,11 @@ func (mock *MockProjectCommandBuilder) BuildStateRmCommands(_param0 *command.Con return ret0, ret1 } -func (mock *MockProjectCommandBuilder) BuildVersionCommands(_param0 *command.Context, _param1 *events.CommentCommand) ([]command.ProjectContext, error) { +func (mock *MockProjectCommandBuilder) BuildVersionCommands(ctx *command.Context, comment *events.CommentCommand) ([]command.ProjectContext, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandBuilder().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{ctx, comment} result := pegomock.GetGenericMockFrom(mock).Invoke("BuildVersionCommands", params, []reflect.Type{reflect.TypeOf((*[]command.ProjectContext)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []command.ProjectContext var ret1 error @@ -196,8 +196,8 @@ type VerifierMockProjectCommandBuilder struct { timeout time.Duration } -func (verifier *VerifierMockProjectCommandBuilder) BuildApplyCommands(_param0 *command.Context, _param1 *events.CommentCommand) *MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockProjectCommandBuilder) BuildApplyCommands(ctx *command.Context, 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 &MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -208,8 +208,8 @@ type MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification struct { } func (c *MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification) GetCapturedArguments() (*command.Context, *events.CommentCommand) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + ctx, comment := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], comment[len(comment)-1] } func (c *MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context, _param1 []*events.CommentCommand) { @@ -227,8 +227,8 @@ func (c *MockProjectCommandBuilder_BuildApplyCommands_OngoingVerification) GetAl return } -func (verifier *VerifierMockProjectCommandBuilder) BuildApprovePoliciesCommands(_param0 *command.Context, _param1 *events.CommentCommand) *MockProjectCommandBuilder_BuildApprovePoliciesCommands_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockProjectCommandBuilder) BuildApprovePoliciesCommands(ctx *command.Context, comment *events.CommentCommand) *MockProjectCommandBuilder_BuildApprovePoliciesCommands_OngoingVerification { + params := []pegomock.Param{ctx, comment} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildApprovePoliciesCommands", params, verifier.timeout) return &MockProjectCommandBuilder_BuildApprovePoliciesCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -239,8 +239,8 @@ type MockProjectCommandBuilder_BuildApprovePoliciesCommands_OngoingVerification } func (c *MockProjectCommandBuilder_BuildApprovePoliciesCommands_OngoingVerification) GetCapturedArguments() (*command.Context, *events.CommentCommand) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + ctx, comment := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], comment[len(comment)-1] } func (c *MockProjectCommandBuilder_BuildApprovePoliciesCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context, _param1 []*events.CommentCommand) { @@ -258,8 +258,8 @@ func (c *MockProjectCommandBuilder_BuildApprovePoliciesCommands_OngoingVerificat return } -func (verifier *VerifierMockProjectCommandBuilder) BuildAutoplanCommands(_param0 *command.Context) *MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandBuilder) BuildAutoplanCommands(ctx *command.Context) *MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification { + params := []pegomock.Param{ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildAutoplanCommands", params, verifier.timeout) return &MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -270,8 +270,8 @@ type MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification struct } func (c *MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification) GetCapturedArguments() *command.Context { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ctx := c.GetAllCapturedArguments() + return ctx[len(ctx)-1] } func (c *MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context) { @@ -285,8 +285,8 @@ func (c *MockProjectCommandBuilder_BuildAutoplanCommands_OngoingVerification) Ge return } -func (verifier *VerifierMockProjectCommandBuilder) BuildImportCommands(_param0 *command.Context, _param1 *events.CommentCommand) *MockProjectCommandBuilder_BuildImportCommands_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockProjectCommandBuilder) BuildImportCommands(ctx *command.Context, comment *events.CommentCommand) *MockProjectCommandBuilder_BuildImportCommands_OngoingVerification { + params := []pegomock.Param{ctx, comment} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildImportCommands", params, verifier.timeout) return &MockProjectCommandBuilder_BuildImportCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -297,8 +297,8 @@ type MockProjectCommandBuilder_BuildImportCommands_OngoingVerification struct { } func (c *MockProjectCommandBuilder_BuildImportCommands_OngoingVerification) GetCapturedArguments() (*command.Context, *events.CommentCommand) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + ctx, comment := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], comment[len(comment)-1] } func (c *MockProjectCommandBuilder_BuildImportCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context, _param1 []*events.CommentCommand) { @@ -316,8 +316,8 @@ func (c *MockProjectCommandBuilder_BuildImportCommands_OngoingVerification) GetA return } -func (verifier *VerifierMockProjectCommandBuilder) BuildPlanCommands(_param0 *command.Context, _param1 *events.CommentCommand) *MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockProjectCommandBuilder) BuildPlanCommands(ctx *command.Context, 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 &MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -328,8 +328,8 @@ type MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification struct { } func (c *MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification) GetCapturedArguments() (*command.Context, *events.CommentCommand) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + ctx, comment := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], comment[len(comment)-1] } func (c *MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context, _param1 []*events.CommentCommand) { @@ -347,8 +347,8 @@ func (c *MockProjectCommandBuilder_BuildPlanCommands_OngoingVerification) GetAll return } -func (verifier *VerifierMockProjectCommandBuilder) BuildStateRmCommands(_param0 *command.Context, _param1 *events.CommentCommand) *MockProjectCommandBuilder_BuildStateRmCommands_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockProjectCommandBuilder) BuildStateRmCommands(ctx *command.Context, comment *events.CommentCommand) *MockProjectCommandBuilder_BuildStateRmCommands_OngoingVerification { + params := []pegomock.Param{ctx, comment} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildStateRmCommands", params, verifier.timeout) return &MockProjectCommandBuilder_BuildStateRmCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -359,8 +359,8 @@ type MockProjectCommandBuilder_BuildStateRmCommands_OngoingVerification struct { } func (c *MockProjectCommandBuilder_BuildStateRmCommands_OngoingVerification) GetCapturedArguments() (*command.Context, *events.CommentCommand) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + ctx, comment := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], comment[len(comment)-1] } func (c *MockProjectCommandBuilder_BuildStateRmCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context, _param1 []*events.CommentCommand) { @@ -378,8 +378,8 @@ func (c *MockProjectCommandBuilder_BuildStateRmCommands_OngoingVerification) Get return } -func (verifier *VerifierMockProjectCommandBuilder) BuildVersionCommands(_param0 *command.Context, _param1 *events.CommentCommand) *MockProjectCommandBuilder_BuildVersionCommands_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockProjectCommandBuilder) BuildVersionCommands(ctx *command.Context, comment *events.CommentCommand) *MockProjectCommandBuilder_BuildVersionCommands_OngoingVerification { + params := []pegomock.Param{ctx, comment} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "BuildVersionCommands", params, verifier.timeout) return &MockProjectCommandBuilder_BuildVersionCommands_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -390,8 +390,8 @@ type MockProjectCommandBuilder_BuildVersionCommands_OngoingVerification struct { } func (c *MockProjectCommandBuilder_BuildVersionCommands_OngoingVerification) GetCapturedArguments() (*command.Context, *events.CommentCommand) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + ctx, comment := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], comment[len(comment)-1] } func (c *MockProjectCommandBuilder_BuildVersionCommands_OngoingVerification) GetAllCapturedArguments() (_param0 []*command.Context, _param1 []*events.CommentCommand) { diff --git a/server/events/mocks/mock_project_command_runner.go b/server/events/mocks/mock_project_command_runner.go index b8a5116b8..be42228cd 100644 --- a/server/events/mocks/mock_project_command_runner.go +++ b/server/events/mocks/mock_project_command_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockProjectCommandRunner(options ...pegomock.Option) *MockProjectCommand func (mock *MockProjectCommandRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockProjectCommandRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockProjectCommandRunner) Apply(_param0 command.ProjectContext) command.ProjectResult { +func (mock *MockProjectCommandRunner) Apply(ctx command.ProjectContext) command.ProjectResult { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandRunner().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("Apply", params, []reflect.Type{reflect.TypeOf((*command.ProjectResult)(nil)).Elem()}) var ret0 command.ProjectResult if len(result) != 0 { @@ -40,11 +40,11 @@ func (mock *MockProjectCommandRunner) Apply(_param0 command.ProjectContext) comm return ret0 } -func (mock *MockProjectCommandRunner) ApprovePolicies(_param0 command.ProjectContext) command.ProjectResult { +func (mock *MockProjectCommandRunner) ApprovePolicies(ctx command.ProjectContext) command.ProjectResult { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandRunner().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("ApprovePolicies", params, []reflect.Type{reflect.TypeOf((*command.ProjectResult)(nil)).Elem()}) var ret0 command.ProjectResult if len(result) != 0 { @@ -55,11 +55,11 @@ func (mock *MockProjectCommandRunner) ApprovePolicies(_param0 command.ProjectCon return ret0 } -func (mock *MockProjectCommandRunner) Import(_param0 command.ProjectContext) command.ProjectResult { +func (mock *MockProjectCommandRunner) Import(ctx command.ProjectContext) command.ProjectResult { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandRunner().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("Import", params, []reflect.Type{reflect.TypeOf((*command.ProjectResult)(nil)).Elem()}) var ret0 command.ProjectResult if len(result) != 0 { @@ -70,11 +70,11 @@ func (mock *MockProjectCommandRunner) Import(_param0 command.ProjectContext) com return ret0 } -func (mock *MockProjectCommandRunner) Plan(_param0 command.ProjectContext) command.ProjectResult { +func (mock *MockProjectCommandRunner) Plan(ctx command.ProjectContext) command.ProjectResult { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandRunner().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("Plan", params, []reflect.Type{reflect.TypeOf((*command.ProjectResult)(nil)).Elem()}) var ret0 command.ProjectResult if len(result) != 0 { @@ -85,11 +85,11 @@ func (mock *MockProjectCommandRunner) Plan(_param0 command.ProjectContext) comma return ret0 } -func (mock *MockProjectCommandRunner) PolicyCheck(_param0 command.ProjectContext) command.ProjectResult { +func (mock *MockProjectCommandRunner) PolicyCheck(ctx command.ProjectContext) command.ProjectResult { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandRunner().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("PolicyCheck", params, []reflect.Type{reflect.TypeOf((*command.ProjectResult)(nil)).Elem()}) var ret0 command.ProjectResult if len(result) != 0 { @@ -100,11 +100,11 @@ func (mock *MockProjectCommandRunner) PolicyCheck(_param0 command.ProjectContext return ret0 } -func (mock *MockProjectCommandRunner) StateRm(_param0 command.ProjectContext) command.ProjectResult { +func (mock *MockProjectCommandRunner) StateRm(ctx command.ProjectContext) command.ProjectResult { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandRunner().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("StateRm", params, []reflect.Type{reflect.TypeOf((*command.ProjectResult)(nil)).Elem()}) var ret0 command.ProjectResult if len(result) != 0 { @@ -115,11 +115,11 @@ func (mock *MockProjectCommandRunner) StateRm(_param0 command.ProjectContext) co return ret0 } -func (mock *MockProjectCommandRunner) Version(_param0 command.ProjectContext) command.ProjectResult { +func (mock *MockProjectCommandRunner) Version(ctx command.ProjectContext) command.ProjectResult { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandRunner().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{ctx} result := pegomock.GetGenericMockFrom(mock).Invoke("Version", params, []reflect.Type{reflect.TypeOf((*command.ProjectResult)(nil)).Elem()}) var ret0 command.ProjectResult if len(result) != 0 { @@ -167,8 +167,8 @@ type VerifierMockProjectCommandRunner struct { timeout time.Duration } -func (verifier *VerifierMockProjectCommandRunner) Apply(_param0 command.ProjectContext) *MockProjectCommandRunner_Apply_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandRunner) Apply(ctx command.ProjectContext) *MockProjectCommandRunner_Apply_OngoingVerification { + params := []pegomock.Param{ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Apply", params, verifier.timeout) return &MockProjectCommandRunner_Apply_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -179,8 +179,8 @@ type MockProjectCommandRunner_Apply_OngoingVerification struct { } func (c *MockProjectCommandRunner_Apply_OngoingVerification) GetCapturedArguments() command.ProjectContext { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ctx := c.GetAllCapturedArguments() + return ctx[len(ctx)-1] } func (c *MockProjectCommandRunner_Apply_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext) { @@ -194,8 +194,8 @@ func (c *MockProjectCommandRunner_Apply_OngoingVerification) GetAllCapturedArgum return } -func (verifier *VerifierMockProjectCommandRunner) ApprovePolicies(_param0 command.ProjectContext) *MockProjectCommandRunner_ApprovePolicies_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandRunner) ApprovePolicies(ctx command.ProjectContext) *MockProjectCommandRunner_ApprovePolicies_OngoingVerification { + params := []pegomock.Param{ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ApprovePolicies", params, verifier.timeout) return &MockProjectCommandRunner_ApprovePolicies_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -206,8 +206,8 @@ type MockProjectCommandRunner_ApprovePolicies_OngoingVerification struct { } func (c *MockProjectCommandRunner_ApprovePolicies_OngoingVerification) GetCapturedArguments() command.ProjectContext { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ctx := c.GetAllCapturedArguments() + return ctx[len(ctx)-1] } func (c *MockProjectCommandRunner_ApprovePolicies_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext) { @@ -221,8 +221,8 @@ func (c *MockProjectCommandRunner_ApprovePolicies_OngoingVerification) GetAllCap return } -func (verifier *VerifierMockProjectCommandRunner) Import(_param0 command.ProjectContext) *MockProjectCommandRunner_Import_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandRunner) Import(ctx command.ProjectContext) *MockProjectCommandRunner_Import_OngoingVerification { + params := []pegomock.Param{ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Import", params, verifier.timeout) return &MockProjectCommandRunner_Import_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -233,8 +233,8 @@ type MockProjectCommandRunner_Import_OngoingVerification struct { } func (c *MockProjectCommandRunner_Import_OngoingVerification) GetCapturedArguments() command.ProjectContext { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ctx := c.GetAllCapturedArguments() + return ctx[len(ctx)-1] } func (c *MockProjectCommandRunner_Import_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext) { @@ -248,8 +248,8 @@ func (c *MockProjectCommandRunner_Import_OngoingVerification) GetAllCapturedArgu return } -func (verifier *VerifierMockProjectCommandRunner) Plan(_param0 command.ProjectContext) *MockProjectCommandRunner_Plan_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandRunner) Plan(ctx command.ProjectContext) *MockProjectCommandRunner_Plan_OngoingVerification { + params := []pegomock.Param{ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Plan", params, verifier.timeout) return &MockProjectCommandRunner_Plan_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -260,8 +260,8 @@ type MockProjectCommandRunner_Plan_OngoingVerification struct { } func (c *MockProjectCommandRunner_Plan_OngoingVerification) GetCapturedArguments() command.ProjectContext { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ctx := c.GetAllCapturedArguments() + return ctx[len(ctx)-1] } func (c *MockProjectCommandRunner_Plan_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext) { @@ -275,8 +275,8 @@ func (c *MockProjectCommandRunner_Plan_OngoingVerification) GetAllCapturedArgume return } -func (verifier *VerifierMockProjectCommandRunner) PolicyCheck(_param0 command.ProjectContext) *MockProjectCommandRunner_PolicyCheck_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandRunner) PolicyCheck(ctx command.ProjectContext) *MockProjectCommandRunner_PolicyCheck_OngoingVerification { + params := []pegomock.Param{ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PolicyCheck", params, verifier.timeout) return &MockProjectCommandRunner_PolicyCheck_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -287,8 +287,8 @@ type MockProjectCommandRunner_PolicyCheck_OngoingVerification struct { } func (c *MockProjectCommandRunner_PolicyCheck_OngoingVerification) GetCapturedArguments() command.ProjectContext { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ctx := c.GetAllCapturedArguments() + return ctx[len(ctx)-1] } func (c *MockProjectCommandRunner_PolicyCheck_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext) { @@ -302,8 +302,8 @@ func (c *MockProjectCommandRunner_PolicyCheck_OngoingVerification) GetAllCapture return } -func (verifier *VerifierMockProjectCommandRunner) StateRm(_param0 command.ProjectContext) *MockProjectCommandRunner_StateRm_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandRunner) StateRm(ctx command.ProjectContext) *MockProjectCommandRunner_StateRm_OngoingVerification { + params := []pegomock.Param{ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "StateRm", params, verifier.timeout) return &MockProjectCommandRunner_StateRm_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -314,8 +314,8 @@ type MockProjectCommandRunner_StateRm_OngoingVerification struct { } func (c *MockProjectCommandRunner_StateRm_OngoingVerification) GetCapturedArguments() command.ProjectContext { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ctx := c.GetAllCapturedArguments() + return ctx[len(ctx)-1] } func (c *MockProjectCommandRunner_StateRm_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext) { @@ -329,8 +329,8 @@ func (c *MockProjectCommandRunner_StateRm_OngoingVerification) GetAllCapturedArg return } -func (verifier *VerifierMockProjectCommandRunner) Version(_param0 command.ProjectContext) *MockProjectCommandRunner_Version_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandRunner) Version(ctx command.ProjectContext) *MockProjectCommandRunner_Version_OngoingVerification { + params := []pegomock.Param{ctx} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Version", params, verifier.timeout) return &MockProjectCommandRunner_Version_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -341,8 +341,8 @@ type MockProjectCommandRunner_Version_OngoingVerification struct { } func (c *MockProjectCommandRunner_Version_OngoingVerification) GetCapturedArguments() command.ProjectContext { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + ctx := c.GetAllCapturedArguments() + return ctx[len(ctx)-1] } func (c *MockProjectCommandRunner_Version_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext) { diff --git a/server/events/mocks/mock_project_lock.go b/server/events/mocks/mock_project_lock.go index fa702d8db..ab54c2487 100644 --- a/server/events/mocks/mock_project_lock.go +++ b/server/events/mocks/mock_project_lock.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" events "github.com/runatlantis/atlantis/server/events" models "github.com/runatlantis/atlantis/server/events/models" logging "github.com/runatlantis/atlantis/server/logging" @@ -27,11 +27,11 @@ func NewMockProjectLocker(options ...pegomock.Option) *MockProjectLocker { func (mock *MockProjectLocker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockProjectLocker) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockProjectLocker) TryLock(_param0 logging.SimpleLogging, _param1 models.PullRequest, _param2 models.User, _param3 string, _param4 models.Project, _param5 bool) (*events.TryLockResponse, error) { +func (mock *MockProjectLocker) TryLock(log logging.SimpleLogging, pull models.PullRequest, user models.User, workspace string, project models.Project, repoLocking bool) (*events.TryLockResponse, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectLocker().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} + params := []pegomock.Param{log, pull, user, workspace, project, repoLocking} result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((**events.TryLockResponse)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *events.TryLockResponse var ret1 error @@ -83,8 +83,8 @@ type VerifierMockProjectLocker struct { timeout time.Duration } -func (verifier *VerifierMockProjectLocker) TryLock(_param0 logging.SimpleLogging, _param1 models.PullRequest, _param2 models.User, _param3 string, _param4 models.Project, _param5 bool) *MockProjectLocker_TryLock_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} +func (verifier *VerifierMockProjectLocker) TryLock(log logging.SimpleLogging, pull models.PullRequest, user models.User, workspace string, project models.Project, repoLocking bool) *MockProjectLocker_TryLock_OngoingVerification { + params := []pegomock.Param{log, pull, user, workspace, project, repoLocking} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout) return &MockProjectLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -95,8 +95,8 @@ type MockProjectLocker_TryLock_OngoingVerification struct { } func (c *MockProjectLocker_TryLock_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, models.PullRequest, models.User, string, models.Project, bool) { - _param0, _param1, _param2, _param3, _param4, _param5 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1], _param5[len(_param5)-1] + log, pull, user, workspace, project, repoLocking := c.GetAllCapturedArguments() + return log[len(log)-1], pull[len(pull)-1], user[len(user)-1], workspace[len(workspace)-1], project[len(project)-1], repoLocking[len(repoLocking)-1] } func (c *MockProjectLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []models.PullRequest, _param2 []models.User, _param3 []string, _param4 []models.Project, _param5 []bool) { diff --git a/server/events/mocks/mock_pull_cleaner.go b/server/events/mocks/mock_pull_cleaner.go index de319eea5..588f9b3d3 100644 --- a/server/events/mocks/mock_pull_cleaner.go +++ b/server/events/mocks/mock_pull_cleaner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockPullCleaner(options ...pegomock.Option) *MockPullCleaner { func (mock *MockPullCleaner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockPullCleaner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPullCleaner) CleanUpPull(_param0 models.Repo, _param1 models.PullRequest) error { +func (mock *MockPullCleaner) CleanUpPull(repo models.Repo, pull models.PullRequest) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPullCleaner().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repo, pull} result := pegomock.GetGenericMockFrom(mock).Invoke("CleanUpPull", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -77,8 +77,8 @@ type VerifierMockPullCleaner struct { timeout time.Duration } -func (verifier *VerifierMockPullCleaner) CleanUpPull(_param0 models.Repo, _param1 models.PullRequest) *MockPullCleaner_CleanUpPull_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockPullCleaner_CleanUpPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -89,8 +89,8 @@ type MockPullCleaner_CleanUpPull_OngoingVerification struct { } func (c *MockPullCleaner_CleanUpPull_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repo, pull := c.GetAllCapturedArguments() + return repo[len(repo)-1], pull[len(pull)-1] } func (c *MockPullCleaner_CleanUpPull_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { diff --git a/server/events/mocks/mock_resource_cleaner.go b/server/events/mocks/mock_resource_cleaner.go index 6e88d85cf..a09a8ee7b 100644 --- a/server/events/mocks/mock_resource_cleaner.go +++ b/server/events/mocks/mock_resource_cleaner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" jobs "github.com/runatlantis/atlantis/server/jobs" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockResourceCleaner(options ...pegomock.Option) *MockResourceCleaner { func (mock *MockResourceCleaner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockResourceCleaner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockResourceCleaner) CleanUp(_param0 jobs.PullInfo) { +func (mock *MockResourceCleaner) CleanUp(pullInfo jobs.PullInfo) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockResourceCleaner().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pullInfo} pegomock.GetGenericMockFrom(mock).Invoke("CleanUp", params, []reflect.Type{}) } @@ -70,8 +70,8 @@ type VerifierMockResourceCleaner struct { timeout time.Duration } -func (verifier *VerifierMockResourceCleaner) CleanUp(_param0 jobs.PullInfo) *MockResourceCleaner_CleanUp_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockResourceCleaner) CleanUp(pullInfo jobs.PullInfo) *MockResourceCleaner_CleanUp_OngoingVerification { + params := []pegomock.Param{pullInfo} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CleanUp", params, verifier.timeout) return &MockResourceCleaner_CleanUp_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -82,8 +82,8 @@ type MockResourceCleaner_CleanUp_OngoingVerification struct { } func (c *MockResourceCleaner_CleanUp_OngoingVerification) GetCapturedArguments() jobs.PullInfo { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pullInfo := c.GetAllCapturedArguments() + return pullInfo[len(pullInfo)-1] } func (c *MockResourceCleaner_CleanUp_OngoingVerification) GetAllCapturedArguments() (_param0 []jobs.PullInfo) { diff --git a/server/events/mocks/mock_step_runner.go b/server/events/mocks/mock_step_runner.go index 5d9944838..fdfd95aa7 100644 --- a/server/events/mocks/mock_step_runner.go +++ b/server/events/mocks/mock_step_runner.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockStepRunner(options ...pegomock.Option) *MockStepRunner { func (mock *MockStepRunner) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockStepRunner) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockStepRunner) Run(_param0 command.ProjectContext, _param1 []string, _param2 string, _param3 map[string]string) (string, error) { +func (mock *MockStepRunner) Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockStepRunner().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{ctx, extraArgs, path, envs} result := pegomock.GetGenericMockFrom(mock).Invoke("Run", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -81,8 +81,8 @@ type VerifierMockStepRunner struct { timeout time.Duration } -func (verifier *VerifierMockStepRunner) Run(_param0 command.ProjectContext, _param1 []string, _param2 string, _param3 map[string]string) *MockStepRunner_Run_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockStepRunner) Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) *MockStepRunner_Run_OngoingVerification { + params := []pegomock.Param{ctx, extraArgs, path, envs} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Run", params, verifier.timeout) return &MockStepRunner_Run_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockStepRunner_Run_OngoingVerification struct { } func (c *MockStepRunner_Run_OngoingVerification) GetCapturedArguments() (command.ProjectContext, []string, string, map[string]string) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + ctx, extraArgs, path, envs := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], extraArgs[len(extraArgs)-1], path[len(path)-1], envs[len(envs)-1] } func (c *MockStepRunner_Run_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 [][]string, _param2 []string, _param3 []map[string]string) { diff --git a/server/events/mocks/mock_webhooks_sender.go b/server/events/mocks/mock_webhooks_sender.go index 4906e48b3..48a3dcd57 100644 --- a/server/events/mocks/mock_webhooks_sender.go +++ b/server/events/mocks/mock_webhooks_sender.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" webhooks "github.com/runatlantis/atlantis/server/events/webhooks" logging "github.com/runatlantis/atlantis/server/logging" "reflect" @@ -26,11 +26,11 @@ func NewMockWebhooksSender(options ...pegomock.Option) *MockWebhooksSender { func (mock *MockWebhooksSender) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockWebhooksSender) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockWebhooksSender) Send(_param0 logging.SimpleLogging, _param1 webhooks.ApplyResult) error { +func (mock *MockWebhooksSender) Send(log logging.SimpleLogging, res webhooks.ApplyResult) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWebhooksSender().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{log, res} result := pegomock.GetGenericMockFrom(mock).Invoke("Send", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -78,8 +78,8 @@ type VerifierMockWebhooksSender struct { timeout time.Duration } -func (verifier *VerifierMockWebhooksSender) Send(_param0 logging.SimpleLogging, _param1 webhooks.ApplyResult) *MockWebhooksSender_Send_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockWebhooksSender) Send(log logging.SimpleLogging, 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 &MockWebhooksSender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -90,8 +90,8 @@ type MockWebhooksSender_Send_OngoingVerification struct { } func (c *MockWebhooksSender_Send_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, webhooks.ApplyResult) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + log, res := c.GetAllCapturedArguments() + return log[len(log)-1], res[len(res)-1] } func (c *MockWebhooksSender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []webhooks.ApplyResult) { diff --git a/server/events/mocks/mock_working_dir.go b/server/events/mocks/mock_working_dir.go index bc95a5d46..e3b56c584 100644 --- a/server/events/mocks/mock_working_dir.go +++ b/server/events/mocks/mock_working_dir.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" logging "github.com/runatlantis/atlantis/server/logging" "reflect" @@ -26,11 +26,11 @@ func NewMockWorkingDir(options ...pegomock.Option) *MockWorkingDir { func (mock *MockWorkingDir) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockWorkingDir) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockWorkingDir) Clone(_param0 logging.SimpleLogging, _param1 models.Repo, _param2 models.PullRequest, _param3 string) (string, bool, error) { +func (mock *MockWorkingDir) Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) (string, bool, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{log, headRepo, p, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("Clone", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 bool @@ -49,11 +49,11 @@ func (mock *MockWorkingDir) Clone(_param0 logging.SimpleLogging, _param1 models. return ret0, ret1, ret2 } -func (mock *MockWorkingDir) Delete(_param0 models.Repo, _param1 models.PullRequest) error { +func (mock *MockWorkingDir) Delete(r models.Repo, p models.PullRequest) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{r, p} result := pegomock.GetGenericMockFrom(mock).Invoke("Delete", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -64,11 +64,11 @@ func (mock *MockWorkingDir) Delete(_param0 models.Repo, _param1 models.PullReque return ret0 } -func (mock *MockWorkingDir) DeleteForWorkspace(_param0 models.Repo, _param1 models.PullRequest, _param2 string) error { +func (mock *MockWorkingDir) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{r, p, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("DeleteForWorkspace", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -79,11 +79,11 @@ func (mock *MockWorkingDir) DeleteForWorkspace(_param0 models.Repo, _param1 mode return ret0 } -func (mock *MockWorkingDir) GetPullDir(_param0 models.Repo, _param1 models.PullRequest) (string, error) { +func (mock *MockWorkingDir) GetPullDir(r models.Repo, p models.PullRequest) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{r, p} result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullDir", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -98,11 +98,11 @@ func (mock *MockWorkingDir) GetPullDir(_param0 models.Repo, _param1 models.PullR return ret0, ret1 } -func (mock *MockWorkingDir) GetWorkingDir(_param0 models.Repo, _param1 models.PullRequest, _param2 string) (string, error) { +func (mock *MockWorkingDir) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{r, p, workspace} result := pegomock.GetGenericMockFrom(mock).Invoke("GetWorkingDir", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -117,11 +117,11 @@ func (mock *MockWorkingDir) GetWorkingDir(_param0 models.Repo, _param1 models.Pu return ret0, ret1 } -func (mock *MockWorkingDir) HasDiverged(_param0 logging.SimpleLogging, _param1 string) bool { +func (mock *MockWorkingDir) HasDiverged(log logging.SimpleLogging, cloneDir string) bool { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDir().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{log, cloneDir} result := pegomock.GetGenericMockFrom(mock).Invoke("HasDiverged", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()}) var ret0 bool if len(result) != 0 { @@ -177,8 +177,8 @@ type VerifierMockWorkingDir struct { timeout time.Duration } -func (verifier *VerifierMockWorkingDir) Clone(_param0 logging.SimpleLogging, _param1 models.Repo, _param2 models.PullRequest, _param3 string) *MockWorkingDir_Clone_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockWorkingDir) Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) *MockWorkingDir_Clone_OngoingVerification { + params := []pegomock.Param{log, headRepo, p, workspace} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Clone", params, verifier.timeout) return &MockWorkingDir_Clone_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -189,8 +189,8 @@ type MockWorkingDir_Clone_OngoingVerification struct { } func (c *MockWorkingDir_Clone_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, models.Repo, models.PullRequest, string) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + log, headRepo, p, workspace := c.GetAllCapturedArguments() + return log[len(log)-1], headRepo[len(headRepo)-1], p[len(p)-1], workspace[len(workspace)-1] } func (c *MockWorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []models.Repo, _param2 []models.PullRequest, _param3 []string) { @@ -216,8 +216,8 @@ func (c *MockWorkingDir_Clone_OngoingVerification) GetAllCapturedArguments() (_p return } -func (verifier *VerifierMockWorkingDir) Delete(_param0 models.Repo, _param1 models.PullRequest) *MockWorkingDir_Delete_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockWorkingDir_Delete_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -228,8 +228,8 @@ type MockWorkingDir_Delete_OngoingVerification struct { } func (c *MockWorkingDir_Delete_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + r, p := c.GetAllCapturedArguments() + return r[len(r)-1], p[len(p)-1] } func (c *MockWorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { @@ -247,8 +247,8 @@ func (c *MockWorkingDir_Delete_OngoingVerification) GetAllCapturedArguments() (_ return } -func (verifier *VerifierMockWorkingDir) DeleteForWorkspace(_param0 models.Repo, _param1 models.PullRequest, _param2 string) *MockWorkingDir_DeleteForWorkspace_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +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 &MockWorkingDir_DeleteForWorkspace_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -259,8 +259,8 @@ type MockWorkingDir_DeleteForWorkspace_OngoingVerification struct { } func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + r, p, workspace := c.GetAllCapturedArguments() + return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1] } func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) { @@ -282,8 +282,8 @@ func (c *MockWorkingDir_DeleteForWorkspace_OngoingVerification) GetAllCapturedAr return } -func (verifier *VerifierMockWorkingDir) GetPullDir(_param0 models.Repo, _param1 models.PullRequest) *MockWorkingDir_GetPullDir_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockWorkingDir_GetPullDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -294,8 +294,8 @@ type MockWorkingDir_GetPullDir_OngoingVerification struct { } func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + r, p := c.GetAllCapturedArguments() + return r[len(r)-1], p[len(p)-1] } func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { @@ -313,8 +313,8 @@ func (c *MockWorkingDir_GetPullDir_OngoingVerification) GetAllCapturedArguments( return } -func (verifier *VerifierMockWorkingDir) GetWorkingDir(_param0 models.Repo, _param1 models.PullRequest, _param2 string) *MockWorkingDir_GetWorkingDir_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +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 &MockWorkingDir_GetWorkingDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -325,8 +325,8 @@ type MockWorkingDir_GetWorkingDir_OngoingVerification struct { } func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + r, p, workspace := c.GetAllCapturedArguments() + return r[len(r)-1], p[len(p)-1], workspace[len(workspace)-1] } func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) { @@ -348,8 +348,8 @@ func (c *MockWorkingDir_GetWorkingDir_OngoingVerification) GetAllCapturedArgumen return } -func (verifier *VerifierMockWorkingDir) HasDiverged(_param0 logging.SimpleLogging, _param1 string) *MockWorkingDir_HasDiverged_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockWorkingDir) HasDiverged(log logging.SimpleLogging, cloneDir string) *MockWorkingDir_HasDiverged_OngoingVerification { + params := []pegomock.Param{log, cloneDir} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HasDiverged", params, verifier.timeout) return &MockWorkingDir_HasDiverged_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -360,8 +360,8 @@ type MockWorkingDir_HasDiverged_OngoingVerification struct { } func (c *MockWorkingDir_HasDiverged_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + log, cloneDir := c.GetAllCapturedArguments() + return log[len(log)-1], cloneDir[len(cloneDir)-1] } func (c *MockWorkingDir_HasDiverged_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []string) { diff --git a/server/events/mocks/mock_working_dir_locker.go b/server/events/mocks/mock_working_dir_locker.go index e7af0bced..6bb1cde91 100644 --- a/server/events/mocks/mock_working_dir_locker.go +++ b/server/events/mocks/mock_working_dir_locker.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) @@ -24,11 +24,11 @@ func NewMockWorkingDirLocker(options ...pegomock.Option) *MockWorkingDirLocker { func (mock *MockWorkingDirLocker) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockWorkingDirLocker) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockWorkingDirLocker) TryLock(_param0 string, _param1 int, _param2 string, _param3 string) (func(), error) { +func (mock *MockWorkingDirLocker) TryLock(repoFullName string, pullNum int, workspace string, path string) (func(), error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDirLocker().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{repoFullName, pullNum, workspace, path} result := pegomock.GetGenericMockFrom(mock).Invoke("TryLock", params, []reflect.Type{reflect.TypeOf((*func())(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 func() var ret1 error @@ -43,11 +43,11 @@ func (mock *MockWorkingDirLocker) TryLock(_param0 string, _param1 int, _param2 s return ret0, ret1 } -func (mock *MockWorkingDirLocker) TryLockPull(_param0 string, _param1 int) (func(), error) { +func (mock *MockWorkingDirLocker) TryLockPull(repoFullName string, pullNum int) (func(), error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockWorkingDirLocker().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repoFullName, pullNum} result := pegomock.GetGenericMockFrom(mock).Invoke("TryLockPull", params, []reflect.Type{reflect.TypeOf((*func())(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 func() var ret1 error @@ -99,8 +99,8 @@ type VerifierMockWorkingDirLocker struct { timeout time.Duration } -func (verifier *VerifierMockWorkingDirLocker) TryLock(_param0 string, _param1 int, _param2 string, _param3 string) *MockWorkingDirLocker_TryLock_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockWorkingDirLocker) TryLock(repoFullName string, pullNum int, workspace string, path string) *MockWorkingDirLocker_TryLock_OngoingVerification { + params := []pegomock.Param{repoFullName, pullNum, workspace, path} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "TryLock", params, verifier.timeout) return &MockWorkingDirLocker_TryLock_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -111,8 +111,8 @@ type MockWorkingDirLocker_TryLock_OngoingVerification struct { } func (c *MockWorkingDirLocker_TryLock_OngoingVerification) GetCapturedArguments() (string, int, string, string) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + repoFullName, pullNum, workspace, path := c.GetAllCapturedArguments() + return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1], workspace[len(workspace)-1], path[len(path)-1] } func (c *MockWorkingDirLocker_TryLock_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int, _param2 []string, _param3 []string) { @@ -138,8 +138,8 @@ func (c *MockWorkingDirLocker_TryLock_OngoingVerification) GetAllCapturedArgumen return } -func (verifier *VerifierMockWorkingDirLocker) TryLockPull(_param0 string, _param1 int) *MockWorkingDirLocker_TryLockPull_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockWorkingDirLocker_TryLockPull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -150,8 +150,8 @@ type MockWorkingDirLocker_TryLockPull_OngoingVerification struct { } func (c *MockWorkingDirLocker_TryLockPull_OngoingVerification) GetCapturedArguments() (string, int) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repoFullName, pullNum := c.GetAllCapturedArguments() + return repoFullName[len(repoFullName)-1], pullNum[len(pullNum)-1] } func (c *MockWorkingDirLocker_TryLockPull_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []int) { diff --git a/server/events/pending_plan_finder.go b/server/events/pending_plan_finder.go index 49ee6e422..1a621fb13 100644 --- a/server/events/pending_plan_finder.go +++ b/server/events/pending_plan_finder.go @@ -10,7 +10,7 @@ import ( "github.com/runatlantis/atlantis/server/core/runtime" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_pending_plan_finder.go PendingPlanFinder +//go:generate pegomock generate --package mocks -o mocks/mock_pending_plan_finder.go PendingPlanFinder type PendingPlanFinder interface { Find(pullDir string) ([]PendingPlan, error) diff --git a/server/events/plan_command_runner_test.go b/server/events/plan_command_runner_test.go index aabda358b..1d4b44150 100644 --- a/server/events/plan_command_runner_test.go +++ b/server/events/plan_command_runner_test.go @@ -5,11 +5,10 @@ import ( "testing" "github.com/google/go-github/v53/github" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/db" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/events/models/testdata" "github.com/runatlantis/atlantis/server/logging" @@ -129,24 +128,24 @@ func TestPlanCommandRunner_IsSilenced(t *testing.T) { timesComment = 0 } - vcsClient.VerifyWasCalled(Times(timesComment)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()) + vcsClient.VerifyWasCalled(Times(timesComment)).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) if c.ExpVCSStatusSet { commitUpdater.VerifyWasCalledOnce().UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.EqModelsCommitStatus(models.SuccessCommitStatus), - matchers.EqCommandName(command.Plan), - EqInt(c.ExpVCSStatusSucc), - EqInt(c.ExpVCSStatusTotal), + Any[models.Repo](), + Any[models.PullRequest](), + Eq[models.CommitStatus](models.SuccessCommitStatus), + Eq[command.Name](command.Plan), + Eq(c.ExpVCSStatusSucc), + Eq(c.ExpVCSStatusTotal), ) } else { commitUpdater.VerifyWasCalled(Never()).UpdateCombinedCount( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - matchers.AnyModelsCommitStatus(), - matchers.EqCommandName(command.Plan), - AnyInt(), - AnyInt(), + Any[models.Repo](), + Any[models.PullRequest](), + Any[models.CommitStatus](), + Eq[command.Name](command.Plan), + Any[int](), + Any[int](), ) } }) @@ -504,7 +503,7 @@ func TestPlanCommandRunner_ExecutionOrder(t *testing.T) { } vcsClient.VerifyWasCalledOnce().CreateComment( - AnyRepo(), EqInt(modelPull.Num), AnyString(), EqString("plan"), + Any[models.Repo](), Eq(modelPull.Num), Any[string](), Eq("plan"), ) }) } diff --git a/server/events/post_workflow_hooks_command_runner.go b/server/events/post_workflow_hooks_command_runner.go index fc83ef590..ec8ef12aa 100644 --- a/server/events/post_workflow_hooks_command_runner.go +++ b/server/events/post_workflow_hooks_command_runner.go @@ -11,14 +11,14 @@ import ( "github.com/runatlantis/atlantis/server/events/vcs" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_post_workflow_hook_url_generator.go PostWorkflowHookURLGenerator +//go:generate pegomock generate --package mocks -o mocks/mock_post_workflow_hook_url_generator.go PostWorkflowHookURLGenerator // PostWorkflowHookURLGenerator generates urls to view the post workflow progress. type PostWorkflowHookURLGenerator interface { GenerateProjectWorkflowHookURL(hookID string) (string, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_post_workflows_hooks_command_runner.go PostWorkflowHooksCommandRunner +//go:generate pegomock generate --package mocks -o mocks/mock_post_workflows_hooks_command_runner.go PostWorkflowHooksCommandRunner type PostWorkflowHooksCommandRunner interface { RunPostHooks(ctx *command.Context, cmd *CommentCommand) error diff --git a/server/events/post_workflow_hooks_command_runner_test.go b/server/events/post_workflow_hooks_command_runner_test.go index 884ce710f..061212d95 100644 --- a/server/events/post_workflow_hooks_command_runner_test.go +++ b/server/events/post_workflow_hooks_command_runner_test.go @@ -5,11 +5,9 @@ import ( "testing" "github.com/google/uuid" - runtime_mocks "github.com/runatlantis/atlantis/server/core/runtime/mocks" - runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers" - - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/config/valid" + runtime_mocks "github.com/runatlantis/atlantis/server/core/runtime/mocks" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/mocks" @@ -106,7 +104,7 @@ func TestRunPostHooks_Clone(t *testing.T) { err := postWh.RunPostHooks(ctx, nil) Ok(t, err) - whPostWorkflowHookRunner.VerifyWasCalledOnce().Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir)) + whPostWorkflowHookRunner.VerifyWasCalledOnce().Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir)) Assert(t, *unlockCalled == true, "unlock function called") }) t.Run("success hooks not in cfg", func(t *testing.T) { @@ -218,7 +216,7 @@ func TestRunPostHooks_Clone(t *testing.T) { When(postWhWorkingDirLocker.TryLock(testdata.GithubRepo.FullName, newPull.Num, events.DefaultWorkspace, events.DefaultRepoRelDir)).ThenReturn(unlockFn, nil) When(postWhWorkingDir.Clone(log, testdata.GithubRepo, newPull, events.DefaultWorkspace)).ThenReturn(repoDir, false, nil) - When(whPostWorkflowHookRunner.Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir))).ThenReturn(result, runtimeDesc, errors.New("some error")) + When(whPostWorkflowHookRunner.Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir))).ThenReturn(result, runtimeDesc, errors.New("some error")) err := postWh.RunPostHooks(ctx, nil) @@ -256,12 +254,12 @@ func TestRunPostHooks_Clone(t *testing.T) { When(postWhWorkingDirLocker.TryLock(testdata.GithubRepo.FullName, newPull.Num, events.DefaultWorkspace, events.DefaultRepoRelDir)).ThenReturn(unlockFn, nil) When(postWhWorkingDir.Clone(log, testdata.GithubRepo, newPull, events.DefaultWorkspace)).ThenReturn(repoDir, false, nil) - When(whPostWorkflowHookRunner.Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir))).ThenReturn(result, runtimeDesc, nil) + When(whPostWorkflowHookRunner.Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir))).ThenReturn(result, runtimeDesc, nil) err := postWh.RunPostHooks(ctx, cmd) Ok(t, err) - whPostWorkflowHookRunner.VerifyWasCalledOnce().Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir)) + whPostWorkflowHookRunner.VerifyWasCalledOnce().Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir)) Assert(t, *unlockCalled == true, "unlock function called") }) } diff --git a/server/events/pre_workflow_hooks_command_runner.go b/server/events/pre_workflow_hooks_command_runner.go index 99ed659b9..ccd513a41 100644 --- a/server/events/pre_workflow_hooks_command_runner.go +++ b/server/events/pre_workflow_hooks_command_runner.go @@ -11,14 +11,14 @@ import ( "github.com/runatlantis/atlantis/server/events/vcs" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_pre_workflow_hook_url_generator.go PreWorkflowHookURLGenerator +//go:generate pegomock generate --package mocks -o mocks/mock_pre_workflow_hook_url_generator.go PreWorkflowHookURLGenerator // PreWorkflowHookURLGenerator generates urls to view the pre workflow progress. type PreWorkflowHookURLGenerator interface { GenerateProjectWorkflowHookURL(hookID string) (string, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_pre_workflows_hooks_command_runner.go PreWorkflowHooksCommandRunner +//go:generate pegomock generate --package mocks -o mocks/mock_pre_workflows_hooks_command_runner.go PreWorkflowHooksCommandRunner type PreWorkflowHooksCommandRunner interface { RunPreHooks(ctx *command.Context, cmd *CommentCommand) error diff --git a/server/events/pre_workflow_hooks_command_runner_test.go b/server/events/pre_workflow_hooks_command_runner_test.go index 019430bed..aa5286f7d 100644 --- a/server/events/pre_workflow_hooks_command_runner_test.go +++ b/server/events/pre_workflow_hooks_command_runner_test.go @@ -4,10 +4,9 @@ import ( "errors" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/config/valid" runtime_mocks "github.com/runatlantis/atlantis/server/core/runtime/mocks" - runtimematchers "github.com/runatlantis/atlantis/server/core/runtime/mocks/matchers" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/mocks" @@ -102,12 +101,12 @@ func TestRunPreHooks_Clone(t *testing.T) { When(preWhWorkingDirLocker.TryLock(testdata.GithubRepo.FullName, newPull.Num, events.DefaultWorkspace, events.DefaultRepoRelDir)).ThenReturn(unlockFn, nil) When(preWhWorkingDir.Clone(log, testdata.GithubRepo, newPull, events.DefaultWorkspace)).ThenReturn(repoDir, false, nil) - When(whPreWorkflowHookRunner.Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir))).ThenReturn(result, runtimeDesc, nil) + When(whPreWorkflowHookRunner.Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir))).ThenReturn(result, runtimeDesc, nil) err := preWh.RunPreHooks(ctx, nil) Ok(t, err) - whPreWorkflowHookRunner.VerifyWasCalledOnce().Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir)) + whPreWorkflowHookRunner.VerifyWasCalledOnce().Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir)) Assert(t, *unlockCalled == true, "unlock function called") }) @@ -136,7 +135,7 @@ func TestRunPreHooks_Clone(t *testing.T) { Ok(t, err) - whPreWorkflowHookRunner.VerifyWasCalled(Never()).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir)) + whPreWorkflowHookRunner.VerifyWasCalled(Never()).Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir)) preWhWorkingDirLocker.VerifyWasCalled(Never()).TryLock(testdata.GithubRepo.FullName, newPull.Num, events.DefaultWorkspace, "") preWhWorkingDir.VerifyWasCalled(Never()).Clone(log, testdata.GithubRepo, newPull, events.DefaultWorkspace) }) @@ -163,7 +162,7 @@ func TestRunPreHooks_Clone(t *testing.T) { Assert(t, err != nil, "error not nil") preWhWorkingDir.VerifyWasCalled(Never()).Clone(log, testdata.GithubRepo, newPull, events.DefaultWorkspace) - whPreWorkflowHookRunner.VerifyWasCalled(Never()).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir)) + whPreWorkflowHookRunner.VerifyWasCalled(Never()).Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir)) }) t.Run("error cloning", func(t *testing.T) { @@ -194,7 +193,7 @@ func TestRunPreHooks_Clone(t *testing.T) { Assert(t, err != nil, "error not nil") - whPreWorkflowHookRunner.VerifyWasCalled(Never()).Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir)) + whPreWorkflowHookRunner.VerifyWasCalled(Never()).Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir)) Assert(t, *unlockCalled == true, "unlock function called") }) @@ -221,7 +220,7 @@ func TestRunPreHooks_Clone(t *testing.T) { When(preWhWorkingDirLocker.TryLock(testdata.GithubRepo.FullName, newPull.Num, events.DefaultWorkspace, events.DefaultRepoRelDir)).ThenReturn(unlockFn, nil) When(preWhWorkingDir.Clone(log, testdata.GithubRepo, newPull, events.DefaultWorkspace)).ThenReturn(repoDir, false, nil) - When(whPreWorkflowHookRunner.Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir))).ThenReturn(result, runtimeDesc, errors.New("some error")) + When(whPreWorkflowHookRunner.Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir))).ThenReturn(result, runtimeDesc, errors.New("some error")) err := preWh.RunPreHooks(ctx, nil) @@ -259,12 +258,12 @@ func TestRunPreHooks_Clone(t *testing.T) { When(preWhWorkingDirLocker.TryLock(testdata.GithubRepo.FullName, newPull.Num, events.DefaultWorkspace, events.DefaultRepoRelDir)).ThenReturn(unlockFn, nil) When(preWhWorkingDir.Clone(log, testdata.GithubRepo, newPull, events.DefaultWorkspace)).ThenReturn(repoDir, false, nil) - When(whPreWorkflowHookRunner.Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir))).ThenReturn(result, runtimeDesc, nil) + When(whPreWorkflowHookRunner.Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir))).ThenReturn(result, runtimeDesc, nil) err := preWh.RunPreHooks(ctx, cmd) Ok(t, err) - whPreWorkflowHookRunner.VerifyWasCalledOnce().Run(runtimematchers.AnyModelsWorkflowHookCommandContext(), EqString(testHook.RunCommand), EqString(repoDir)) + whPreWorkflowHookRunner.VerifyWasCalledOnce().Run(Any[models.WorkflowHookCommandContext](), Eq(testHook.RunCommand), Eq(repoDir)) Assert(t, *unlockCalled == true, "unlock function called") }) } diff --git a/server/events/project_command_builder.go b/server/events/project_command_builder.go index 046de76c3..3eba0a215 100644 --- a/server/events/project_command_builder.go +++ b/server/events/project_command_builder.go @@ -178,7 +178,7 @@ type ProjectStateCommandBuilder interface { BuildStateRmCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_project_command_builder.go ProjectCommandBuilder +//go:generate pegomock generate --package mocks -o mocks/mock_project_command_builder.go ProjectCommandBuilder // ProjectCommandBuilder builds commands that run on individual projects. type ProjectCommandBuilder interface { diff --git a/server/events/project_command_builder_internal_test.go b/server/events/project_command_builder_internal_test.go index 74e48a21d..8fbe51177 100644 --- a/server/events/project_command_builder_internal_test.go +++ b/server/events/project_command_builder_internal_test.go @@ -6,16 +6,14 @@ import ( "testing" version "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/config" "github.com/runatlantis/atlantis/server/core/config/valid" "github.com/runatlantis/atlantis/server/core/terraform/mocks" "github.com/runatlantis/atlantis/server/events/command" - "github.com/runatlantis/atlantis/server/events/matchers" "github.com/runatlantis/atlantis/server/events/models" vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks" "github.com/runatlantis/atlantis/server/logging" - logging_matchers "github.com/runatlantis/atlantis/server/logging/mocks/matchers" "github.com/runatlantis/atlantis/server/metrics" . "github.com/runatlantis/atlantis/testing" ) @@ -632,9 +630,9 @@ projects: }) workingDir := NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmp, false, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmp, false, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"modules/module/main.tf"}, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn([]string{"modules/module/main.tf"}, nil) // Write and parse the global config file. globalCfgPath := filepath.Join(tmp, "global.yaml") @@ -846,9 +844,9 @@ projects: }) workingDir := NewMockWorkingDir() - When(workingDir.Clone(logging_matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmp, false, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmp, false, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"modules/module/main.tf"}, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn([]string{"modules/module/main.tf"}, nil) // Write and parse the global config file. globalCfgPath := filepath.Join(tmp, "global.yaml") @@ -1085,9 +1083,9 @@ workflows: }) workingDir := NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmp, false, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmp, false, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"modules/module/main.tf"}, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn([]string{"modules/module/main.tf"}, nil) // Write and parse the global config file. globalCfgPath := filepath.Join(tmp, "global.yaml") @@ -1237,9 +1235,9 @@ projects: }) workingDir := NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmp, false, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmp, false, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"modules/module/main.tf"}, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn([]string{"modules/module/main.tf"}, nil) // Write and parse the global config file. globalCfgPath := filepath.Join(tmp, "global.yaml") diff --git a/server/events/project_command_builder_test.go b/server/events/project_command_builder_test.go index e4e83aaad..3969c711c 100644 --- a/server/events/project_command_builder_test.go +++ b/server/events/project_command_builder_test.go @@ -7,14 +7,13 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" terraform_mocks "github.com/runatlantis/atlantis/server/core/terraform/mocks" "github.com/runatlantis/atlantis/server/core/config" "github.com/runatlantis/atlantis/server/core/config/valid" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" - "github.com/runatlantis/atlantis/server/events/matchers" "github.com/runatlantis/atlantis/server/events/mocks" "github.com/runatlantis/atlantis/server/events/models" vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks" @@ -125,7 +124,7 @@ projects: scope, _, _ := metrics.NewLoggingScope(logger, "atlantis") terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) for _, c := range cases { t.Run(c.Description, func(t *testing.T) { @@ -135,9 +134,9 @@ projects: }) workingDir := mocks.NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, false, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, false, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"main.tf"}, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn([]string{"main.tf"}, nil) if c.AtlantisYAML != "" { err := os.WriteFile(filepath.Join(tmpDir, valid.DefaultAtlantisFile), []byte(c.AtlantisYAML), 0600) Ok(t, err) @@ -423,10 +422,10 @@ projects: }) workingDir := mocks.NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, false, nil) - When(workingDir.GetWorkingDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, false, nil) + When(workingDir.GetWorkingDir(Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"main.tf"}, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn([]string{"main.tf"}, nil) if c.AtlantisYAML != "" { err := os.WriteFile(filepath.Join(tmpDir, valid.DefaultAtlantisFile), []byte(c.AtlantisYAML), 0600) Ok(t, err) @@ -440,7 +439,7 @@ projects: } terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( false, @@ -605,10 +604,10 @@ projects: tmpDir := DirStructure(t, c.DirectoryStructure) workingDir := mocks.NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, false, nil) - When(workingDir.GetWorkingDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, false, nil) + When(workingDir.GetWorkingDir(Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil) if c.AtlantisYAML != "" { err := os.WriteFile(filepath.Join(tmpDir, valid.DefaultAtlantisFile), []byte(c.AtlantisYAML), 0600) Ok(t, err) @@ -622,7 +621,7 @@ projects: } terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( false, @@ -791,10 +790,10 @@ projects: tmpDir := DirStructure(t, c.DirStructure) workingDir := mocks.NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, false, nil) - When(workingDir.GetWorkingDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, false, nil) + When(workingDir.GetWorkingDir(Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil) if c.AtlantisYAML != "" { err := os.WriteFile(filepath.Join(tmpDir, valid.DefaultAtlantisFile), []byte(c.AtlantisYAML), 0600) Ok(t, err) @@ -808,7 +807,7 @@ projects: } terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( false, @@ -892,8 +891,8 @@ func TestDefaultProjectCommandBuilder_BuildMultiApply(t *testing.T) { workingDir := mocks.NewMockWorkingDir() When(workingDir.GetPullDir( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest())). + Any[models.Repo](), + Any[models.PullRequest]())). ThenReturn(tmpDir, nil) logger := logging.NewNoopLogger(t) @@ -907,7 +906,7 @@ func TestDefaultProjectCommandBuilder_BuildMultiApply(t *testing.T) { scope, _, _ := metrics.NewLoggingScope(logger, "atlantis") terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( false, @@ -979,14 +978,14 @@ projects: Ok(t, err) When(workingDir.Clone( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString())).ThenReturn(repoDir, false, nil) + Any[logging.SimpleLogging](), + Any[models.Repo](), + Any[models.PullRequest](), + Any[string]())).ThenReturn(repoDir, false, nil) When(workingDir.GetWorkingDir( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString())).ThenReturn(repoDir, nil) + Any[models.Repo](), + Any[models.PullRequest](), + Any[string]())).ThenReturn(repoDir, nil) globalCfgArgs := valid.GlobalCfgArgs{ AllowRepoCfg: true, @@ -997,7 +996,7 @@ projects: logger := logging.NewNoopLogger(t) scope, _, _ := metrics.NewLoggingScope(logger, "atlantis") terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( false, @@ -1069,10 +1068,10 @@ func TestDefaultProjectCommandBuilder_EscapeArgs(t *testing.T) { }) workingDir := mocks.NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, false, nil) - When(workingDir.GetWorkingDir(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, false, nil) + When(workingDir.GetWorkingDir(Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"main.tf"}, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn([]string{"main.tf"}, nil) globalCfgArgs := valid.GlobalCfgArgs{ AllowRepoCfg: true, @@ -1082,7 +1081,7 @@ func TestDefaultProjectCommandBuilder_EscapeArgs(t *testing.T) { } terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( false, @@ -1219,19 +1218,19 @@ projects: tmpDir := DirStructure(t, testCase.DirStructure) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(testCase.ModifiedFiles, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(testCase.ModifiedFiles, nil) workingDir := mocks.NewMockWorkingDir() When(workingDir.Clone( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString())).ThenReturn(tmpDir, false, nil) + Any[logging.SimpleLogging](), + Any[models.Repo](), + Any[models.PullRequest](), + Any[string]())).ThenReturn(tmpDir, false, nil) When(workingDir.GetWorkingDir( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString())).ThenReturn(tmpDir, nil) + Any[models.Repo](), + Any[models.PullRequest](), + Any[string]())).ThenReturn(tmpDir, nil) globalCfgArgs := valid.GlobalCfgArgs{ AllowRepoCfg: true, @@ -1241,7 +1240,7 @@ projects: } terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.DetectVersion(matchers.AnyLoggingSimpleLogging(), AnyString())).Then(func(params []Param) ReturnValues { + When(terraformClient.DetectVersion(Any[logging.SimpleLogging](), Any[string]())).Then(func(params []Param) ReturnValues { projectName := filepath.Base(params[1].(string)) testVersion := testCase.Exp[projectName] if testVersion != "" { @@ -1328,9 +1327,9 @@ parallel_plan: true`, for _, c := range cases { RegisterMockTestingT(t) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil) - When(vcsClient.SupportsSingleFileDownload(matchers.AnyModelsRepo())).ThenReturn(true) - When(vcsClient.GetFileContent(matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(true, []byte(c.AtlantisYAML), nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn(c.ModifiedFiles, nil) + When(vcsClient.SupportsSingleFileDownload(Any[models.Repo]())).ThenReturn(true) + When(vcsClient.GetFileContent(Any[models.PullRequest](), Any[string]())).ThenReturn(true, []byte(c.AtlantisYAML), nil) workingDir := mocks.NewMockWorkingDir() logger := logging.NewNoopLogger(t) @@ -1343,7 +1342,7 @@ parallel_plan: true`, } scope, _, _ := metrics.NewLoggingScope(logger, "atlantis") terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( false, @@ -1380,7 +1379,7 @@ parallel_plan: true`, }) Ok(t, err) Equals(t, c.ExpectedCtxs, len(actCtxs)) - workingDir.VerifyWasCalled(c.ExpectedClones).Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString()) + workingDir.VerifyWasCalled(c.ExpectedClones).Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]()) } } @@ -1394,9 +1393,9 @@ func TestDefaultProjectCommandBuilder_WithPolicyCheckEnabled_BuildAutoplanComman scope, _, _ := metrics.NewLoggingScope(logger, "atlantis") workingDir := mocks.NewMockWorkingDir() - When(workingDir.Clone(matchers.AnyLoggingSimpleLogging(), matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest(), AnyString())).ThenReturn(tmpDir, false, nil) + When(workingDir.Clone(Any[logging.SimpleLogging](), Any[models.Repo](), Any[models.PullRequest](), Any[string]())).ThenReturn(tmpDir, false, nil) vcsClient := vcsmocks.NewMockClient() - When(vcsClient.GetModifiedFiles(matchers.AnyModelsRepo(), matchers.AnyModelsPullRequest())).ThenReturn([]string{"main.tf"}, nil) + When(vcsClient.GetModifiedFiles(Any[models.Repo](), Any[models.PullRequest]())).ThenReturn([]string{"main.tf"}, nil) globalCfgArgs := valid.GlobalCfgArgs{ AllowRepoCfg: false, @@ -1407,7 +1406,7 @@ func TestDefaultProjectCommandBuilder_WithPolicyCheckEnabled_BuildAutoplanComman globalCfg := valid.NewGlobalCfgFromArgs(globalCfgArgs) terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( true, @@ -1480,8 +1479,8 @@ func TestDefaultProjectCommandBuilder_BuildVersionCommand(t *testing.T) { workingDir := mocks.NewMockWorkingDir() When(workingDir.GetPullDir( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest())). + Any[models.Repo](), + Any[models.PullRequest]())). ThenReturn(tmpDir, nil) logger := logging.NewNoopLogger(t) @@ -1494,7 +1493,7 @@ func TestDefaultProjectCommandBuilder_BuildVersionCommand(t *testing.T) { UnDivergedReq: false, } terraformClient := terraform_mocks.NewMockClient() - When(terraformClient.ListAvailableVersions(matchers.AnyLoggingSimpleLogging())).ThenReturn([]string{}, nil) + When(terraformClient.ListAvailableVersions(Any[logging.SimpleLogging]())).ThenReturn([]string{}, nil) builder := events.NewProjectCommandBuilder( false, diff --git a/server/events/project_command_context_builder_test.go b/server/events/project_command_context_builder_test.go index 859d33da7..8bee1d9fb 100644 --- a/server/events/project_command_context_builder_test.go +++ b/server/events/project_command_context_builder_test.go @@ -3,7 +3,7 @@ package events_test import ( "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/config/valid" terraform_mocks "github.com/runatlantis/atlantis/server/core/terraform/mocks" "github.com/runatlantis/atlantis/server/events" diff --git a/server/events/project_command_runner.go b/server/events/project_command_runner.go index ff0100224..f8e9c4249 100644 --- a/server/events/project_command_runner.go +++ b/server/events/project_command_runner.go @@ -44,7 +44,7 @@ func (d DirNotExistErr) Error() string { return fmt.Sprintf("dir %q does not exist", d.RepoRelDir) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_lock_url_generator.go LockURLGenerator +//go:generate pegomock generate --package mocks -o mocks/mock_lock_url_generator.go LockURLGenerator // LockURLGenerator generates urls to locks. type LockURLGenerator interface { @@ -52,7 +52,7 @@ type LockURLGenerator interface { GenerateLockURL(lockID string) string } -//go:generate pegomock generate -m --package mocks -o mocks/mock_step_runner.go StepRunner +//go:generate pegomock generate --package mocks -o mocks/mock_step_runner.go StepRunner // StepRunner runs steps. Steps are individual pieces of execution like // `terraform plan`. @@ -61,7 +61,7 @@ type StepRunner interface { Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_custom_step_runner.go CustomStepRunner +//go:generate pegomock generate --package mocks -o mocks/mock_custom_step_runner.go CustomStepRunner // CustomStepRunner runs custom run steps. type CustomStepRunner interface { @@ -69,7 +69,7 @@ type CustomStepRunner interface { Run(ctx command.ProjectContext, cmd string, path string, envs map[string]string, streamOutput bool) (string, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_env_step_runner.go EnvStepRunner +//go:generate pegomock generate --package mocks -o mocks/mock_env_step_runner.go EnvStepRunner // EnvStepRunner runs env steps. type EnvStepRunner interface { @@ -82,7 +82,7 @@ type MultiEnvStepRunner interface { Run(ctx command.ProjectContext, cmd string, path string, envs map[string]string) (string, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_webhooks_sender.go WebhooksSender +//go:generate pegomock generate --package mocks -o mocks/mock_webhooks_sender.go WebhooksSender // WebhooksSender sends webhook. type WebhooksSender interface { @@ -90,7 +90,7 @@ type WebhooksSender interface { Send(log logging.SimpleLogging, res webhooks.ApplyResult) error } -//go:generate pegomock generate -m --package mocks -o mocks/mock_project_command_runner.go ProjectCommandRunner +//go:generate pegomock generate --package mocks -o mocks/mock_project_command_runner.go ProjectCommandRunner type ProjectPlanCommandRunner interface { // Plan runs terraform plan for the project described by ctx. @@ -139,7 +139,7 @@ type ProjectCommandRunner interface { ProjectStateCommandRunner } -//go:generate pegomock generate -m --package mocks -o mocks/mock_job_url_setter.go JobURLSetter +//go:generate pegomock generate --package mocks -o mocks/mock_job_url_setter.go JobURLSetter type JobURLSetter interface { // SetJobURLWithStatus sets the commit status for the project represented by @@ -147,7 +147,7 @@ type JobURLSetter interface { SetJobURLWithStatus(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, result *command.ProjectResult) error } -//go:generate pegomock generate -m --package mocks -o mocks/mock_job_message_sender.go JobMessageSender +//go:generate pegomock generate --package mocks -o mocks/mock_job_message_sender.go JobMessageSender type JobMessageSender interface { Send(ctx command.ProjectContext, msg string, operationComplete bool) diff --git a/server/events/project_command_runner_test.go b/server/events/project_command_runner_test.go index 304e183ad..1d2224c50 100644 --- a/server/events/project_command_runner_test.go +++ b/server/events/project_command_runner_test.go @@ -20,14 +20,13 @@ import ( "testing" "github.com/hashicorp/go-version" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/config/valid" "github.com/runatlantis/atlantis/server/core/runtime" tmocks "github.com/runatlantis/atlantis/server/core/terraform/mocks" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/mocks" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/events/models/testdata" vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks" @@ -65,17 +64,17 @@ func TestDefaultProjectCommandRunner_Plan(t *testing.T) { repoDir := t.TempDir() When(mockWorkingDir.Clone( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString(), + Any[logging.SimpleLogging](), + Any[models.Repo](), + Any[models.PullRequest](), + Any[string](), )).ThenReturn(repoDir, false, nil) When(mockLocker.TryLock( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsPullRequest(), - matchers.AnyModelsUser(), - AnyString(), - matchers.AnyModelsProject(), + Any[logging.SimpleLogging](), + Any[models.PullRequest](), + Any[models.User](), + Any[string](), + Any[models.Project](), AnyBool(), )).ThenReturn(&events.TryLockResponse{ LockAcquired: true, @@ -219,8 +218,8 @@ func TestProjectOutputWrapper(t *testing.T) { expCommitStatus = models.FailedCommitStatus } - When(mockProjectCommandRunner.Plan(matchers.AnyCommandProjectContext())).ThenReturn(prjResult) - When(mockProjectCommandRunner.Apply(matchers.AnyCommandProjectContext())).ThenReturn(prjResult) + When(mockProjectCommandRunner.Plan(Any[command.ProjectContext]())).ThenReturn(prjResult) + When(mockProjectCommandRunner.Apply(Any[command.ProjectContext]())).ThenReturn(prjResult) switch c.CommandName { case command.Plan: @@ -434,9 +433,9 @@ func TestDefaultProjectCommandRunner_Apply(t *testing.T) { } repoDir := t.TempDir() When(mockWorkingDir.GetWorkingDir( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString(), + Any[models.Repo](), + Any[models.PullRequest](), + Any[string](), )).ThenReturn(repoDir, nil) ctx := command.ProjectContext{ @@ -505,9 +504,9 @@ func TestDefaultProjectCommandRunner_ApplyRunStepFailure(t *testing.T) { } repoDir := t.TempDir() When(mockWorkingDir.GetWorkingDir( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString(), + Any[models.Repo](), + Any[models.PullRequest](), + Any[string](), )).ThenReturn(repoDir, nil) ctx := command.ProjectContext{ @@ -563,17 +562,17 @@ func TestDefaultProjectCommandRunner_RunEnvSteps(t *testing.T) { repoDir := t.TempDir() When(mockWorkingDir.Clone( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString(), + Any[logging.SimpleLogging](), + Any[models.Repo](), + Any[models.PullRequest](), + Any[string](), )).ThenReturn(repoDir, false, nil) When(mockLocker.TryLock( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsPullRequest(), - matchers.AnyModelsUser(), - AnyString(), - matchers.AnyModelsProject(), + Any[logging.SimpleLogging](), + Any[models.PullRequest](), + Any[models.User](), + Any[string](), + Any[models.Project](), AnyBool(), )).ThenReturn(&events.TryLockResponse{ LockAcquired: true, @@ -650,11 +649,11 @@ func TestDefaultProjectCommandRunner_Import(t *testing.T) { }, setup: func(repoDir string, ctx command.ProjectContext, mockLocker *mocks.MockProjectLocker, mockInit *mocks.MockStepRunner, mockImport *mocks.MockStepRunner) { When(mockLocker.TryLock( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsPullRequest(), - matchers.AnyModelsUser(), - AnyString(), - matchers.AnyModelsProject(), + Any[logging.SimpleLogging](), + Any[models.PullRequest](), + Any[models.User](), + Any[string](), + Any[models.Project](), AnyBool(), )).ThenReturn(&events.TryLockResponse{ LockAcquired: true, @@ -718,10 +717,10 @@ func TestDefaultProjectCommandRunner_Import(t *testing.T) { } repoDir := t.TempDir() When(mockWorkingDir.Clone( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString(), + Any[logging.SimpleLogging](), + Any[models.Repo](), + Any[models.PullRequest](), + Any[string](), )).ThenReturn(repoDir, false, nil) if c.setup != nil { c.setup(repoDir, ctx, mockLocker, mockInit, mockImport) @@ -1207,16 +1206,16 @@ func TestDefaultProjectCommandRunner_ApprovePolicies(t *testing.T) { } repoDir := t.TempDir() When(mockWorkingDir.GetWorkingDir( - matchers.AnyModelsRepo(), - matchers.AnyModelsPullRequest(), - AnyString(), + Any[models.Repo](), + Any[models.PullRequest](), + Any[string](), )).ThenReturn(repoDir, nil) When(mockLocker.TryLock( - matchers.AnyLoggingSimpleLogging(), - matchers.AnyModelsPullRequest(), - matchers.AnyModelsUser(), - AnyString(), - matchers.AnyModelsProject(), + Any[logging.SimpleLogging](), + Any[models.PullRequest](), + Any[models.User](), + Any[string](), + Any[models.Project](), AnyBool(), )).ThenReturn(&events.TryLockResponse{ LockAcquired: true, diff --git a/server/events/project_locker.go b/server/events/project_locker.go index e0f69008f..275b9e8c7 100644 --- a/server/events/project_locker.go +++ b/server/events/project_locker.go @@ -22,7 +22,7 @@ import ( "github.com/runatlantis/atlantis/server/logging" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_project_lock.go ProjectLocker +//go:generate pegomock generate --package mocks -o mocks/mock_project_lock.go ProjectLocker // ProjectLocker locks this project against other plans being run until this // project is unlocked. diff --git a/server/events/project_locker_test.go b/server/events/project_locker_test.go index e2752f4a9..62be1c40f 100644 --- a/server/events/project_locker_test.go +++ b/server/events/project_locker_test.go @@ -17,7 +17,7 @@ import ( "fmt" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/core/locking" "github.com/runatlantis/atlantis/server/core/locking/mocks" "github.com/runatlantis/atlantis/server/events" diff --git a/server/events/pull_closed_executor.go b/server/events/pull_closed_executor.go index b14ac8259..de3e4e800 100644 --- a/server/events/pull_closed_executor.go +++ b/server/events/pull_closed_executor.go @@ -30,13 +30,13 @@ import ( "github.com/runatlantis/atlantis/server/jobs" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_resource_cleaner.go ResourceCleaner +//go:generate pegomock generate --package mocks -o mocks/mock_resource_cleaner.go ResourceCleaner type ResourceCleaner interface { CleanUp(pullInfo jobs.PullInfo) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_pull_cleaner.go PullCleaner +//go:generate pegomock generate --package mocks -o mocks/mock_pull_cleaner.go PullCleaner // PullCleaner cleans up pull requests after they're closed/merged. type PullCleaner interface { diff --git a/server/events/pull_closed_executor_test.go b/server/events/pull_closed_executor_test.go index b34cfbaaa..77c1544be 100644 --- a/server/events/pull_closed_executor_test.go +++ b/server/events/pull_closed_executor_test.go @@ -24,12 +24,11 @@ import ( "github.com/stretchr/testify/assert" bolt "go.etcd.io/bbolt" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" lockmocks "github.com/runatlantis/atlantis/server/core/locking/mocks" "github.com/runatlantis/atlantis/server/events" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/mocks" - "github.com/runatlantis/atlantis/server/events/mocks/matchers" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/events/models/testdata" vcsmocks "github.com/runatlantis/atlantis/server/events/vcs/mocks" @@ -93,7 +92,7 @@ func TestCleanUpPullNoLocks(t *testing.T) { When(l.UnlockByPull(testdata.GithubRepo.FullName, testdata.Pull.Num)).ThenReturn(nil, nil) err = pce.CleanUpPull(testdata.GithubRepo, testdata.Pull) Ok(t, err) - cp.VerifyWasCalled(Never()).CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()) + cp.VerifyWasCalled(Never()).CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()) } func TestCleanUpPullComments(t *testing.T) { @@ -179,7 +178,7 @@ func TestCleanUpPullComments(t *testing.T) { When(l.UnlockByPull(testdata.GithubRepo.FullName, testdata.Pull.Num)).ThenReturn(c.Locks, nil) err = pce.CleanUpPull(testdata.GithubRepo, testdata.Pull) Ok(t, err) - _, _, comment, _ := cp.VerifyWasCalledOnce().CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()).GetCapturedArguments() + _, _, comment, _ := cp.VerifyWasCalledOnce().CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetCapturedArguments() expected := "Locks and plans deleted for the projects and workspaces modified in this pull request:\n\n" + c.Exp Equals(t, expected, comment) @@ -272,7 +271,7 @@ func TestCleanUpLogStreaming(t *testing.T) { Ok(t, err) close(prjCmdOutput) - _, _, comment, _ := client.VerifyWasCalledOnce().CreateComment(matchers.AnyModelsRepo(), AnyInt(), AnyString(), AnyString()).GetCapturedArguments() + _, _, comment, _ := client.VerifyWasCalledOnce().CreateComment(Any[models.Repo](), Any[int](), Any[string](), Any[string]()).GetCapturedArguments() expectedComment := "Locks and plans deleted for the projects and workspaces modified in this pull request:\n\n" + "- dir: `.` workspace: `default`" Equals(t, expectedComment, comment) diff --git a/server/events/vcs/client.go b/server/events/vcs/client.go index 6d7421b12..6ab283c8a 100644 --- a/server/events/vcs/client.go +++ b/server/events/vcs/client.go @@ -17,7 +17,7 @@ import ( "github.com/runatlantis/atlantis/server/events/models" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_client.go Client +//go:generate pegomock generate --package mocks -o mocks/mock_client.go Client // Client is used to make API calls to a VCS host like GitHub or GitLab. type Client interface { diff --git a/server/events/vcs/github_credentials.go b/server/events/vcs/github_credentials.go index f0d764eaf..d2f5771a4 100644 --- a/server/events/vcs/github_credentials.go +++ b/server/events/vcs/github_credentials.go @@ -12,7 +12,7 @@ import ( "github.com/pkg/errors" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_github_credentials.go GithubCredentials +//go:generate pegomock generate --package mocks -o mocks/mock_github_credentials.go GithubCredentials // GithubCredentials handles creating http.Clients that authenticate. type GithubCredentials interface { diff --git a/server/events/vcs/instrumented_client.go b/server/events/vcs/instrumented_client.go index bcb252412..4db0cb9ce 100644 --- a/server/events/vcs/instrumented_client.go +++ b/server/events/vcs/instrumented_client.go @@ -29,7 +29,7 @@ func NewInstrumentedGithubClient(client *GithubClient, statsScope tally.Scope, l } } -//go:generate pegomock generate -m --package mocks -o mocks/mock_github_pull_request_getter.go GithubPullRequestGetter +//go:generate pegomock generate --package mocks -o mocks/mock_github_pull_request_getter.go GithubPullRequestGetter type GithubPullRequestGetter interface { GetPullRequest(repo models.Repo, pullNum int) (*github.PullRequest, error) diff --git a/server/events/vcs/mocks/matchers/models_approvalstatus.go b/server/events/vcs/mocks/matchers/models_approvalstatus.go deleted file mode 100644 index 87c6174d6..000000000 --- a/server/events/vcs/mocks/matchers/models_approvalstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsApprovalStatus() models.ApprovalStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.ApprovalStatus))(nil)).Elem())) - var nullValue models.ApprovalStatus - return nullValue -} - -func EqModelsApprovalStatus(value models.ApprovalStatus) models.ApprovalStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.ApprovalStatus - return nullValue -} - -func NotEqModelsApprovalStatus(value models.ApprovalStatus) models.ApprovalStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.ApprovalStatus - return nullValue -} - -func ModelsApprovalStatusThat(matcher pegomock.ArgumentMatcher) models.ApprovalStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.ApprovalStatus - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/models_commitstatus.go b/server/events/vcs/mocks/matchers/models_commitstatus.go deleted file mode 100644 index f72ee4dc8..000000000 --- a/server/events/vcs/mocks/matchers/models_commitstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsCommitStatus() models.CommitStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.CommitStatus))(nil)).Elem())) - var nullValue models.CommitStatus - return nullValue -} - -func EqModelsCommitStatus(value models.CommitStatus) models.CommitStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.CommitStatus - return nullValue -} - -func NotEqModelsCommitStatus(value models.CommitStatus) models.CommitStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.CommitStatus - return nullValue -} - -func ModelsCommitStatusThat(matcher pegomock.ArgumentMatcher) models.CommitStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.CommitStatus - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/models_pullreqstatus.go b/server/events/vcs/mocks/matchers/models_pullreqstatus.go deleted file mode 100644 index 4a86cf900..000000000 --- a/server/events/vcs/mocks/matchers/models_pullreqstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullReqStatus() models.PullReqStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullReqStatus))(nil)).Elem())) - var nullValue models.PullReqStatus - return nullValue -} - -func EqModelsPullReqStatus(value models.PullReqStatus) models.PullReqStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullReqStatus - return nullValue -} - -func NotEqModelsPullReqStatus(value models.PullReqStatus) models.PullReqStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullReqStatus - return nullValue -} - -func ModelsPullReqStatusThat(matcher pegomock.ArgumentMatcher) models.PullReqStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullReqStatus - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/models_pullrequest.go b/server/events/vcs/mocks/matchers/models_pullrequest.go deleted file mode 100644 index 16b40e0e6..000000000 --- a/server/events/vcs/mocks/matchers/models_pullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullRequest() models.PullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullRequest))(nil)).Elem())) - var nullValue models.PullRequest - return nullValue -} - -func EqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func NotEqModelsPullRequest(value models.PullRequest) models.PullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullRequest - return nullValue -} - -func ModelsPullRequestThat(matcher pegomock.ArgumentMatcher) models.PullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullRequest - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/models_pullrequestoptions.go b/server/events/vcs/mocks/matchers/models_pullrequestoptions.go deleted file mode 100644 index a84d7849a..000000000 --- a/server/events/vcs/mocks/matchers/models_pullrequestoptions.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsPullRequestOptions() models.PullRequestOptions { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.PullRequestOptions))(nil)).Elem())) - var nullValue models.PullRequestOptions - return nullValue -} - -func EqModelsPullRequestOptions(value models.PullRequestOptions) models.PullRequestOptions { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.PullRequestOptions - return nullValue -} - -func NotEqModelsPullRequestOptions(value models.PullRequestOptions) models.PullRequestOptions { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.PullRequestOptions - return nullValue -} - -func ModelsPullRequestOptionsThat(matcher pegomock.ArgumentMatcher) models.PullRequestOptions { - pegomock.RegisterMatcher(matcher) - var nullValue models.PullRequestOptions - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/models_repo.go b/server/events/vcs/mocks/matchers/models_repo.go deleted file mode 100644 index 0f0b59bbb..000000000 --- a/server/events/vcs/mocks/matchers/models_repo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsRepo() models.Repo { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.Repo))(nil)).Elem())) - var nullValue models.Repo - return nullValue -} - -func EqModelsRepo(value models.Repo) models.Repo { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.Repo - return nullValue -} - -func NotEqModelsRepo(value models.Repo) models.Repo { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.Repo - return nullValue -} - -func ModelsRepoThat(matcher pegomock.ArgumentMatcher) models.Repo { - pegomock.RegisterMatcher(matcher) - var nullValue models.Repo - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/models_user.go b/server/events/vcs/mocks/matchers/models_user.go deleted file mode 100644 index 958cb1e83..000000000 --- a/server/events/vcs/mocks/matchers/models_user.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsUser() models.User { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.User))(nil)).Elem())) - var nullValue models.User - return nullValue -} - -func EqModelsUser(value models.User) models.User { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.User - return nullValue -} - -func NotEqModelsUser(value models.User) models.User { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.User - return nullValue -} - -func ModelsUserThat(matcher pegomock.ArgumentMatcher) models.User { - pegomock.RegisterMatcher(matcher) - var nullValue models.User - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/models_vcshosttype.go b/server/events/vcs/mocks/matchers/models_vcshosttype.go deleted file mode 100644 index ffec7628e..000000000 --- a/server/events/vcs/mocks/matchers/models_vcshosttype.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsVCSHostType() models.VCSHostType { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.VCSHostType))(nil)).Elem())) - var nullValue models.VCSHostType - return nullValue -} - -func EqModelsVCSHostType(value models.VCSHostType) models.VCSHostType { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.VCSHostType - return nullValue -} - -func NotEqModelsVCSHostType(value models.VCSHostType) models.VCSHostType { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.VCSHostType - return nullValue -} - -func ModelsVCSHostTypeThat(matcher pegomock.ArgumentMatcher) models.VCSHostType { - pegomock.RegisterMatcher(matcher) - var nullValue models.VCSHostType - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/ptr_to_github_pullrequest.go b/server/events/vcs/mocks/matchers/ptr_to_github_pullrequest.go deleted file mode 100644 index 39dc3e9aa..000000000 --- a/server/events/vcs/mocks/matchers/ptr_to_github_pullrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - github "github.com/google/go-github/v53/github" -) - -func AnyPtrToGithubPullRequest() *github.PullRequest { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*github.PullRequest))(nil)).Elem())) - var nullValue *github.PullRequest - return nullValue -} - -func EqPtrToGithubPullRequest(value *github.PullRequest) *github.PullRequest { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *github.PullRequest - return nullValue -} - -func NotEqPtrToGithubPullRequest(value *github.PullRequest) *github.PullRequest { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *github.PullRequest - return nullValue -} - -func PtrToGithubPullRequestThat(matcher pegomock.ArgumentMatcher) *github.PullRequest { - pegomock.RegisterMatcher(matcher) - var nullValue *github.PullRequest - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/ptr_to_http_client.go b/server/events/vcs/mocks/matchers/ptr_to_http_client.go deleted file mode 100644 index fac55931b..000000000 --- a/server/events/vcs/mocks/matchers/ptr_to_http_client.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - http "net/http" -) - -func AnyPtrToHttpClient() *http.Client { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*http.Client))(nil)).Elem())) - var nullValue *http.Client - return nullValue -} - -func EqPtrToHttpClient(value *http.Client) *http.Client { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *http.Client - return nullValue -} - -func NotEqPtrToHttpClient(value *http.Client) *http.Client { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *http.Client - return nullValue -} - -func PtrToHttpClientThat(matcher pegomock.ArgumentMatcher) *http.Client { - pegomock.RegisterMatcher(matcher) - var nullValue *http.Client - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/slice_of_byte.go b/server/events/vcs/mocks/matchers/slice_of_byte.go deleted file mode 100644 index b71a45767..000000000 --- a/server/events/vcs/mocks/matchers/slice_of_byte.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySliceOfByte() []byte { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]byte))(nil)).Elem())) - var nullValue []byte - return nullValue -} - -func EqSliceOfByte(value []byte) []byte { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []byte - return nullValue -} - -func NotEqSliceOfByte(value []byte) []byte { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []byte - return nullValue -} - -func SliceOfByteThat(matcher pegomock.ArgumentMatcher) []byte { - pegomock.RegisterMatcher(matcher) - var nullValue []byte - return nullValue -} diff --git a/server/events/vcs/mocks/matchers/slice_of_string.go b/server/events/vcs/mocks/matchers/slice_of_string.go deleted file mode 100644 index 96b18dd8b..000000000 --- a/server/events/vcs/mocks/matchers/slice_of_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnySliceOfString() []string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]string))(nil)).Elem())) - var nullValue []string - return nullValue -} - -func EqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func NotEqSliceOfString(value []string) []string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []string - return nullValue -} - -func SliceOfStringThat(matcher pegomock.ArgumentMatcher) []string { - pegomock.RegisterMatcher(matcher) - var nullValue []string - return nullValue -} diff --git a/server/events/vcs/mocks/mock_client.go b/server/events/vcs/mocks/mock_client.go index 2268292ae..9f80f46de 100644 --- a/server/events/vcs/mocks/mock_client.go +++ b/server/events/vcs/mocks/mock_client.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -25,11 +25,11 @@ 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) CreateComment(_param0 models.Repo, _param1 int, _param2 string, _param3 string) error { +func (mock *MockClient) CreateComment(repo models.Repo, pullNum int, comment string, command string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{repo, pullNum, comment, command} result := pegomock.GetGenericMockFrom(mock).Invoke("CreateComment", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -40,11 +40,11 @@ func (mock *MockClient) CreateComment(_param0 models.Repo, _param1 int, _param2 return ret0 } -func (mock *MockClient) DiscardReviews(_param0 models.Repo, _param1 models.PullRequest) error { +func (mock *MockClient) DiscardReviews(repo models.Repo, pull models.PullRequest) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repo, pull} result := pegomock.GetGenericMockFrom(mock).Invoke("DiscardReviews", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -55,11 +55,11 @@ func (mock *MockClient) DiscardReviews(_param0 models.Repo, _param1 models.PullR return ret0 } -func (mock *MockClient) GetCloneURL(_param0 models.VCSHostType, _param1 string) (string, error) { +func (mock *MockClient) GetCloneURL(VCSHostType models.VCSHostType, repo string) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{VCSHostType, repo} result := pegomock.GetGenericMockFrom(mock).Invoke("GetCloneURL", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -74,11 +74,11 @@ func (mock *MockClient) GetCloneURL(_param0 models.VCSHostType, _param1 string) return ret0, ret1 } -func (mock *MockClient) GetFileContent(_param0 models.PullRequest, _param1 string) (bool, []byte, error) { +func (mock *MockClient) GetFileContent(pull models.PullRequest, fileName string) (bool, []byte, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{pull, fileName} result := pegomock.GetGenericMockFrom(mock).Invoke("GetFileContent", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*[]byte)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 bool var ret1 []byte @@ -97,11 +97,11 @@ func (mock *MockClient) GetFileContent(_param0 models.PullRequest, _param1 strin return ret0, ret1, ret2 } -func (mock *MockClient) GetModifiedFiles(_param0 models.Repo, _param1 models.PullRequest) ([]string, error) { +func (mock *MockClient) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repo, pull} result := pegomock.GetGenericMockFrom(mock).Invoke("GetModifiedFiles", params, []reflect.Type{reflect.TypeOf((*[]string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []string var ret1 error @@ -116,11 +116,11 @@ func (mock *MockClient) GetModifiedFiles(_param0 models.Repo, _param1 models.Pul return ret0, ret1 } -func (mock *MockClient) GetTeamNamesForUser(_param0 models.Repo, _param1 models.User) ([]string, error) { +func (mock *MockClient) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repo, user} result := pegomock.GetGenericMockFrom(mock).Invoke("GetTeamNamesForUser", params, []reflect.Type{reflect.TypeOf((*[]string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []string var ret1 error @@ -135,11 +135,11 @@ func (mock *MockClient) GetTeamNamesForUser(_param0 models.Repo, _param1 models. return ret0, ret1 } -func (mock *MockClient) HidePrevCommandComments(_param0 models.Repo, _param1 int, _param2 string) error { +func (mock *MockClient) HidePrevCommandComments(repo models.Repo, pullNum int, command string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{repo, pullNum, command} result := pegomock.GetGenericMockFrom(mock).Invoke("HidePrevCommandComments", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -150,11 +150,11 @@ func (mock *MockClient) HidePrevCommandComments(_param0 models.Repo, _param1 int return ret0 } -func (mock *MockClient) MarkdownPullLink(_param0 models.PullRequest) (string, error) { +func (mock *MockClient) MarkdownPullLink(pull models.PullRequest) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pull} result := pegomock.GetGenericMockFrom(mock).Invoke("MarkdownPullLink", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -169,11 +169,11 @@ func (mock *MockClient) MarkdownPullLink(_param0 models.PullRequest) (string, er return ret0, ret1 } -func (mock *MockClient) MergePull(_param0 models.PullRequest, _param1 models.PullRequestOptions) error { +func (mock *MockClient) MergePull(pull models.PullRequest, pullOptions models.PullRequestOptions) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{pull, pullOptions} result := pegomock.GetGenericMockFrom(mock).Invoke("MergePull", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -184,11 +184,11 @@ func (mock *MockClient) MergePull(_param0 models.PullRequest, _param1 models.Pul return ret0 } -func (mock *MockClient) PullIsApproved(_param0 models.Repo, _param1 models.PullRequest) (models.ApprovalStatus, error) { +func (mock *MockClient) PullIsApproved(repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repo, pull} result := pegomock.GetGenericMockFrom(mock).Invoke("PullIsApproved", params, []reflect.Type{reflect.TypeOf((*models.ApprovalStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.ApprovalStatus var ret1 error @@ -203,11 +203,11 @@ func (mock *MockClient) PullIsApproved(_param0 models.Repo, _param1 models.PullR return ret0, ret1 } -func (mock *MockClient) PullIsMergeable(_param0 models.Repo, _param1 models.PullRequest, _param2 string) (bool, error) { +func (mock *MockClient) PullIsMergeable(repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{repo, pull, vcsstatusname} result := pegomock.GetGenericMockFrom(mock).Invoke("PullIsMergeable", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 bool var ret1 error @@ -222,11 +222,11 @@ func (mock *MockClient) PullIsMergeable(_param0 models.Repo, _param1 models.Pull return ret0, ret1 } -func (mock *MockClient) ReactToComment(_param0 models.Repo, _param1 int, _param2 int64, _param3 string) error { +func (mock *MockClient) ReactToComment(repo models.Repo, pullNum int, commentID int64, reaction string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3} + params := []pegomock.Param{repo, pullNum, commentID, reaction} result := pegomock.GetGenericMockFrom(mock).Invoke("ReactToComment", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -237,11 +237,11 @@ func (mock *MockClient) ReactToComment(_param0 models.Repo, _param1 int, _param2 return ret0 } -func (mock *MockClient) SupportsSingleFileDownload(_param0 models.Repo) bool { +func (mock *MockClient) SupportsSingleFileDownload(repo models.Repo) bool { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{repo} result := pegomock.GetGenericMockFrom(mock).Invoke("SupportsSingleFileDownload", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()}) var ret0 bool if len(result) != 0 { @@ -252,11 +252,11 @@ func (mock *MockClient) SupportsSingleFileDownload(_param0 models.Repo) bool { return ret0 } -func (mock *MockClient) UpdateStatus(_param0 models.Repo, _param1 models.PullRequest, _param2 models.CommitStatus, _param3 string, _param4 string, _param5 string) error { +func (mock *MockClient) UpdateStatus(repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockClient().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} + params := []pegomock.Param{repo, pull, state, src, description, url} result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateStatus", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -304,8 +304,8 @@ type VerifierMockClient struct { timeout time.Duration } -func (verifier *VerifierMockClient) CreateComment(_param0 models.Repo, _param1 int, _param2 string, _param3 string) *MockClient_CreateComment_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockClient) CreateComment(repo models.Repo, pullNum int, comment string, command string) *MockClient_CreateComment_OngoingVerification { + params := []pegomock.Param{repo, pullNum, comment, command} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CreateComment", params, verifier.timeout) return &MockClient_CreateComment_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -316,8 +316,8 @@ type MockClient_CreateComment_OngoingVerification struct { } func (c *MockClient_CreateComment_OngoingVerification) GetCapturedArguments() (models.Repo, int, string, string) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + repo, pullNum, comment, command := c.GetAllCapturedArguments() + return repo[len(repo)-1], pullNum[len(pullNum)-1], comment[len(comment)-1], command[len(command)-1] } func (c *MockClient_CreateComment_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int, _param2 []string, _param3 []string) { @@ -343,8 +343,8 @@ func (c *MockClient_CreateComment_OngoingVerification) GetAllCapturedArguments() return } -func (verifier *VerifierMockClient) DiscardReviews(_param0 models.Repo, _param1 models.PullRequest) *MockClient_DiscardReviews_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockClient) DiscardReviews(repo models.Repo, pull models.PullRequest) *MockClient_DiscardReviews_OngoingVerification { + params := []pegomock.Param{repo, pull} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "DiscardReviews", params, verifier.timeout) return &MockClient_DiscardReviews_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -355,8 +355,8 @@ type MockClient_DiscardReviews_OngoingVerification struct { } func (c *MockClient_DiscardReviews_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repo, pull := c.GetAllCapturedArguments() + return repo[len(repo)-1], pull[len(pull)-1] } func (c *MockClient_DiscardReviews_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { @@ -374,8 +374,8 @@ func (c *MockClient_DiscardReviews_OngoingVerification) GetAllCapturedArguments( return } -func (verifier *VerifierMockClient) GetCloneURL(_param0 models.VCSHostType, _param1 string) *MockClient_GetCloneURL_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockClient) GetCloneURL(VCSHostType models.VCSHostType, repo string) *MockClient_GetCloneURL_OngoingVerification { + params := []pegomock.Param{VCSHostType, repo} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetCloneURL", params, verifier.timeout) return &MockClient_GetCloneURL_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -386,8 +386,8 @@ type MockClient_GetCloneURL_OngoingVerification struct { } func (c *MockClient_GetCloneURL_OngoingVerification) GetCapturedArguments() (models.VCSHostType, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + VCSHostType, repo := c.GetAllCapturedArguments() + return VCSHostType[len(VCSHostType)-1], repo[len(repo)-1] } func (c *MockClient_GetCloneURL_OngoingVerification) GetAllCapturedArguments() (_param0 []models.VCSHostType, _param1 []string) { @@ -405,8 +405,8 @@ func (c *MockClient_GetCloneURL_OngoingVerification) GetAllCapturedArguments() ( return } -func (verifier *VerifierMockClient) GetFileContent(_param0 models.PullRequest, _param1 string) *MockClient_GetFileContent_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockClient) GetFileContent(pull models.PullRequest, fileName string) *MockClient_GetFileContent_OngoingVerification { + params := []pegomock.Param{pull, fileName} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetFileContent", params, verifier.timeout) return &MockClient_GetFileContent_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -417,8 +417,8 @@ type MockClient_GetFileContent_OngoingVerification struct { } func (c *MockClient_GetFileContent_OngoingVerification) GetCapturedArguments() (models.PullRequest, string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + pull, fileName := c.GetAllCapturedArguments() + return pull[len(pull)-1], fileName[len(fileName)-1] } func (c *MockClient_GetFileContent_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 []string) { @@ -436,8 +436,8 @@ func (c *MockClient_GetFileContent_OngoingVerification) GetAllCapturedArguments( return } -func (verifier *VerifierMockClient) GetModifiedFiles(_param0 models.Repo, _param1 models.PullRequest) *MockClient_GetModifiedFiles_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockClient_GetModifiedFiles_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -448,8 +448,8 @@ type MockClient_GetModifiedFiles_OngoingVerification struct { } func (c *MockClient_GetModifiedFiles_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repo, pull := c.GetAllCapturedArguments() + return repo[len(repo)-1], pull[len(pull)-1] } func (c *MockClient_GetModifiedFiles_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { @@ -467,8 +467,8 @@ func (c *MockClient_GetModifiedFiles_OngoingVerification) GetAllCapturedArgument return } -func (verifier *VerifierMockClient) GetTeamNamesForUser(_param0 models.Repo, _param1 models.User) *MockClient_GetTeamNamesForUser_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockClient) GetTeamNamesForUser(repo models.Repo, user models.User) *MockClient_GetTeamNamesForUser_OngoingVerification { + params := []pegomock.Param{repo, user} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetTeamNamesForUser", params, verifier.timeout) return &MockClient_GetTeamNamesForUser_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -479,8 +479,8 @@ type MockClient_GetTeamNamesForUser_OngoingVerification struct { } func (c *MockClient_GetTeamNamesForUser_OngoingVerification) GetCapturedArguments() (models.Repo, models.User) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repo, user := c.GetAllCapturedArguments() + return repo[len(repo)-1], user[len(user)-1] } func (c *MockClient_GetTeamNamesForUser_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.User) { @@ -498,8 +498,8 @@ func (c *MockClient_GetTeamNamesForUser_OngoingVerification) GetAllCapturedArgum return } -func (verifier *VerifierMockClient) HidePrevCommandComments(_param0 models.Repo, _param1 int, _param2 string) *MockClient_HidePrevCommandComments_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockClient) HidePrevCommandComments(repo models.Repo, pullNum int, command string) *MockClient_HidePrevCommandComments_OngoingVerification { + params := []pegomock.Param{repo, pullNum, command} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "HidePrevCommandComments", params, verifier.timeout) return &MockClient_HidePrevCommandComments_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -510,8 +510,8 @@ type MockClient_HidePrevCommandComments_OngoingVerification struct { } func (c *MockClient_HidePrevCommandComments_OngoingVerification) GetCapturedArguments() (models.Repo, int, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + repo, pullNum, command := c.GetAllCapturedArguments() + return repo[len(repo)-1], pullNum[len(pullNum)-1], command[len(command)-1] } func (c *MockClient_HidePrevCommandComments_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int, _param2 []string) { @@ -533,8 +533,8 @@ func (c *MockClient_HidePrevCommandComments_OngoingVerification) GetAllCapturedA return } -func (verifier *VerifierMockClient) MarkdownPullLink(_param0 models.PullRequest) *MockClient_MarkdownPullLink_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockClient) MarkdownPullLink(pull models.PullRequest) *MockClient_MarkdownPullLink_OngoingVerification { + params := []pegomock.Param{pull} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "MarkdownPullLink", params, verifier.timeout) return &MockClient_MarkdownPullLink_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -545,8 +545,8 @@ type MockClient_MarkdownPullLink_OngoingVerification struct { } func (c *MockClient_MarkdownPullLink_OngoingVerification) GetCapturedArguments() models.PullRequest { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pull := c.GetAllCapturedArguments() + return pull[len(pull)-1] } func (c *MockClient_MarkdownPullLink_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) { @@ -560,8 +560,8 @@ func (c *MockClient_MarkdownPullLink_OngoingVerification) GetAllCapturedArgument return } -func (verifier *VerifierMockClient) MergePull(_param0 models.PullRequest, _param1 models.PullRequestOptions) *MockClient_MergePull_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockClient) MergePull(pull models.PullRequest, pullOptions models.PullRequestOptions) *MockClient_MergePull_OngoingVerification { + params := []pegomock.Param{pull, pullOptions} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "MergePull", params, verifier.timeout) return &MockClient_MergePull_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -572,8 +572,8 @@ type MockClient_MergePull_OngoingVerification struct { } func (c *MockClient_MergePull_OngoingVerification) GetCapturedArguments() (models.PullRequest, models.PullRequestOptions) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + pull, pullOptions := c.GetAllCapturedArguments() + return pull[len(pull)-1], pullOptions[len(pullOptions)-1] } func (c *MockClient_MergePull_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest, _param1 []models.PullRequestOptions) { @@ -591,8 +591,8 @@ func (c *MockClient_MergePull_OngoingVerification) GetAllCapturedArguments() (_p return } -func (verifier *VerifierMockClient) PullIsApproved(_param0 models.Repo, _param1 models.PullRequest) *MockClient_PullIsApproved_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockClient_PullIsApproved_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -603,8 +603,8 @@ type MockClient_PullIsApproved_OngoingVerification struct { } func (c *MockClient_PullIsApproved_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repo, pull := c.GetAllCapturedArguments() + return repo[len(repo)-1], pull[len(pull)-1] } func (c *MockClient_PullIsApproved_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest) { @@ -622,8 +622,8 @@ func (c *MockClient_PullIsApproved_OngoingVerification) GetAllCapturedArguments( return } -func (verifier *VerifierMockClient) PullIsMergeable(_param0 models.Repo, _param1 models.PullRequest, _param2 string) *MockClient_PullIsMergeable_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockClient) PullIsMergeable(repo models.Repo, pull models.PullRequest, vcsstatusname string) *MockClient_PullIsMergeable_OngoingVerification { + params := []pegomock.Param{repo, pull, vcsstatusname} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PullIsMergeable", params, verifier.timeout) return &MockClient_PullIsMergeable_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -634,8 +634,8 @@ type MockClient_PullIsMergeable_OngoingVerification struct { } func (c *MockClient_PullIsMergeable_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, string) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + repo, pull, vcsstatusname := c.GetAllCapturedArguments() + return repo[len(repo)-1], pull[len(pull)-1], vcsstatusname[len(vcsstatusname)-1] } func (c *MockClient_PullIsMergeable_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []string) { @@ -657,8 +657,8 @@ func (c *MockClient_PullIsMergeable_OngoingVerification) GetAllCapturedArguments return } -func (verifier *VerifierMockClient) ReactToComment(_param0 models.Repo, _param1 int, _param2 int64, _param3 string) *MockClient_ReactToComment_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3} +func (verifier *VerifierMockClient) ReactToComment(repo models.Repo, pullNum int, commentID int64, reaction string) *MockClient_ReactToComment_OngoingVerification { + params := []pegomock.Param{repo, pullNum, commentID, reaction} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "ReactToComment", params, verifier.timeout) return &MockClient_ReactToComment_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -669,8 +669,8 @@ type MockClient_ReactToComment_OngoingVerification struct { } func (c *MockClient_ReactToComment_OngoingVerification) GetCapturedArguments() (models.Repo, int, int64, string) { - _param0, _param1, _param2, _param3 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1] + repo, pullNum, commentID, reaction := c.GetAllCapturedArguments() + return repo[len(repo)-1], pullNum[len(pullNum)-1], commentID[len(commentID)-1], reaction[len(reaction)-1] } func (c *MockClient_ReactToComment_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int, _param2 []int64, _param3 []string) { @@ -696,8 +696,8 @@ func (c *MockClient_ReactToComment_OngoingVerification) GetAllCapturedArguments( return } -func (verifier *VerifierMockClient) SupportsSingleFileDownload(_param0 models.Repo) *MockClient_SupportsSingleFileDownload_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockClient) SupportsSingleFileDownload(repo models.Repo) *MockClient_SupportsSingleFileDownload_OngoingVerification { + params := []pegomock.Param{repo} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SupportsSingleFileDownload", params, verifier.timeout) return &MockClient_SupportsSingleFileDownload_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -708,8 +708,8 @@ type MockClient_SupportsSingleFileDownload_OngoingVerification struct { } func (c *MockClient_SupportsSingleFileDownload_OngoingVerification) GetCapturedArguments() models.Repo { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + repo := c.GetAllCapturedArguments() + return repo[len(repo)-1] } func (c *MockClient_SupportsSingleFileDownload_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo) { @@ -723,8 +723,8 @@ func (c *MockClient_SupportsSingleFileDownload_OngoingVerification) GetAllCaptur return } -func (verifier *VerifierMockClient) UpdateStatus(_param0 models.Repo, _param1 models.PullRequest, _param2 models.CommitStatus, _param3 string, _param4 string, _param5 string) *MockClient_UpdateStatus_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4, _param5} +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 &MockClient_UpdateStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -735,8 +735,8 @@ type MockClient_UpdateStatus_OngoingVerification struct { } func (c *MockClient_UpdateStatus_OngoingVerification) GetCapturedArguments() (models.Repo, models.PullRequest, models.CommitStatus, string, string, string) { - _param0, _param1, _param2, _param3, _param4, _param5 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1], _param5[len(_param5)-1] + 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 *MockClient_UpdateStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []models.PullRequest, _param2 []models.CommitStatus, _param3 []string, _param4 []string, _param5 []string) { diff --git a/server/events/vcs/mocks/mock_github_credentials.go b/server/events/vcs/mocks/mock_github_credentials.go index 6b0c4e646..2c6359c07 100644 --- a/server/events/vcs/mocks/mock_github_credentials.go +++ b/server/events/vcs/mocks/mock_github_credentials.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" http "net/http" "reflect" "time" diff --git a/server/events/vcs/mocks/mock_github_pull_request_getter.go b/server/events/vcs/mocks/mock_github_pull_request_getter.go index 378801699..436d85836 100644 --- a/server/events/vcs/mocks/mock_github_pull_request_getter.go +++ b/server/events/vcs/mocks/mock_github_pull_request_getter.go @@ -5,7 +5,7 @@ package mocks import ( github "github.com/google/go-github/v53/github" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -26,11 +26,11 @@ func NewMockGithubPullRequestGetter(options ...pegomock.Option) *MockGithubPullR func (mock *MockGithubPullRequestGetter) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockGithubPullRequestGetter) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockGithubPullRequestGetter) GetPullRequest(_param0 models.Repo, _param1 int) (*github.PullRequest, error) { +func (mock *MockGithubPullRequestGetter) GetPullRequest(repo models.Repo, pullNum int) (*github.PullRequest, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockGithubPullRequestGetter().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{repo, pullNum} result := pegomock.GetGenericMockFrom(mock).Invoke("GetPullRequest", params, []reflect.Type{reflect.TypeOf((**github.PullRequest)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 *github.PullRequest var ret1 error @@ -82,8 +82,8 @@ type VerifierMockGithubPullRequestGetter struct { timeout time.Duration } -func (verifier *VerifierMockGithubPullRequestGetter) GetPullRequest(_param0 models.Repo, _param1 int) *MockGithubPullRequestGetter_GetPullRequest_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockGithubPullRequestGetter) GetPullRequest(repo models.Repo, pullNum int) *MockGithubPullRequestGetter_GetPullRequest_OngoingVerification { + params := []pegomock.Param{repo, pullNum} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetPullRequest", params, verifier.timeout) return &MockGithubPullRequestGetter_GetPullRequest_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -94,8 +94,8 @@ type MockGithubPullRequestGetter_GetPullRequest_OngoingVerification struct { } func (c *MockGithubPullRequestGetter_GetPullRequest_OngoingVerification) GetCapturedArguments() (models.Repo, int) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + repo, pullNum := c.GetAllCapturedArguments() + return repo[len(repo)-1], pullNum[len(pullNum)-1] } func (c *MockGithubPullRequestGetter_GetPullRequest_OngoingVerification) GetAllCapturedArguments() (_param0 []models.Repo, _param1 []int) { diff --git a/server/events/vcs/mocks/mock_pull_req_status_fetcher.go b/server/events/vcs/mocks/mock_pull_req_status_fetcher.go index 13766bd8f..3e13d2999 100644 --- a/server/events/vcs/mocks/mock_pull_req_status_fetcher.go +++ b/server/events/vcs/mocks/mock_pull_req_status_fetcher.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" models "github.com/runatlantis/atlantis/server/events/models" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockPullReqStatusFetcher(options ...pegomock.Option) *MockPullReqStatusF func (mock *MockPullReqStatusFetcher) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockPullReqStatusFetcher) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockPullReqStatusFetcher) FetchPullStatus(_param0 models.PullRequest) (models.PullReqStatus, error) { +func (mock *MockPullReqStatusFetcher) FetchPullStatus(pull models.PullRequest) (models.PullReqStatus, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockPullReqStatusFetcher().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pull} result := pegomock.GetGenericMockFrom(mock).Invoke("FetchPullStatus", params, []reflect.Type{reflect.TypeOf((*models.PullReqStatus)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 models.PullReqStatus var ret1 error @@ -81,8 +81,8 @@ type VerifierMockPullReqStatusFetcher struct { timeout time.Duration } -func (verifier *VerifierMockPullReqStatusFetcher) FetchPullStatus(_param0 models.PullRequest) *MockPullReqStatusFetcher_FetchPullStatus_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockPullReqStatusFetcher) FetchPullStatus(pull models.PullRequest) *MockPullReqStatusFetcher_FetchPullStatus_OngoingVerification { + params := []pegomock.Param{pull} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "FetchPullStatus", params, verifier.timeout) return &MockPullReqStatusFetcher_FetchPullStatus_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockPullReqStatusFetcher_FetchPullStatus_OngoingVerification struct { } func (c *MockPullReqStatusFetcher_FetchPullStatus_OngoingVerification) GetCapturedArguments() models.PullRequest { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pull := c.GetAllCapturedArguments() + return pull[len(pull)-1] } func (c *MockPullReqStatusFetcher_FetchPullStatus_OngoingVerification) GetAllCapturedArguments() (_param0 []models.PullRequest) { diff --git a/server/events/vcs/pull_status_fetcher.go b/server/events/vcs/pull_status_fetcher.go index 03d00c7ba..43aef1183 100644 --- a/server/events/vcs/pull_status_fetcher.go +++ b/server/events/vcs/pull_status_fetcher.go @@ -5,7 +5,7 @@ import ( "github.com/runatlantis/atlantis/server/events/models" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_pull_req_status_fetcher.go PullReqStatusFetcher +//go:generate pegomock generate --package mocks -o mocks/mock_pull_req_status_fetcher.go PullReqStatusFetcher type PullReqStatusFetcher interface { FetchPullStatus(pull models.PullRequest) (models.PullReqStatus, error) diff --git a/server/events/webhooks/mocks/matchers/logging_simplelogging.go b/server/events/webhooks/mocks/matchers/logging_simplelogging.go deleted file mode 100644 index 6bb3b9ec9..000000000 --- a/server/events/webhooks/mocks/matchers/logging_simplelogging.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - logging "github.com/runatlantis/atlantis/server/logging" -) - -func AnyLoggingSimpleLogging() logging.SimpleLogging { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem())) - var nullValue logging.SimpleLogging - return nullValue -} - -func EqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func NotEqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func LoggingSimpleLoggingThat(matcher pegomock.ArgumentMatcher) logging.SimpleLogging { - pegomock.RegisterMatcher(matcher) - var nullValue logging.SimpleLogging - return nullValue -} diff --git a/server/events/webhooks/mocks/matchers/ptr_to_slack_authtestresponse.go b/server/events/webhooks/mocks/matchers/ptr_to_slack_authtestresponse.go deleted file mode 100644 index 9ef99b0f0..000000000 --- a/server/events/webhooks/mocks/matchers/ptr_to_slack_authtestresponse.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - slack "github.com/slack-go/slack" -) - -func AnyPtrToSlackAuthTestResponse() *slack.AuthTestResponse { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*slack.AuthTestResponse))(nil)).Elem())) - var nullValue *slack.AuthTestResponse - return nullValue -} - -func EqPtrToSlackAuthTestResponse(value *slack.AuthTestResponse) *slack.AuthTestResponse { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *slack.AuthTestResponse - return nullValue -} - -func NotEqPtrToSlackAuthTestResponse(value *slack.AuthTestResponse) *slack.AuthTestResponse { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *slack.AuthTestResponse - return nullValue -} - -func PtrToSlackAuthTestResponseThat(matcher pegomock.ArgumentMatcher) *slack.AuthTestResponse { - pegomock.RegisterMatcher(matcher) - var nullValue *slack.AuthTestResponse - return nullValue -} diff --git a/server/events/webhooks/mocks/matchers/ptr_to_slack_getconversationsparameters.go b/server/events/webhooks/mocks/matchers/ptr_to_slack_getconversationsparameters.go deleted file mode 100644 index 01b45aa11..000000000 --- a/server/events/webhooks/mocks/matchers/ptr_to_slack_getconversationsparameters.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - slack "github.com/slack-go/slack" -) - -func AnyPtrToSlackGetConversationsParameters() *slack.GetConversationsParameters { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*slack.GetConversationsParameters))(nil)).Elem())) - var nullValue *slack.GetConversationsParameters - return nullValue -} - -func EqPtrToSlackGetConversationsParameters(value *slack.GetConversationsParameters) *slack.GetConversationsParameters { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *slack.GetConversationsParameters - return nullValue -} - -func NotEqPtrToSlackGetConversationsParameters(value *slack.GetConversationsParameters) *slack.GetConversationsParameters { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *slack.GetConversationsParameters - return nullValue -} - -func PtrToSlackGetConversationsParametersThat(matcher pegomock.ArgumentMatcher) *slack.GetConversationsParameters { - pegomock.RegisterMatcher(matcher) - var nullValue *slack.GetConversationsParameters - return nullValue -} diff --git a/server/events/webhooks/mocks/matchers/slack_msgoption.go b/server/events/webhooks/mocks/matchers/slack_msgoption.go deleted file mode 100644 index bfc1f2720..000000000 --- a/server/events/webhooks/mocks/matchers/slack_msgoption.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - slack "github.com/slack-go/slack" -) - -func AnySlackMsgOption() slack.MsgOption { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(slack.MsgOption))(nil)).Elem())) - var nullValue slack.MsgOption - return nullValue -} - -func EqSlackMsgOption(value slack.MsgOption) slack.MsgOption { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue slack.MsgOption - return nullValue -} - -func NotEqSlackMsgOption(value slack.MsgOption) slack.MsgOption { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue slack.MsgOption - return nullValue -} - -func SlackMsgOptionThat(matcher pegomock.ArgumentMatcher) slack.MsgOption { - pegomock.RegisterMatcher(matcher) - var nullValue slack.MsgOption - return nullValue -} diff --git a/server/events/webhooks/mocks/matchers/slice_of_slack_channel.go b/server/events/webhooks/mocks/matchers/slice_of_slack_channel.go deleted file mode 100644 index d97b17554..000000000 --- a/server/events/webhooks/mocks/matchers/slice_of_slack_channel.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - slack "github.com/slack-go/slack" -) - -func AnySliceOfSlackChannel() []slack.Channel { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*([]slack.Channel))(nil)).Elem())) - var nullValue []slack.Channel - return nullValue -} - -func EqSliceOfSlackChannel(value []slack.Channel) []slack.Channel { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue []slack.Channel - return nullValue -} - -func NotEqSliceOfSlackChannel(value []slack.Channel) []slack.Channel { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue []slack.Channel - return nullValue -} - -func SliceOfSlackChannelThat(matcher pegomock.ArgumentMatcher) []slack.Channel { - pegomock.RegisterMatcher(matcher) - var nullValue []slack.Channel - return nullValue -} diff --git a/server/events/webhooks/mocks/matchers/webhooks_applyresult.go b/server/events/webhooks/mocks/matchers/webhooks_applyresult.go deleted file mode 100644 index 8d884a5f2..000000000 --- a/server/events/webhooks/mocks/matchers/webhooks_applyresult.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - webhooks "github.com/runatlantis/atlantis/server/events/webhooks" -) - -func AnyWebhooksApplyResult() webhooks.ApplyResult { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(webhooks.ApplyResult))(nil)).Elem())) - var nullValue webhooks.ApplyResult - return nullValue -} - -func EqWebhooksApplyResult(value webhooks.ApplyResult) webhooks.ApplyResult { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue webhooks.ApplyResult - return nullValue -} - -func NotEqWebhooksApplyResult(value webhooks.ApplyResult) webhooks.ApplyResult { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue webhooks.ApplyResult - return nullValue -} - -func WebhooksApplyResultThat(matcher pegomock.ArgumentMatcher) webhooks.ApplyResult { - pegomock.RegisterMatcher(matcher) - var nullValue webhooks.ApplyResult - return nullValue -} diff --git a/server/events/webhooks/mocks/mock_sender.go b/server/events/webhooks/mocks/mock_sender.go index 1ad14418e..90b7a51b0 100644 --- a/server/events/webhooks/mocks/mock_sender.go +++ b/server/events/webhooks/mocks/mock_sender.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" webhooks "github.com/runatlantis/atlantis/server/events/webhooks" logging "github.com/runatlantis/atlantis/server/logging" "reflect" @@ -26,11 +26,11 @@ func NewMockSender(options ...pegomock.Option) *MockSender { func (mock *MockSender) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockSender) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockSender) Send(_param0 logging.SimpleLogging, _param1 webhooks.ApplyResult) error { +func (mock *MockSender) Send(log logging.SimpleLogging, applyResult webhooks.ApplyResult) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSender().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{log, applyResult} result := pegomock.GetGenericMockFrom(mock).Invoke("Send", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -78,8 +78,8 @@ type VerifierMockSender struct { timeout time.Duration } -func (verifier *VerifierMockSender) Send(_param0 logging.SimpleLogging, _param1 webhooks.ApplyResult) *MockSender_Send_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockSender) Send(log logging.SimpleLogging, 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 &MockSender_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -90,8 +90,8 @@ type MockSender_Send_OngoingVerification struct { } func (c *MockSender_Send_OngoingVerification) GetCapturedArguments() (logging.SimpleLogging, webhooks.ApplyResult) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + log, applyResult := c.GetAllCapturedArguments() + return log[len(log)-1], applyResult[len(applyResult)-1] } func (c *MockSender_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.SimpleLogging, _param1 []webhooks.ApplyResult) { diff --git a/server/events/webhooks/mocks/mock_slack_client.go b/server/events/webhooks/mocks/mock_slack_client.go index fa00f6167..7c65efd49 100644 --- a/server/events/webhooks/mocks/mock_slack_client.go +++ b/server/events/webhooks/mocks/mock_slack_client.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" webhooks "github.com/runatlantis/atlantis/server/events/webhooks" "reflect" "time" @@ -40,11 +40,11 @@ func (mock *MockSlackClient) AuthTest() error { return ret0 } -func (mock *MockSlackClient) PostMessage(_param0 string, _param1 webhooks.ApplyResult) error { +func (mock *MockSlackClient) PostMessage(channel string, applyResult webhooks.ApplyResult) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSlackClient().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{channel, applyResult} result := pegomock.GetGenericMockFrom(mock).Invoke("PostMessage", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error if len(result) != 0 { @@ -124,8 +124,8 @@ func (c *MockSlackClient_AuthTest_OngoingVerification) GetCapturedArguments() { func (c *MockSlackClient_AuthTest_OngoingVerification) GetAllCapturedArguments() { } -func (verifier *VerifierMockSlackClient) PostMessage(_param0 string, _param1 webhooks.ApplyResult) *MockSlackClient_PostMessage_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +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 &MockSlackClient_PostMessage_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -136,8 +136,8 @@ type MockSlackClient_PostMessage_OngoingVerification struct { } func (c *MockSlackClient_PostMessage_OngoingVerification) GetCapturedArguments() (string, webhooks.ApplyResult) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + channel, applyResult := c.GetAllCapturedArguments() + return channel[len(channel)-1], applyResult[len(applyResult)-1] } func (c *MockSlackClient_PostMessage_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []webhooks.ApplyResult) { diff --git a/server/events/webhooks/mocks/mock_underlying_slack_client.go b/server/events/webhooks/mocks/mock_underlying_slack_client.go index 46d1be636..4d68cec66 100644 --- a/server/events/webhooks/mocks/mock_underlying_slack_client.go +++ b/server/events/webhooks/mocks/mock_underlying_slack_client.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" slack "github.com/slack-go/slack" "reflect" "time" @@ -44,11 +44,11 @@ func (mock *MockUnderlyingSlackClient) AuthTest() (*slack.AuthTestResponse, erro return ret0, ret1 } -func (mock *MockUnderlyingSlackClient) GetConversations(_param0 *slack.GetConversationsParameters) ([]slack.Channel, string, error) { +func (mock *MockUnderlyingSlackClient) GetConversations(conversationParams *slack.GetConversationsParameters) ([]slack.Channel, string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockUnderlyingSlackClient().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{conversationParams} result := pegomock.GetGenericMockFrom(mock).Invoke("GetConversations", params, []reflect.Type{reflect.TypeOf((*[]slack.Channel)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 []slack.Channel var ret1 string @@ -67,12 +67,12 @@ func (mock *MockUnderlyingSlackClient) GetConversations(_param0 *slack.GetConver return ret0, ret1, ret2 } -func (mock *MockUnderlyingSlackClient) PostMessage(_param0 string, _param1 ...slack.MsgOption) (string, string, error) { +func (mock *MockUnderlyingSlackClient) PostMessage(channelID string, options ...slack.MsgOption) (string, string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockUnderlyingSlackClient().") } - params := []pegomock.Param{_param0} - for _, param := range _param1 { + params := []pegomock.Param{channelID} + for _, param := range options { params = append(params, param) } result := pegomock.GetGenericMockFrom(mock).Invoke("PostMessage", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) @@ -147,8 +147,8 @@ func (c *MockUnderlyingSlackClient_AuthTest_OngoingVerification) GetCapturedArgu func (c *MockUnderlyingSlackClient_AuthTest_OngoingVerification) GetAllCapturedArguments() { } -func (verifier *VerifierMockUnderlyingSlackClient) GetConversations(_param0 *slack.GetConversationsParameters) *MockUnderlyingSlackClient_GetConversations_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockUnderlyingSlackClient) GetConversations(conversationParams *slack.GetConversationsParameters) *MockUnderlyingSlackClient_GetConversations_OngoingVerification { + params := []pegomock.Param{conversationParams} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GetConversations", params, verifier.timeout) return &MockUnderlyingSlackClient_GetConversations_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -159,8 +159,8 @@ type MockUnderlyingSlackClient_GetConversations_OngoingVerification struct { } func (c *MockUnderlyingSlackClient_GetConversations_OngoingVerification) GetCapturedArguments() *slack.GetConversationsParameters { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + conversationParams := c.GetAllCapturedArguments() + return conversationParams[len(conversationParams)-1] } func (c *MockUnderlyingSlackClient_GetConversations_OngoingVerification) GetAllCapturedArguments() (_param0 []*slack.GetConversationsParameters) { @@ -174,9 +174,9 @@ func (c *MockUnderlyingSlackClient_GetConversations_OngoingVerification) GetAllC return } -func (verifier *VerifierMockUnderlyingSlackClient) PostMessage(_param0 string, _param1 ...slack.MsgOption) *MockUnderlyingSlackClient_PostMessage_OngoingVerification { - params := []pegomock.Param{_param0} - for _, param := range _param1 { +func (verifier *VerifierMockUnderlyingSlackClient) PostMessage(channelID string, options ...slack.MsgOption) *MockUnderlyingSlackClient_PostMessage_OngoingVerification { + params := []pegomock.Param{channelID} + for _, param := range options { params = append(params, param) } methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "PostMessage", params, verifier.timeout) @@ -189,8 +189,8 @@ type MockUnderlyingSlackClient_PostMessage_OngoingVerification struct { } func (c *MockUnderlyingSlackClient_PostMessage_OngoingVerification) GetCapturedArguments() (string, []slack.MsgOption) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + channelID, options := c.GetAllCapturedArguments() + return channelID[len(channelID)-1], options[len(options)-1] } func (c *MockUnderlyingSlackClient_PostMessage_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]slack.MsgOption) { diff --git a/server/events/webhooks/slack_client.go b/server/events/webhooks/slack_client.go index 3f26603dc..3a744b924 100644 --- a/server/events/webhooks/slack_client.go +++ b/server/events/webhooks/slack_client.go @@ -24,7 +24,7 @@ const ( slackFailureColour = "danger" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_slack_client.go SlackClient +//go:generate pegomock generate --package mocks -o mocks/mock_slack_client.go SlackClient // SlackClient handles making API calls to Slack. type SlackClient interface { @@ -33,7 +33,7 @@ type SlackClient interface { PostMessage(channel string, applyResult ApplyResult) error } -//go:generate pegomock generate -m --package mocks -o mocks/mock_underlying_slack_client.go UnderlyingSlackClient +//go:generate pegomock generate --package mocks -o mocks/mock_underlying_slack_client.go UnderlyingSlackClient // UnderlyingSlackClient wraps the nlopes/slack.Client implementation so // we can mock it during tests. diff --git a/server/events/webhooks/slack_client_test.go b/server/events/webhooks/slack_client_test.go index 1f2343e86..83db30324 100644 --- a/server/events/webhooks/slack_client_test.go +++ b/server/events/webhooks/slack_client_test.go @@ -21,7 +21,7 @@ import ( "github.com/runatlantis/atlantis/server/events/webhooks" "github.com/runatlantis/atlantis/server/events/webhooks/mocks" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" . "github.com/runatlantis/atlantis/testing" ) diff --git a/server/events/webhooks/slack_test.go b/server/events/webhooks/slack_test.go index a3ae97b80..dd80d93e4 100644 --- a/server/events/webhooks/slack_test.go +++ b/server/events/webhooks/slack_test.go @@ -17,7 +17,7 @@ import ( "regexp" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/events/webhooks" "github.com/runatlantis/atlantis/server/events/webhooks/mocks" "github.com/runatlantis/atlantis/server/logging" diff --git a/server/events/webhooks/webhooks.go b/server/events/webhooks/webhooks.go index 90e87c6dc..080400f9a 100644 --- a/server/events/webhooks/webhooks.go +++ b/server/events/webhooks/webhooks.go @@ -26,7 +26,7 @@ import ( const SlackKind = "slack" const ApplyEvent = "apply" -//go:generate pegomock generate -m --package mocks -o mocks/mock_sender.go Sender +//go:generate pegomock generate --package mocks -o mocks/mock_sender.go Sender // Sender sends webhooks. type Sender interface { diff --git a/server/events/webhooks/webhooks_test.go b/server/events/webhooks/webhooks_test.go index 3979cf815..03437f528 100644 --- a/server/events/webhooks/webhooks_test.go +++ b/server/events/webhooks/webhooks_test.go @@ -17,7 +17,7 @@ import ( "strings" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/events/webhooks" "github.com/runatlantis/atlantis/server/events/webhooks/mocks" "github.com/runatlantis/atlantis/server/logging" diff --git a/server/events/working_dir.go b/server/events/working_dir.go index 5c57bd6a2..458714e87 100644 --- a/server/events/working_dir.go +++ b/server/events/working_dir.go @@ -31,8 +31,8 @@ const workingDirPrefix = "repos" var cloneLocks sync.Map -//go:generate pegomock generate -m --package mocks -o mocks/mock_working_dir.go WorkingDir -//go:generate pegomock generate -m --package events WorkingDir +//go:generate pegomock generate --package mocks -o mocks/mock_working_dir.go WorkingDir +//go:generate pegomock generate --package events WorkingDir // WorkingDir handles the workspace on disk for running commands. type WorkingDir interface { diff --git a/server/jobs/job_url_setter.go b/server/jobs/job_url_setter.go index 85ca95d2c..872f3c363 100644 --- a/server/jobs/job_url_setter.go +++ b/server/jobs/job_url_setter.go @@ -5,14 +5,14 @@ import ( "github.com/runatlantis/atlantis/server/events/models" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_project_job_url_generator.go ProjectJobURLGenerator +//go:generate pegomock generate --package mocks -o mocks/mock_project_job_url_generator.go ProjectJobURLGenerator // ProjectJobURLGenerator generates urls to view project's progress. type ProjectJobURLGenerator interface { GenerateProjectJobURL(p command.ProjectContext) (string, error) } -//go:generate pegomock generate -m --package mocks -o mocks/mock_project_status_updater.go ProjectStatusUpdater +//go:generate pegomock generate --package mocks -o mocks/mock_project_status_updater.go ProjectStatusUpdater type ProjectStatusUpdater interface { // UpdateProject sets the commit status for the project represented by diff --git a/server/jobs/job_url_setter_test.go b/server/jobs/job_url_setter_test.go index 8a4498731..51167e55e 100644 --- a/server/jobs/job_url_setter_test.go +++ b/server/jobs/job_url_setter_test.go @@ -4,12 +4,11 @@ import ( "errors" "testing" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/events/command" "github.com/runatlantis/atlantis/server/events/models" "github.com/runatlantis/atlantis/server/jobs" "github.com/runatlantis/atlantis/server/jobs/mocks" - "github.com/runatlantis/atlantis/server/jobs/mocks/matchers" . "github.com/runatlantis/atlantis/testing" "github.com/stretchr/testify/assert" ) @@ -25,7 +24,7 @@ func TestJobURLSetter(t *testing.T) { jobURLSetter := jobs.NewJobURLSetter(projectJobURLGenerator, projectStatusUpdater) result := &command.ProjectResult{} - When(projectJobURLGenerator.GenerateProjectJobURL(matchers.EqCommandProjectContext(ctx))).ThenReturn(url, nil) + When(projectJobURLGenerator.GenerateProjectJobURL(Eq[command.ProjectContext](ctx))).ThenReturn(url, nil) When(projectStatusUpdater.UpdateProject(ctx, command.Plan, models.PendingCommitStatus, url, nil)).ThenReturn(nil) err := jobURLSetter.SetJobURLWithStatus(ctx, command.Plan, models.PendingCommitStatus, result) Ok(t, err) @@ -39,7 +38,7 @@ func TestJobURLSetter(t *testing.T) { projectJobURLGenerator := mocks.NewMockProjectJobURLGenerator() jobURLSetter := jobs.NewJobURLSetter(projectJobURLGenerator, projectStatusUpdater) - When(projectJobURLGenerator.GenerateProjectJobURL(matchers.EqCommandProjectContext(ctx))).ThenReturn("url-to-project-jobs", errors.New("some error")) + When(projectJobURLGenerator.GenerateProjectJobURL(Eq[command.ProjectContext](ctx))).ThenReturn("url-to-project-jobs", errors.New("some error")) err := jobURLSetter.SetJobURLWithStatus(ctx, command.Plan, models.PendingCommitStatus, nil) assert.Error(t, err) }) diff --git a/server/jobs/mocks/matchers/chan_of_string.go b/server/jobs/mocks/matchers/chan_of_string.go deleted file mode 100644 index 839d04068..000000000 --- a/server/jobs/mocks/matchers/chan_of_string.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" -) - -func AnyChanOfString() chan string { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(chan string))(nil)).Elem())) - var nullValue chan string - return nullValue -} - -func EqChanOfString(value chan string) chan string { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue chan string - return nullValue -} - -func NotEqChanOfString(value chan string) chan string { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue chan string - return nullValue -} - -func ChanOfStringThat(matcher pegomock.ArgumentMatcher) chan string { - pegomock.RegisterMatcher(matcher) - var nullValue chan string - return nullValue -} diff --git a/server/jobs/mocks/matchers/command_name.go b/server/jobs/mocks/matchers/command_name.go deleted file mode 100644 index f0c39dc39..000000000 --- a/server/jobs/mocks/matchers/command_name.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandName() command.Name { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.Name))(nil)).Elem())) - var nullValue command.Name - return nullValue -} - -func EqCommandName(value command.Name) command.Name { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.Name - return nullValue -} - -func NotEqCommandName(value command.Name) command.Name { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.Name - return nullValue -} - -func CommandNameThat(matcher pegomock.ArgumentMatcher) command.Name { - pegomock.RegisterMatcher(matcher) - var nullValue command.Name - return nullValue -} diff --git a/server/jobs/mocks/matchers/command_projectcontext.go b/server/jobs/mocks/matchers/command_projectcontext.go deleted file mode 100644 index 53929afd5..000000000 --- a/server/jobs/mocks/matchers/command_projectcontext.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyCommandProjectContext() command.ProjectContext { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(command.ProjectContext))(nil)).Elem())) - var nullValue command.ProjectContext - return nullValue -} - -func EqCommandProjectContext(value command.ProjectContext) command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue command.ProjectContext - return nullValue -} - -func NotEqCommandProjectContext(value command.ProjectContext) command.ProjectContext { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue command.ProjectContext - return nullValue -} - -func CommandProjectContextThat(matcher pegomock.ArgumentMatcher) command.ProjectContext { - pegomock.RegisterMatcher(matcher) - var nullValue command.ProjectContext - return nullValue -} diff --git a/server/jobs/mocks/matchers/jobs_pullinfo.go b/server/jobs/mocks/matchers/jobs_pullinfo.go deleted file mode 100644 index c635381a6..000000000 --- a/server/jobs/mocks/matchers/jobs_pullinfo.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - jobs "github.com/runatlantis/atlantis/server/jobs" -) - -func AnyJobsPullInfo() jobs.PullInfo { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(jobs.PullInfo))(nil)).Elem())) - var nullValue jobs.PullInfo - return nullValue -} - -func EqJobsPullInfo(value jobs.PullInfo) jobs.PullInfo { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue jobs.PullInfo - return nullValue -} - -func NotEqJobsPullInfo(value jobs.PullInfo) jobs.PullInfo { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue jobs.PullInfo - return nullValue -} - -func JobsPullInfoThat(matcher pegomock.ArgumentMatcher) jobs.PullInfo { - pegomock.RegisterMatcher(matcher) - var nullValue jobs.PullInfo - return nullValue -} diff --git a/server/jobs/mocks/matchers/models_commitstatus.go b/server/jobs/mocks/matchers/models_commitstatus.go deleted file mode 100644 index f72ee4dc8..000000000 --- a/server/jobs/mocks/matchers/models_commitstatus.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsCommitStatus() models.CommitStatus { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.CommitStatus))(nil)).Elem())) - var nullValue models.CommitStatus - return nullValue -} - -func EqModelsCommitStatus(value models.CommitStatus) models.CommitStatus { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.CommitStatus - return nullValue -} - -func NotEqModelsCommitStatus(value models.CommitStatus) models.CommitStatus { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.CommitStatus - return nullValue -} - -func ModelsCommitStatusThat(matcher pegomock.ArgumentMatcher) models.CommitStatus { - pegomock.RegisterMatcher(matcher) - var nullValue models.CommitStatus - return nullValue -} diff --git a/server/jobs/mocks/matchers/models_workflowhookcommandcontext.go b/server/jobs/mocks/matchers/models_workflowhookcommandcontext.go deleted file mode 100644 index 0d6b8a9af..000000000 --- a/server/jobs/mocks/matchers/models_workflowhookcommandcontext.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - models "github.com/runatlantis/atlantis/server/events/models" -) - -func AnyModelsWorkflowHookCommandContext() models.WorkflowHookCommandContext { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(models.WorkflowHookCommandContext))(nil)).Elem())) - var nullValue models.WorkflowHookCommandContext - return nullValue -} - -func EqModelsWorkflowHookCommandContext(value models.WorkflowHookCommandContext) models.WorkflowHookCommandContext { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue models.WorkflowHookCommandContext - return nullValue -} - -func NotEqModelsWorkflowHookCommandContext(value models.WorkflowHookCommandContext) models.WorkflowHookCommandContext { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue models.WorkflowHookCommandContext - return nullValue -} - -func ModelsWorkflowHookCommandContextThat(matcher pegomock.ArgumentMatcher) models.WorkflowHookCommandContext { - pegomock.RegisterMatcher(matcher) - var nullValue models.WorkflowHookCommandContext - return nullValue -} diff --git a/server/jobs/mocks/matchers/ptr_to_command_projectresult.go b/server/jobs/mocks/matchers/ptr_to_command_projectresult.go deleted file mode 100644 index ca9d37187..000000000 --- a/server/jobs/mocks/matchers/ptr_to_command_projectresult.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - command "github.com/runatlantis/atlantis/server/events/command" -) - -func AnyPtrToCommandProjectResult() *command.ProjectResult { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(*command.ProjectResult))(nil)).Elem())) - var nullValue *command.ProjectResult - return nullValue -} - -func EqPtrToCommandProjectResult(value *command.ProjectResult) *command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue *command.ProjectResult - return nullValue -} - -func NotEqPtrToCommandProjectResult(value *command.ProjectResult) *command.ProjectResult { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue *command.ProjectResult - return nullValue -} - -func PtrToCommandProjectResultThat(matcher pegomock.ArgumentMatcher) *command.ProjectResult { - pegomock.RegisterMatcher(matcher) - var nullValue *command.ProjectResult - return nullValue -} diff --git a/server/jobs/mocks/mock_project_command_output_handler.go b/server/jobs/mocks/mock_project_command_output_handler.go index ee68f0908..e128ef326 100644 --- a/server/jobs/mocks/mock_project_command_output_handler.go +++ b/server/jobs/mocks/mock_project_command_output_handler.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" models "github.com/runatlantis/atlantis/server/events/models" jobs "github.com/runatlantis/atlantis/server/jobs" @@ -27,19 +27,19 @@ func NewMockProjectCommandOutputHandler(options ...pegomock.Option) *MockProject func (mock *MockProjectCommandOutputHandler) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockProjectCommandOutputHandler) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockProjectCommandOutputHandler) CleanUp(_param0 jobs.PullInfo) { +func (mock *MockProjectCommandOutputHandler) CleanUp(pullInfo jobs.PullInfo) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandOutputHandler().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{pullInfo} pegomock.GetGenericMockFrom(mock).Invoke("CleanUp", params, []reflect.Type{}) } -func (mock *MockProjectCommandOutputHandler) Deregister(_param0 string, _param1 chan string) { +func (mock *MockProjectCommandOutputHandler) Deregister(jobID string, receiver chan string) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandOutputHandler().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{jobID, receiver} pegomock.GetGenericMockFrom(mock).Invoke("Deregister", params, []reflect.Type{}) } @@ -51,11 +51,11 @@ func (mock *MockProjectCommandOutputHandler) Handle() { pegomock.GetGenericMockFrom(mock).Invoke("Handle", params, []reflect.Type{}) } -func (mock *MockProjectCommandOutputHandler) IsKeyExists(_param0 string) bool { +func (mock *MockProjectCommandOutputHandler) IsKeyExists(key string) bool { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandOutputHandler().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{key} result := pegomock.GetGenericMockFrom(mock).Invoke("IsKeyExists", params, []reflect.Type{reflect.TypeOf((*bool)(nil)).Elem()}) var ret0 bool if len(result) != 0 { @@ -66,27 +66,27 @@ func (mock *MockProjectCommandOutputHandler) IsKeyExists(_param0 string) bool { return ret0 } -func (mock *MockProjectCommandOutputHandler) Register(_param0 string, _param1 chan string) { +func (mock *MockProjectCommandOutputHandler) Register(jobID string, receiver chan string) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandOutputHandler().") } - params := []pegomock.Param{_param0, _param1} + params := []pegomock.Param{jobID, receiver} pegomock.GetGenericMockFrom(mock).Invoke("Register", params, []reflect.Type{}) } -func (mock *MockProjectCommandOutputHandler) Send(_param0 command.ProjectContext, _param1 string, _param2 bool) { +func (mock *MockProjectCommandOutputHandler) Send(ctx command.ProjectContext, msg string, operationComplete bool) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandOutputHandler().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{ctx, msg, operationComplete} pegomock.GetGenericMockFrom(mock).Invoke("Send", params, []reflect.Type{}) } -func (mock *MockProjectCommandOutputHandler) SendWorkflowHook(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 bool) { +func (mock *MockProjectCommandOutputHandler) SendWorkflowHook(ctx models.WorkflowHookCommandContext, msg string, operationComplete bool) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectCommandOutputHandler().") } - params := []pegomock.Param{_param0, _param1, _param2} + params := []pegomock.Param{ctx, msg, operationComplete} pegomock.GetGenericMockFrom(mock).Invoke("SendWorkflowHook", params, []reflect.Type{}) } @@ -127,8 +127,8 @@ type VerifierMockProjectCommandOutputHandler struct { timeout time.Duration } -func (verifier *VerifierMockProjectCommandOutputHandler) CleanUp(_param0 jobs.PullInfo) *MockProjectCommandOutputHandler_CleanUp_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandOutputHandler) CleanUp(pullInfo jobs.PullInfo) *MockProjectCommandOutputHandler_CleanUp_OngoingVerification { + params := []pegomock.Param{pullInfo} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "CleanUp", params, verifier.timeout) return &MockProjectCommandOutputHandler_CleanUp_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -139,8 +139,8 @@ type MockProjectCommandOutputHandler_CleanUp_OngoingVerification struct { } func (c *MockProjectCommandOutputHandler_CleanUp_OngoingVerification) GetCapturedArguments() jobs.PullInfo { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + pullInfo := c.GetAllCapturedArguments() + return pullInfo[len(pullInfo)-1] } func (c *MockProjectCommandOutputHandler_CleanUp_OngoingVerification) GetAllCapturedArguments() (_param0 []jobs.PullInfo) { @@ -154,8 +154,8 @@ func (c *MockProjectCommandOutputHandler_CleanUp_OngoingVerification) GetAllCapt return } -func (verifier *VerifierMockProjectCommandOutputHandler) Deregister(_param0 string, _param1 chan string) *MockProjectCommandOutputHandler_Deregister_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockProjectCommandOutputHandler) Deregister(jobID string, receiver chan string) *MockProjectCommandOutputHandler_Deregister_OngoingVerification { + params := []pegomock.Param{jobID, receiver} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Deregister", params, verifier.timeout) return &MockProjectCommandOutputHandler_Deregister_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -166,8 +166,8 @@ type MockProjectCommandOutputHandler_Deregister_OngoingVerification struct { } func (c *MockProjectCommandOutputHandler_Deregister_OngoingVerification) GetCapturedArguments() (string, chan string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + jobID, receiver := c.GetAllCapturedArguments() + return jobID[len(jobID)-1], receiver[len(receiver)-1] } func (c *MockProjectCommandOutputHandler_Deregister_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []chan string) { @@ -202,8 +202,8 @@ func (c *MockProjectCommandOutputHandler_Handle_OngoingVerification) GetCaptured func (c *MockProjectCommandOutputHandler_Handle_OngoingVerification) GetAllCapturedArguments() { } -func (verifier *VerifierMockProjectCommandOutputHandler) IsKeyExists(_param0 string) *MockProjectCommandOutputHandler_IsKeyExists_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectCommandOutputHandler) IsKeyExists(key string) *MockProjectCommandOutputHandler_IsKeyExists_OngoingVerification { + params := []pegomock.Param{key} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "IsKeyExists", params, verifier.timeout) return &MockProjectCommandOutputHandler_IsKeyExists_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -214,8 +214,8 @@ type MockProjectCommandOutputHandler_IsKeyExists_OngoingVerification struct { } func (c *MockProjectCommandOutputHandler_IsKeyExists_OngoingVerification) GetCapturedArguments() string { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + key := c.GetAllCapturedArguments() + return key[len(key)-1] } func (c *MockProjectCommandOutputHandler_IsKeyExists_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { @@ -229,8 +229,8 @@ func (c *MockProjectCommandOutputHandler_IsKeyExists_OngoingVerification) GetAll return } -func (verifier *VerifierMockProjectCommandOutputHandler) Register(_param0 string, _param1 chan string) *MockProjectCommandOutputHandler_Register_OngoingVerification { - params := []pegomock.Param{_param0, _param1} +func (verifier *VerifierMockProjectCommandOutputHandler) Register(jobID string, receiver chan string) *MockProjectCommandOutputHandler_Register_OngoingVerification { + params := []pegomock.Param{jobID, receiver} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Register", params, verifier.timeout) return &MockProjectCommandOutputHandler_Register_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -241,8 +241,8 @@ type MockProjectCommandOutputHandler_Register_OngoingVerification struct { } func (c *MockProjectCommandOutputHandler_Register_OngoingVerification) GetCapturedArguments() (string, chan string) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + jobID, receiver := c.GetAllCapturedArguments() + return jobID[len(jobID)-1], receiver[len(receiver)-1] } func (c *MockProjectCommandOutputHandler_Register_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []chan string) { @@ -260,8 +260,8 @@ func (c *MockProjectCommandOutputHandler_Register_OngoingVerification) GetAllCap return } -func (verifier *VerifierMockProjectCommandOutputHandler) Send(_param0 command.ProjectContext, _param1 string, _param2 bool) *MockProjectCommandOutputHandler_Send_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockProjectCommandOutputHandler) Send(ctx command.ProjectContext, msg string, operationComplete bool) *MockProjectCommandOutputHandler_Send_OngoingVerification { + params := []pegomock.Param{ctx, msg, operationComplete} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Send", params, verifier.timeout) return &MockProjectCommandOutputHandler_Send_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -272,8 +272,8 @@ type MockProjectCommandOutputHandler_Send_OngoingVerification struct { } func (c *MockProjectCommandOutputHandler_Send_OngoingVerification) GetCapturedArguments() (command.ProjectContext, string, bool) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + ctx, msg, operationComplete := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], msg[len(msg)-1], operationComplete[len(operationComplete)-1] } func (c *MockProjectCommandOutputHandler_Send_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []string, _param2 []bool) { @@ -295,8 +295,8 @@ func (c *MockProjectCommandOutputHandler_Send_OngoingVerification) GetAllCapture return } -func (verifier *VerifierMockProjectCommandOutputHandler) SendWorkflowHook(_param0 models.WorkflowHookCommandContext, _param1 string, _param2 bool) *MockProjectCommandOutputHandler_SendWorkflowHook_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2} +func (verifier *VerifierMockProjectCommandOutputHandler) SendWorkflowHook(ctx models.WorkflowHookCommandContext, msg string, operationComplete bool) *MockProjectCommandOutputHandler_SendWorkflowHook_OngoingVerification { + params := []pegomock.Param{ctx, msg, operationComplete} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SendWorkflowHook", params, verifier.timeout) return &MockProjectCommandOutputHandler_SendWorkflowHook_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -307,8 +307,8 @@ type MockProjectCommandOutputHandler_SendWorkflowHook_OngoingVerification struct } func (c *MockProjectCommandOutputHandler_SendWorkflowHook_OngoingVerification) GetCapturedArguments() (models.WorkflowHookCommandContext, string, bool) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + ctx, msg, operationComplete := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], msg[len(msg)-1], operationComplete[len(operationComplete)-1] } func (c *MockProjectCommandOutputHandler_SendWorkflowHook_OngoingVerification) GetAllCapturedArguments() (_param0 []models.WorkflowHookCommandContext, _param1 []string, _param2 []bool) { diff --git a/server/jobs/mocks/mock_project_job_url_generator.go b/server/jobs/mocks/mock_project_job_url_generator.go index 005dd50fb..5f37982af 100644 --- a/server/jobs/mocks/mock_project_job_url_generator.go +++ b/server/jobs/mocks/mock_project_job_url_generator.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" "reflect" "time" @@ -25,11 +25,11 @@ func NewMockProjectJobURLGenerator(options ...pegomock.Option) *MockProjectJobUR func (mock *MockProjectJobURLGenerator) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockProjectJobURLGenerator) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockProjectJobURLGenerator) GenerateProjectJobURL(_param0 command.ProjectContext) (string, error) { +func (mock *MockProjectJobURLGenerator) GenerateProjectJobURL(p command.ProjectContext) (string, error) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectJobURLGenerator().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{p} result := pegomock.GetGenericMockFrom(mock).Invoke("GenerateProjectJobURL", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) var ret0 string var ret1 error @@ -81,8 +81,8 @@ type VerifierMockProjectJobURLGenerator struct { timeout time.Duration } -func (verifier *VerifierMockProjectJobURLGenerator) GenerateProjectJobURL(_param0 command.ProjectContext) *MockProjectJobURLGenerator_GenerateProjectJobURL_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockProjectJobURLGenerator) GenerateProjectJobURL(p command.ProjectContext) *MockProjectJobURLGenerator_GenerateProjectJobURL_OngoingVerification { + params := []pegomock.Param{p} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "GenerateProjectJobURL", params, verifier.timeout) return &MockProjectJobURLGenerator_GenerateProjectJobURL_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -93,8 +93,8 @@ type MockProjectJobURLGenerator_GenerateProjectJobURL_OngoingVerification struct } func (c *MockProjectJobURLGenerator_GenerateProjectJobURL_OngoingVerification) GetCapturedArguments() command.ProjectContext { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + p := c.GetAllCapturedArguments() + return p[len(p)-1] } func (c *MockProjectJobURLGenerator_GenerateProjectJobURL_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext) { diff --git a/server/jobs/mocks/mock_project_status_updater.go b/server/jobs/mocks/mock_project_status_updater.go index faecdf1a7..f79baa586 100644 --- a/server/jobs/mocks/mock_project_status_updater.go +++ b/server/jobs/mocks/mock_project_status_updater.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" command "github.com/runatlantis/atlantis/server/events/command" models "github.com/runatlantis/atlantis/server/events/models" "reflect" @@ -26,16 +26,16 @@ func NewMockProjectStatusUpdater(options ...pegomock.Option) *MockProjectStatusU func (mock *MockProjectStatusUpdater) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockProjectStatusUpdater) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockProjectStatusUpdater) UpdateProject(_param0 command.ProjectContext, _param1 command.Name, _param2 models.CommitStatus, _param3 string, _param4 *command.ProjectResult) error { +func (mock *MockProjectStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) error { if mock == nil { panic("mock must not be nil. Use myMock := NewMockProjectStatusUpdater().") } - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} - result := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProject", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) + params := []pegomock.Param{ctx, cmdName, status, url, result} + pegomockResult := pegomock.GetGenericMockFrom(mock).Invoke("UpdateProject", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()}) var ret0 error - if len(result) != 0 { - if result[0] != nil { - ret0 = result[0].(error) + if len(pegomockResult) != 0 { + if pegomockResult[0] != nil { + ret0 = pegomockResult[0].(error) } } return ret0 @@ -78,8 +78,8 @@ type VerifierMockProjectStatusUpdater struct { timeout time.Duration } -func (verifier *VerifierMockProjectStatusUpdater) UpdateProject(_param0 command.ProjectContext, _param1 command.Name, _param2 models.CommitStatus, _param3 string, _param4 *command.ProjectResult) *MockProjectStatusUpdater_UpdateProject_OngoingVerification { - params := []pegomock.Param{_param0, _param1, _param2, _param3, _param4} +func (verifier *VerifierMockProjectStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) *MockProjectStatusUpdater_UpdateProject_OngoingVerification { + params := []pegomock.Param{ctx, cmdName, status, url, result} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "UpdateProject", params, verifier.timeout) return &MockProjectStatusUpdater_UpdateProject_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -90,8 +90,8 @@ type MockProjectStatusUpdater_UpdateProject_OngoingVerification struct { } func (c *MockProjectStatusUpdater_UpdateProject_OngoingVerification) GetCapturedArguments() (command.ProjectContext, command.Name, models.CommitStatus, string, *command.ProjectResult) { - _param0, _param1, _param2, _param3, _param4 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1], _param3[len(_param3)-1], _param4[len(_param4)-1] + ctx, cmdName, status, url, result := c.GetAllCapturedArguments() + return ctx[len(ctx)-1], cmdName[len(cmdName)-1], status[len(status)-1], url[len(url)-1], result[len(result)-1] } func (c *MockProjectStatusUpdater_UpdateProject_OngoingVerification) GetAllCapturedArguments() (_param0 []command.ProjectContext, _param1 []command.Name, _param2 []models.CommitStatus, _param3 []string, _param4 []*command.ProjectResult) { diff --git a/server/jobs/project_command_output_handler.go b/server/jobs/project_command_output_handler.go index 6ef75476c..3a447ed4b 100644 --- a/server/jobs/project_command_output_handler.go +++ b/server/jobs/project_command_output_handler.go @@ -49,7 +49,7 @@ type AsyncProjectCommandOutputHandler struct { pullToJobMapping sync.Map } -//go:generate pegomock generate -m --package mocks -o mocks/mock_project_command_output_handler.go ProjectCommandOutputHandler +//go:generate pegomock generate --package mocks -o mocks/mock_project_command_output_handler.go ProjectCommandOutputHandler type ProjectCommandOutputHandler interface { // Send will enqueue the msg and wait for Handle() to receive the message. diff --git a/server/logging/mocks/matchers/logging_loglevel.go b/server/logging/mocks/matchers/logging_loglevel.go deleted file mode 100644 index 920777fa5..000000000 --- a/server/logging/mocks/matchers/logging_loglevel.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - logging "github.com/runatlantis/atlantis/server/logging" -) - -func AnyLoggingLogLevel() logging.LogLevel { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.LogLevel))(nil)).Elem())) - var nullValue logging.LogLevel - return nullValue -} - -func EqLoggingLogLevel(value logging.LogLevel) logging.LogLevel { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue logging.LogLevel - return nullValue -} - -func NotEqLoggingLogLevel(value logging.LogLevel) logging.LogLevel { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue logging.LogLevel - return nullValue -} - -func LoggingLogLevelThat(matcher pegomock.ArgumentMatcher) logging.LogLevel { - pegomock.RegisterMatcher(matcher) - var nullValue logging.LogLevel - return nullValue -} diff --git a/server/logging/mocks/matchers/logging_simplelogging.go b/server/logging/mocks/matchers/logging_simplelogging.go deleted file mode 100644 index 6bb3b9ec9..000000000 --- a/server/logging/mocks/matchers/logging_simplelogging.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by pegomock. DO NOT EDIT. -package matchers - -import ( - pegomock "github.com/petergtz/pegomock/v3" - "reflect" - - logging "github.com/runatlantis/atlantis/server/logging" -) - -func AnyLoggingSimpleLogging() logging.SimpleLogging { - pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(logging.SimpleLogging))(nil)).Elem())) - var nullValue logging.SimpleLogging - return nullValue -} - -func EqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func NotEqLoggingSimpleLogging(value logging.SimpleLogging) logging.SimpleLogging { - pegomock.RegisterMatcher(&pegomock.NotEqMatcher{Value: value}) - var nullValue logging.SimpleLogging - return nullValue -} - -func LoggingSimpleLoggingThat(matcher pegomock.ArgumentMatcher) logging.SimpleLogging { - pegomock.RegisterMatcher(matcher) - var nullValue logging.SimpleLogging - return nullValue -} diff --git a/server/logging/mocks/mock_simple_logging.go b/server/logging/mocks/mock_simple_logging.go index 805c94cc3..2afa845c4 100644 --- a/server/logging/mocks/mock_simple_logging.go +++ b/server/logging/mocks/mock_simple_logging.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" logging "github.com/runatlantis/atlantis/server/logging" "reflect" "time" @@ -25,23 +25,23 @@ func NewMockSimpleLogging(options ...pegomock.Option) *MockSimpleLogging { func (mock *MockSimpleLogging) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } func (mock *MockSimpleLogging) FailHandler() pegomock.FailHandler { return mock.fail } -func (mock *MockSimpleLogging) Debug(_param0 string, _param1 ...interface{}) { +func (mock *MockSimpleLogging) Debug(format string, a ...interface{}) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSimpleLogging().") } - params := []pegomock.Param{_param0} - for _, param := range _param1 { + params := []pegomock.Param{format} + for _, param := range a { params = append(params, param) } pegomock.GetGenericMockFrom(mock).Invoke("Debug", params, []reflect.Type{}) } -func (mock *MockSimpleLogging) Err(_param0 string, _param1 ...interface{}) { +func (mock *MockSimpleLogging) Err(format string, a ...interface{}) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSimpleLogging().") } - params := []pegomock.Param{_param0} - for _, param := range _param1 { + params := []pegomock.Param{format} + for _, param := range a { params = append(params, param) } pegomock.GetGenericMockFrom(mock).Invoke("Err", params, []reflect.Type{}) @@ -77,53 +77,53 @@ func (mock *MockSimpleLogging) GetHistory() string { return ret0 } -func (mock *MockSimpleLogging) Info(_param0 string, _param1 ...interface{}) { +func (mock *MockSimpleLogging) Info(format string, a ...interface{}) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSimpleLogging().") } - params := []pegomock.Param{_param0} - for _, param := range _param1 { + params := []pegomock.Param{format} + for _, param := range a { params = append(params, param) } pegomock.GetGenericMockFrom(mock).Invoke("Info", params, []reflect.Type{}) } -func (mock *MockSimpleLogging) Log(_param0 logging.LogLevel, _param1 string, _param2 ...interface{}) { +func (mock *MockSimpleLogging) Log(level logging.LogLevel, format string, a ...interface{}) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSimpleLogging().") } - params := []pegomock.Param{_param0, _param1} - for _, param := range _param2 { + params := []pegomock.Param{level, format} + for _, param := range a { params = append(params, param) } pegomock.GetGenericMockFrom(mock).Invoke("Log", params, []reflect.Type{}) } -func (mock *MockSimpleLogging) SetLevel(_param0 logging.LogLevel) { +func (mock *MockSimpleLogging) SetLevel(lvl logging.LogLevel) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSimpleLogging().") } - params := []pegomock.Param{_param0} + params := []pegomock.Param{lvl} pegomock.GetGenericMockFrom(mock).Invoke("SetLevel", params, []reflect.Type{}) } -func (mock *MockSimpleLogging) Warn(_param0 string, _param1 ...interface{}) { +func (mock *MockSimpleLogging) Warn(format string, a ...interface{}) { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSimpleLogging().") } - params := []pegomock.Param{_param0} - for _, param := range _param1 { + params := []pegomock.Param{format} + for _, param := range a { params = append(params, param) } pegomock.GetGenericMockFrom(mock).Invoke("Warn", params, []reflect.Type{}) } -func (mock *MockSimpleLogging) With(_param0 ...interface{}) logging.SimpleLogging { +func (mock *MockSimpleLogging) With(a ...interface{}) logging.SimpleLogging { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSimpleLogging().") } params := []pegomock.Param{} - for _, param := range _param0 { + for _, param := range a { params = append(params, param) } result := pegomock.GetGenericMockFrom(mock).Invoke("With", params, []reflect.Type{reflect.TypeOf((*logging.SimpleLogging)(nil)).Elem()}) @@ -136,12 +136,12 @@ func (mock *MockSimpleLogging) With(_param0 ...interface{}) logging.SimpleLoggin return ret0 } -func (mock *MockSimpleLogging) WithHistory(_param0 ...interface{}) logging.SimpleLogging { +func (mock *MockSimpleLogging) WithHistory(a ...interface{}) logging.SimpleLogging { if mock == nil { panic("mock must not be nil. Use myMock := NewMockSimpleLogging().") } params := []pegomock.Param{} - for _, param := range _param0 { + for _, param := range a { params = append(params, param) } result := pegomock.GetGenericMockFrom(mock).Invoke("WithHistory", params, []reflect.Type{reflect.TypeOf((*logging.SimpleLogging)(nil)).Elem()}) @@ -191,9 +191,9 @@ type VerifierMockSimpleLogging struct { timeout time.Duration } -func (verifier *VerifierMockSimpleLogging) Debug(_param0 string, _param1 ...interface{}) *MockSimpleLogging_Debug_OngoingVerification { - params := []pegomock.Param{_param0} - for _, param := range _param1 { +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) @@ -206,8 +206,8 @@ type MockSimpleLogging_Debug_OngoingVerification struct { } func (c *MockSimpleLogging_Debug_OngoingVerification) GetCapturedArguments() (string, []interface{}) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + format, a := c.GetAllCapturedArguments() + return format[len(format)-1], a[len(a)-1] } func (c *MockSimpleLogging_Debug_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) { @@ -230,9 +230,9 @@ func (c *MockSimpleLogging_Debug_OngoingVerification) GetAllCapturedArguments() return } -func (verifier *VerifierMockSimpleLogging) Err(_param0 string, _param1 ...interface{}) *MockSimpleLogging_Err_OngoingVerification { - params := []pegomock.Param{_param0} - for _, param := range _param1 { +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) @@ -245,8 +245,8 @@ type MockSimpleLogging_Err_OngoingVerification struct { } func (c *MockSimpleLogging_Err_OngoingVerification) GetCapturedArguments() (string, []interface{}) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + format, a := c.GetAllCapturedArguments() + return format[len(format)-1], a[len(a)-1] } func (c *MockSimpleLogging_Err_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) { @@ -303,9 +303,9 @@ func (c *MockSimpleLogging_GetHistory_OngoingVerification) GetCapturedArguments( func (c *MockSimpleLogging_GetHistory_OngoingVerification) GetAllCapturedArguments() { } -func (verifier *VerifierMockSimpleLogging) Info(_param0 string, _param1 ...interface{}) *MockSimpleLogging_Info_OngoingVerification { - params := []pegomock.Param{_param0} - for _, param := range _param1 { +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) @@ -318,8 +318,8 @@ type MockSimpleLogging_Info_OngoingVerification struct { } func (c *MockSimpleLogging_Info_OngoingVerification) GetCapturedArguments() (string, []interface{}) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + format, a := c.GetAllCapturedArguments() + return format[len(format)-1], a[len(a)-1] } func (c *MockSimpleLogging_Info_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) { @@ -342,9 +342,9 @@ func (c *MockSimpleLogging_Info_OngoingVerification) GetAllCapturedArguments() ( return } -func (verifier *VerifierMockSimpleLogging) Log(_param0 logging.LogLevel, _param1 string, _param2 ...interface{}) *MockSimpleLogging_Log_OngoingVerification { - params := []pegomock.Param{_param0, _param1} - for _, param := range _param2 { +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) @@ -357,8 +357,8 @@ type MockSimpleLogging_Log_OngoingVerification struct { } func (c *MockSimpleLogging_Log_OngoingVerification) GetCapturedArguments() (logging.LogLevel, string, []interface{}) { - _param0, _param1, _param2 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1], _param2[len(_param2)-1] + level, format, a := c.GetAllCapturedArguments() + return level[len(level)-1], format[len(format)-1], a[len(a)-1] } func (c *MockSimpleLogging_Log_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.LogLevel, _param1 []string, _param2 [][]interface{}) { @@ -385,8 +385,8 @@ func (c *MockSimpleLogging_Log_OngoingVerification) GetAllCapturedArguments() (_ return } -func (verifier *VerifierMockSimpleLogging) SetLevel(_param0 logging.LogLevel) *MockSimpleLogging_SetLevel_OngoingVerification { - params := []pegomock.Param{_param0} +func (verifier *VerifierMockSimpleLogging) SetLevel(lvl logging.LogLevel) *MockSimpleLogging_SetLevel_OngoingVerification { + params := []pegomock.Param{lvl} methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "SetLevel", params, verifier.timeout) return &MockSimpleLogging_SetLevel_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} } @@ -397,8 +397,8 @@ type MockSimpleLogging_SetLevel_OngoingVerification struct { } func (c *MockSimpleLogging_SetLevel_OngoingVerification) GetCapturedArguments() logging.LogLevel { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + lvl := c.GetAllCapturedArguments() + return lvl[len(lvl)-1] } func (c *MockSimpleLogging_SetLevel_OngoingVerification) GetAllCapturedArguments() (_param0 []logging.LogLevel) { @@ -412,9 +412,9 @@ func (c *MockSimpleLogging_SetLevel_OngoingVerification) GetAllCapturedArguments return } -func (verifier *VerifierMockSimpleLogging) Warn(_param0 string, _param1 ...interface{}) *MockSimpleLogging_Warn_OngoingVerification { - params := []pegomock.Param{_param0} - for _, param := range _param1 { +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) @@ -427,8 +427,8 @@ type MockSimpleLogging_Warn_OngoingVerification struct { } func (c *MockSimpleLogging_Warn_OngoingVerification) GetCapturedArguments() (string, []interface{}) { - _param0, _param1 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1], _param1[len(_param1)-1] + format, a := c.GetAllCapturedArguments() + return format[len(format)-1], a[len(a)-1] } func (c *MockSimpleLogging_Warn_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 [][]interface{}) { @@ -451,9 +451,9 @@ func (c *MockSimpleLogging_Warn_OngoingVerification) GetAllCapturedArguments() ( return } -func (verifier *VerifierMockSimpleLogging) With(_param0 ...interface{}) *MockSimpleLogging_With_OngoingVerification { +func (verifier *VerifierMockSimpleLogging) With(a ...interface{}) *MockSimpleLogging_With_OngoingVerification { params := []pegomock.Param{} - for _, param := range _param0 { + for _, param := range a { params = append(params, param) } methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "With", params, verifier.timeout) @@ -466,8 +466,8 @@ type MockSimpleLogging_With_OngoingVerification struct { } func (c *MockSimpleLogging_With_OngoingVerification) GetCapturedArguments() []interface{} { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + a := c.GetAllCapturedArguments() + return a[len(a)-1] } func (c *MockSimpleLogging_With_OngoingVerification) GetAllCapturedArguments() (_param0 [][]interface{}) { @@ -486,9 +486,9 @@ func (c *MockSimpleLogging_With_OngoingVerification) GetAllCapturedArguments() ( return } -func (verifier *VerifierMockSimpleLogging) WithHistory(_param0 ...interface{}) *MockSimpleLogging_WithHistory_OngoingVerification { +func (verifier *VerifierMockSimpleLogging) WithHistory(a ...interface{}) *MockSimpleLogging_WithHistory_OngoingVerification { params := []pegomock.Param{} - for _, param := range _param0 { + for _, param := range a { params = append(params, param) } methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "WithHistory", params, verifier.timeout) @@ -501,8 +501,8 @@ type MockSimpleLogging_WithHistory_OngoingVerification struct { } func (c *MockSimpleLogging_WithHistory_OngoingVerification) GetCapturedArguments() []interface{} { - _param0 := c.GetAllCapturedArguments() - return _param0[len(_param0)-1] + a := c.GetAllCapturedArguments() + return a[len(a)-1] } func (c *MockSimpleLogging_WithHistory_OngoingVerification) GetAllCapturedArguments() (_param0 [][]interface{}) { diff --git a/server/logging/simple_logger.go b/server/logging/simple_logger.go index 74543bde9..aa98c51a2 100644 --- a/server/logging/simple_logger.go +++ b/server/logging/simple_logger.go @@ -27,7 +27,7 @@ import ( "go.uber.org/zap/zaptest" ) -//go:generate pegomock generate -m --package mocks -o mocks/mock_simple_logging.go SimpleLogging +//go:generate pegomock generate --package mocks -o mocks/mock_simple_logging.go SimpleLogging // SimpleLogging is the interface used for logging throughout the codebase. type SimpleLogging interface { diff --git a/server/scheduled/executor_service.go b/server/scheduled/executor_service.go index 682e103b1..bfee89a03 100644 --- a/server/scheduled/executor_service.go +++ b/server/scheduled/executor_service.go @@ -102,7 +102,7 @@ func (s *ExecutorService) runScheduledJob(ctx context.Context, wg *sync.WaitGrou } -//go:generate pegomock generate -m --package mocks -o mocks/mock_executor_service_job.go Job +//go:generate pegomock generate --package mocks -o mocks/mock_executor_service_job.go Job type Job interface { Run() } diff --git a/server/scheduled/executor_service_test.go b/server/scheduled/executor_service_test.go index 5b3422feb..a3dcbedb4 100644 --- a/server/scheduled/executor_service_test.go +++ b/server/scheduled/executor_service_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server/logging" "github.com/runatlantis/atlantis/server/scheduled/mocks" ) diff --git a/server/scheduled/mocks/mock_executor_service_job.go b/server/scheduled/mocks/mock_executor_service_job.go index 4bb147aa7..404e91440 100644 --- a/server/scheduled/mocks/mock_executor_service_job.go +++ b/server/scheduled/mocks/mock_executor_service_job.go @@ -4,7 +4,7 @@ package mocks import ( - pegomock "github.com/petergtz/pegomock/v3" + pegomock "github.com/petergtz/pegomock/v4" "reflect" "time" ) diff --git a/server/server_test.go b/server/server_test.go index 1dd2e99d3..96bc0c828 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -25,7 +25,7 @@ import ( "time" "github.com/gorilla/mux" - . "github.com/petergtz/pegomock/v3" + . "github.com/petergtz/pegomock/v4" "github.com/runatlantis/atlantis/server" "github.com/runatlantis/atlantis/server/controllers/templates" tMocks "github.com/runatlantis/atlantis/server/controllers/templates/mocks"