Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#3105 from justinsb/mockgcp_com…
Browse files Browse the repository at this point in the history
…pute_address_not_found

mockgcp: more fidelity for compute address
  • Loading branch information
google-oss-prow[bot] authored Nov 18, 2024
2 parents 8b7eb83 + 3fbb479 commit 7411838
Show file tree
Hide file tree
Showing 30 changed files with 74 additions and 68 deletions.
3 changes: 3 additions & 0 deletions mockgcp/mockcompute/globaladdress.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func (s *GlobalAddressesV1) Get(ctx context.Context, req *pb.GetGlobalAddressReq

obj := &pb.Address{}
if err := s.storage.Get(ctx, fqn, obj); err != nil {
if status.Code(err) == codes.NotFound {
return nil, status.Errorf(codes.NotFound, "The resource '%s' was not found", fqn)
}
return nil, err
}

Expand Down
3 changes: 3 additions & 0 deletions mockgcp/mockcompute/regionaladdress.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func (s *RegionalAddressesV1) Get(ctx context.Context, req *pb.GetAddressRequest

obj := &pb.Address{}
if err := s.storage.Get(ctx, fqn, obj); err != nil {
if status.Code(err) == codes.NotFound {
return nil, status.Errorf(codes.NotFound, "The resource '%s' was not found", fqn)
}
return nil, err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/regions/us-central1/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/regions/us-central1/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/regions/us-central1/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/regions/us-central1/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/${addressID}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/${addressID}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/${addressID}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/${addressID}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/regions/us-central1/addresses/computeraddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/regions/us-central1/addresses/computeraddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/regions/us-central1/addresses/computeraddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/regions/us-central1/addresses/computeraddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,11 +527,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/regions/us-central1/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/regions/us-central1/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/regions/us-central1/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/regions/us-central1/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down Expand Up @@ -797,11 +797,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress1-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress1-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress1-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress1-${uniqueId}' was not found"
}
}

Expand Down Expand Up @@ -361,11 +361,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress2-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress2-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress2-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress2-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress-${uniqueId}' was not found"
}
}

Expand Down Expand Up @@ -967,11 +967,11 @@ X-Xss-Protection: 0
"errors": [
{
"domain": "global",
"message": "address \"projects/${projectId}/global/addresses/computeaddress2-${uniqueId}\" not found",
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress2-${uniqueId}' was not found",
"reason": "notFound"
}
],
"message": "address \"projects/${projectId}/global/addresses/computeaddress2-${uniqueId}\" not found"
"message": "The resource 'projects/${projectId}/global/addresses/computeaddress2-${uniqueId}' was not found"
}
}

Expand Down
Loading

0 comments on commit 7411838

Please sign in to comment.