From cad6c5453b7e3b5dcd6f0853552764d40d0b9021 Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Tue, 11 Jul 2023 09:42:11 -0700 Subject: [PATCH] Migrate `RecordPackageManagerVersion` to `RecordEcosystemVersions` This endpoint was renamed in https://github.com/dependabot/dependabot-core/pull/7517 and the accompanying internal API change. So the mock here needs updating. Also updated the struct. --- internal/model/update.go | 2 +- internal/server/api.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/model/update.go b/internal/model/update.go index daf624b..d3ad553 100644 --- a/internal/model/update.go +++ b/internal/model/update.go @@ -51,7 +51,7 @@ type MarkAsProcessed struct { BaseCommitSha string `json:"base-commit-sha" yaml:"base-commit-sha"` } -type RecordPackageManagerVersion struct { +type RecordEcosystemVersions struct { Ecosystem string `json:"ecosystem" yaml:"ecosystem"` PackageManagers map[string]any `json:"package-managers" yaml:"package-managers"` } diff --git a/internal/server/api.go b/internal/server/api.go index 6923a0a..b5a694c 100644 --- a/internal/server/api.go +++ b/internal/server/api.go @@ -223,8 +223,8 @@ func decodeWrapper(kind string, data []byte) (actual *model.UpdateWrapper, err e actual.Data, err = decode[model.ClosePullRequest](data) case "mark_as_processed": actual.Data, err = decode[model.MarkAsProcessed](data) - case "record_package_manager_version": - actual.Data, err = decode[model.RecordPackageManagerVersion](data) + case "record_ecosystem_versions": + actual.Data, err = decode[model.RecordEcosystemVersions](data) case "record_update_job_error": actual.Data, err = decode[model.RecordUpdateJobError](data) case "increment_metric": @@ -273,8 +273,8 @@ func compare(expect, actual *model.UpdateWrapper) error { return compareUpdatePullRequest(v, actual.Data.(model.UpdatePullRequest)) case model.ClosePullRequest: return compareClosePullRequest(v, actual.Data.(model.ClosePullRequest)) - case model.RecordPackageManagerVersion: - return compareRecordPackageManagerVersion(v, actual.Data.(model.RecordPackageManagerVersion)) + case model.RecordEcosystemVersions: + return compareRecordEcosystemVersions(v, actual.Data.(model.RecordEcosystemVersions)) case model.MarkAsProcessed: return compareMarkAsProcessed(v, actual.Data.(model.MarkAsProcessed)) case model.RecordUpdateJobError: @@ -316,11 +316,11 @@ func compareClosePullRequest(expect, actual model.ClosePullRequest) error { return unexpectedBody("close_pull_request") } -func compareRecordPackageManagerVersion(expect, actual model.RecordPackageManagerVersion) error { +func compareRecordEcosystemVersions(expect, actual model.RecordEcosystemVersions) error { if reflect.DeepEqual(expect, actual) { return nil } - return unexpectedBody("record_package_manager_version") + return unexpectedBody("record_ecosystem_versions") } func compareMarkAsProcessed(expect, actual model.MarkAsProcessed) error {