Skip to content

Commit

Permalink
Merge pull request #2656 from jingyih/mock_cloudbuildworkerpool
Browse files Browse the repository at this point in the history
mockgcp: improve cloud build worder pool
  • Loading branch information
google-oss-prow[bot] authored Sep 10, 2024
2 parents d58d87f + c468312 commit e78019c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions mockgcp/mockcloudbuild/workerpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func (s *CloudBuildV1) CreateWorkerPool(ctx context.Context, req *pb.CreateWorke
result.UpdateTime = now
result.State = pb.WorkerPool_RUNNING
result.Etag = fields.ComputeWeakEtag(result)
if err := s.storage.Update(ctx, fqn, result); err != nil { // update resource object when LRO is done
return nil, err
}
return result, nil
})
}
Expand Down Expand Up @@ -125,6 +128,9 @@ func (s *CloudBuildV1) UpdateWorkerPool(ctx context.Context, req *pb.UpdateWorke
result.UpdateTime = now
result.State = pb.WorkerPool_RUNNING
result.Etag = fields.ComputeWeakEtag(result)
if err := s.storage.Update(ctx, fqn, result); err != nil { // update resource object when LRO is done
return nil, err
}
return result, nil
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,9 @@ X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "New CloudBuild WorkerPool",
"etag": "abcdef0123A=",
"name": "projects/${projectId}/locations/us-central1/workerPools/cloudbuildworkerpool-${uniqueId}",
"privatePoolV1Config": {
"networkConfig": {
Expand All @@ -679,7 +681,9 @@ X-Xss-Protection: 0
"diskSizeGb": "100",
"machineType": "e2-medium"
}
}
},
"state": 2,
"updateTime": "2024-04-01T12:34:56.123456Z"
}

---
Expand All @@ -691,6 +695,7 @@ x-goog-request-params: location=us-central1

{
"displayName": "Updated CloudBuild WorkerPool",
"etag": "abcdef0123A=",
"name": "projects/${projectId}/locations/us-central1/workerPools/cloudbuildworkerpool-${uniqueId}",
"privatePoolV1Config": {
"networkConfig": {
Expand Down Expand Up @@ -755,6 +760,7 @@ X-Xss-Protection: 0
"name": "projects/${projectId}/locations/us-central1/workerPools/cloudbuildworkerpool-${uniqueId}/operations/${operationID}",
"response": {
"@type": "type.googleapis.com/google.devtools.cloudbuild.v1.WorkerPool",
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "New CloudBuild WorkerPool",
"etag": "abcdef0123A=",
"name": "projects/${projectId}/locations/us-central1/workerPools/cloudbuildworkerpool-${uniqueId}",
Expand Down Expand Up @@ -793,7 +799,9 @@ X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"createTime": "2024-04-01T12:34:56.123456Z",
"displayName": "New CloudBuild WorkerPool",
"etag": "abcdef0123A=",
"name": "projects/${projectId}/locations/us-central1/workerPools/cloudbuildworkerpool-${uniqueId}",
"privatePoolV1Config": {
"networkConfig": {
Expand All @@ -806,6 +814,7 @@ X-Xss-Protection: 0
"machineType": "e2-medium"
}
},
"state": 2,
"updateTime": "2024-04-01T12:34:56.123456Z"
}

Expand Down

0 comments on commit e78019c

Please sign in to comment.