Skip to content

Commit

Permalink
Add Update() mock for beta health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerhance authored and bowei committed Jul 11, 2019
1 parent c3ad81d commit c2d8703
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/cloud/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,21 @@ func UpdateAlphaHealthCheckHook(ctx context.Context, key *meta.Key, obj *alpha.H
return nil
}

// UpdateBetaHealthCheckHook defines the hook for updating a HealthCheck. It
// replaces the object with the same key in the mock with the updated object.
func UpdateBetaHealthCheckHook(ctx context.Context, key *meta.Key, obj *beta.HealthCheck, m *cloud.MockBetaHealthChecks) error {
if _, err := m.Get(ctx, key); err != nil {
return err
}

obj.Name = key.Name
projectID := m.ProjectRouter.ProjectID(ctx, "beta", "healthChecks")
obj.SelfLink = cloud.SelfLink(meta.VersionBeta, projectID, "healthChecks", key)

m.Objects[*key] = &cloud.MockHealthChecksObj{Obj: obj}
return nil
}

// UpdateRegionBackendServiceHook defines the hook for updating a Region
// BackendsService. It replaces the object with the same key in the mock with
// the updated object.
Expand Down

0 comments on commit c2d8703

Please sign in to comment.