Skip to content

Commit

Permalink
mockgcp tests: ignore content-length header
Browse files Browse the repository at this point in the history
  • Loading branch information
justinsb committed Feb 23, 2025
1 parent 991e813 commit e7eb077
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 42 deletions.
6 changes: 0 additions & 6 deletions mockgcp/mockcompute/testdata/address/crud/_http.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ POST https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 33
Content-Type: application/json

{
Expand Down Expand Up @@ -42,7 +41,6 @@ POST https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down Expand Up @@ -78,7 +76,6 @@ GET https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-c
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down Expand Up @@ -112,7 +109,6 @@ GET https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-c
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down Expand Up @@ -146,7 +142,6 @@ DELETE https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/u
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down Expand Up @@ -181,7 +176,6 @@ POST https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down
5 changes: 0 additions & 5 deletions mockgcp/mockfilestore/testdata/instance/crud/_http.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ POST https://file.googleapis.com/v1/projects/${projectId}/locations/us-central1-
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 151
Content-Type: application/json

{
Expand Down Expand Up @@ -49,7 +48,6 @@ GET https://file.googleapis.com/v1/projects/${projectId}/locations/us-central1-a
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down Expand Up @@ -104,7 +102,6 @@ GET https://file.googleapis.com/v1/projects/${projectId}/locations/us-central1-a
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down Expand Up @@ -146,7 +143,6 @@ DELETE https://file.googleapis.com/v1/projects/${projectId}/locations/us-central
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down Expand Up @@ -176,7 +172,6 @@ GET https://file.googleapis.com/v1/projects/${projectId}/locations/us-central1-a
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down
4 changes: 4 additions & 0 deletions mockgcp/mockgcptests/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ func TestScripts(t *testing.T) {
// gcloud includes a UUID in the user-agent, along with a lot of other client info (e.g. kernel version, python version)
// Just remove it from the golden output.
httpEvent.Request.RemoveHeader("user-agent")

// Remove the Content-Length header, as it changes with dynamic values
httpEvent.Request.RemoveHeader("Content-Length")
httpEvent.Response.RemoveHeader("Content-Length")
}

folderID := ""
Expand Down
7 changes: 0 additions & 7 deletions mockgcp/mockiam/testdata/role/crud/_http.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ POST https://iam.googleapis.com/v1/permissions:queryTestablePermissions?alt=json
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 101
Content-Type: application/json

{
Expand All @@ -28,7 +27,6 @@ POST https://iam.googleapis.com/v1/projects/${projectId}/roles?alt=json
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 165
Content-Type: application/json

{
Expand Down Expand Up @@ -70,7 +68,6 @@ GET https://iam.googleapis.com/v1/projects/${projectId}/roles/test_${uniqueId}?a
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -99,7 +96,6 @@ GET https://iam.googleapis.com/v1/projects/${projectId}/roles/test_${uniqueId}?a
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -128,7 +124,6 @@ POST https://iam.googleapis.com/v1/permissions:queryTestablePermissions?alt=json
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 101
Content-Type: application/json

{
Expand All @@ -154,7 +149,6 @@ PATCH https://iam.googleapis.com/v1/projects/${projectId}/roles/test_${uniqueId}
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 134
Content-Type: application/json

{
Expand Down Expand Up @@ -195,7 +189,6 @@ DELETE https://iam.googleapis.com/v1/projects/${projectId}/roles/test_${uniqueId
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down
6 changes: 0 additions & 6 deletions mockgcp/mockiam/testdata/serviceaccount/crud/_http.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ POST https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts?alt=jso
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 136
Content-Type: application/json

{
Expand Down Expand Up @@ -40,7 +39,6 @@ GET https://iam.googleapis.com/v1/projects/-/serviceAccounts/test-${uniqueId}@${
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -69,7 +67,6 @@ PATCH https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/test-$
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 87
Content-Type: application/json

{
Expand Down Expand Up @@ -100,7 +97,6 @@ PATCH https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/test-$
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 88
Content-Type: application/json

{
Expand Down Expand Up @@ -131,7 +127,6 @@ GET https://iam.googleapis.com/v1/projects/-/serviceAccounts/test-${uniqueId}@${
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -160,7 +155,6 @@ DELETE https://iam.googleapis.com/v1/projects/-/serviceAccounts/test-${uniqueId}
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down
3 changes: 0 additions & 3 deletions mockgcp/mockpubsub/testdata/topic/crud/_http.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ PUT https://pubsub.googleapis.com/v1/projects/${projectId}/topics/test-${uniqueI
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 62
Content-Type: application/json

{
Expand Down Expand Up @@ -30,7 +29,6 @@ GET https://pubsub.googleapis.com/v1/projects/${projectId}/topics/test-${uniqueI
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand All @@ -53,7 +51,6 @@ DELETE https://pubsub.googleapis.com/v1/projects/${projectId}/topics/test-${uniq
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private
Expand Down
3 changes: 0 additions & 3 deletions mockgcp/mockstorage/testdata/bucket/crud/_http.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ POST https://storage.googleapis.com/storage/v1/b?alt=json&enableObjectRetention=
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 33
Content-Type: application/json

{
Expand Down Expand Up @@ -51,7 +50,6 @@ GET https://storage.googleapis.com/storage/v1/b/test-${uniqueId}?alt=json&projec
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Cache-Control: private, max-age=0, must-revalidate, no-transform
Expand Down Expand Up @@ -94,7 +92,6 @@ DELETE https://storage.googleapis.com/storage/v1/b/test-${uniqueId}?alt=json
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

204 No Content
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Expand Down
12 changes: 0 additions & 12 deletions mockgcp/mockworkflows/testdata/workflow/crud/_http.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

404 Not Found
Content-Type: application/json; charset=UTF-8
Expand All @@ -28,7 +27,6 @@ POST https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-cent
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 235
Content-Type: application/json

{
Expand Down Expand Up @@ -62,7 +60,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -104,7 +101,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -133,7 +129,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -162,7 +157,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -191,7 +185,6 @@ PATCH https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-cen
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 235
Content-Type: application/json

{
Expand Down Expand Up @@ -225,7 +218,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -267,7 +259,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -296,7 +287,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -325,7 +315,6 @@ DELETE https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-ce
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down Expand Up @@ -354,7 +343,6 @@ GET https://workflows.googleapis.com/v1/projects/${projectId}/locations/us-centr
Accept: application/json
Authorization: (removed)
Connection: keep-alive
Content-Length: 0

200 OK
Content-Type: application/json; charset=UTF-8
Expand Down

0 comments on commit e7eb077

Please sign in to comment.