From e6a59ac4340ae12dc6422c47f086e7995433fb35 Mon Sep 17 00:00:00 2001 From: Gemma Hou Date: Mon, 18 Mar 2024 17:08:18 +0000 Subject: [PATCH] replay --- config/tests/samples/create/harness.go | 14 +- go.sum | 30 + ...AllInSeries_fixtures_computenodegroup.yaml | 844 ++++++++++++++++++ ...InSeries_fixtures_computenodetemplate.yaml | 161 ++-- tests/e2e/unified_test.go | 96 +- 5 files changed, 1001 insertions(+), 144 deletions(-) create mode 100644 pkg/test/resourcefixture/testdata/vcr/cassette/TestAllInSeries_fixtures_computenodegroup.yaml diff --git a/config/tests/samples/create/harness.go b/config/tests/samples/create/harness.go index 7d3d6419a5..5b51a731e0 100644 --- a/config/tests/samples/create/harness.go +++ b/config/tests/samples/create/harness.go @@ -24,8 +24,6 @@ import ( "testing" "time" - "gopkg.in/dnaeon/go-vcr.v3/recorder" - "github.com/go-logr/logr" transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" "golang.org/x/oauth2" @@ -333,6 +331,16 @@ func NewHarness(ctx context.Context, t *testing.T) *Harness { } if targetGCP := os.Getenv("E2E_GCP_TARGET"); targetGCP == "vcr" { + // Initialize VCR for TF requests + input := os.Getenv("VCR_MODE") + var vcrMode recorder.Mode + if input == "record" { + vcrMode = recorder.ModeRecordOnly + } else if input == "replay" { + vcrMode = recorder.ModeReplayOnly + } else { + t.Fatalf("[VCR] VCR_MODE should be set to record or replay; value %q is not known", input) + } transport_tpg.DefaultHTTPClientTransformer = func(ctx context.Context, inner *http.Client) *http.Client { ret := inner if t := ctx.Value(httpRoundTripperKey); t != nil { @@ -342,7 +350,7 @@ func NewHarness(ctx context.Context, t *testing.T) *Harness { testName := strings.ReplaceAll(t.Name(), "/", "_") opts := &recorder.Options{ CassetteName: filepath.Join(dir, testName), - Mode: recorder.ModeRecordOnly, + Mode: vcrMode, RealTransport: ret.Transport, } r, err := recorder.NewWithOptions(opts) diff --git a/go.sum b/go.sum index 6eb0518320..9edd425f0f 100644 --- a/go.sum +++ b/go.sum @@ -1473,17 +1473,21 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/dnaeon/go-vcr.v3 v3.2.0 h1:Rltp0Vf+Aq0u4rQXgmXgtgoRDStTnFN83cWgSGSoRzM= gopkg.in/dnaeon/go-vcr.v3 v3.2.0/go.mod h1:2IMOnnlx9I6u9x+YBsM3tAMx6AlOxnJ0pWxQAzZ79Ag= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.0.0-20171116090243-287cf08546ab/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= @@ -1495,10 +1499,12 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= @@ -1513,31 +1519,39 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 k8s.io/api v0.0.0-20190918155943-95b840bb6a1f/go.mod h1:uWuOHnjmNrtQomJrvEBg0c0HRNyQ+8KTEERVsK0PW48= k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= k8s.io/api v0.21.3/go.mod h1:hUgeYHUbBp23Ue4qdX9tR8/ANi/g3ehylAqDn9NWVOg= +k8s.io/api v0.27.11 h1:IsGrWbXt7RkE+arc9GLQPYI5AtZkT+feBMorY+Nzx4I= k8s.io/api v0.27.11/go.mod h1:SGqTcyqa0e+Db3pgyH6v+por5dO2OdTkKDCdD3Op3Ng= k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783/go.mod h1:xvae1SZB3E17UpV59AWc271W/Ph25N+bjPyR63X6tPY= k8s.io/apiextensions-apiserver v0.21.3/go.mod h1:kl6dap3Gd45+21Jnh6utCx8Z2xxLm8LGDkprcd+KbsE= +k8s.io/apiextensions-apiserver v0.27.9 h1:z7f95DVIrNkscuV2f/JdZNpjOxpUYeeRYcmrn0Wixas= k8s.io/apiextensions-apiserver v0.27.9/go.mod h1:0/FD0h+vIInWSBUFv3sFgAkU5Zfd74Mwz0dOHWxr7/k= k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655/go.mod h1:nL6pwRT8NgfF8TT68DBI8uEePRt89cSvoXUVqbkWHq4= k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.21.3/go.mod h1:H/IM+5vH9kZRNJ4l3x/fXP/5bOPJaVP/guptnZPeCFI= +k8s.io/apimachinery v0.27.11 h1:ivrKMN7JgdtKhay14S5UQlvilV3z6W+wjiSQTzyr5zc= k8s.io/apimachinery v0.27.11/go.mod h1:IHu2ovJ60RqxyPSLmTel7KDLdOCRbpOxwtUBmwBnT/E= k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad/go.mod h1:XPCXEwhjaFN29a8NldXA901ElnKeKLrLtREO9ZhFyhg= k8s.io/apiserver v0.21.3/go.mod h1:eDPWlZG6/cCCMj/JBcEpDoK+I+6i3r9GsChYBHSbAzU= +k8s.io/cli-runtime v0.26.3 h1:3ULe0oI28xmgeLMVXIstB+ZL5CTGvWSMVMLeHxitIuc= k8s.io/cli-runtime v0.26.3/go.mod h1:5YEhXLV4kLt/OSy9yQwtSSNZU2Z7aTEYta1A+Jg4VC4= k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90/go.mod h1:J69/JveO6XESwVgG53q3Uz5OSfgsv4uxpScmmyYOOlk= k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= k8s.io/client-go v0.21.3/go.mod h1:+VPhCgTsaFmGILxR/7E1N0S+ryO010QBeNCv5JwRGYU= +k8s.io/client-go v0.27.11 h1:SZChXsDaN6lB5IYywCpvQs/ZUa5vK2NHkpEwUhoK3fQ= k8s.io/client-go v0.27.11/go.mod h1:Rg3Yeuk9sX87gpVunVn3AsvMkGZfXuutTDC/jigBNUo= k8s.io/code-generator v0.0.0-20190912054826-cd179ad6a269/go.mod h1:V5BD6M4CyaN5m+VthcclXWsVcT1Hu+glwa1bi3MIsyE= k8s.io/code-generator v0.21.3/go.mod h1:K3y0Bv9Cz2cOW2vXUrNZlFbflhuPvuadW6JdnN6gGKo= +k8s.io/code-generator v0.27.9 h1:lm1+gQLzA4ElK8FtItUbFG1PpZ+Us1fSfn9RlRsy1ko= k8s.io/code-generator v0.27.9/go.mod h1:NEx95JBRos8MSki+CuSoiEyKk6yv1rC4z/eY8DCZ/Rw= k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090/go.mod h1:933PBGtQFJky3TEwYx4aEPZ4IxqhWh3R6DCmzqIn1hA= k8s.io/component-base v0.21.3/go.mod h1:kkuhtfEHeZM6LkX0saqSK8PbdO7A0HigUngmhhrwfGQ= +k8s.io/component-base v0.27.9 h1:2WGfRevgs/06+lVnXZCcLEf1XE7Cdts96zRdvkQjl8k= k8s.io/component-base v0.27.9/go.mod h1:XGpxAlwW8CdfTCogVqmHPu6ZSGlGEMsvpOcWSveWRzY= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08= k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= @@ -1546,41 +1560,57 @@ k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= +k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= +k8s.io/kubectl v0.26.3 h1:bZ5SgFyeEXw6XTc1Qji0iNdtqAC76lmeIIQULg2wNXM= k8s.io/kubectl v0.26.3/go.mod h1:02+gv7Qn4dupzN3fi/9OvqqdW+uG/4Zi56vc4Zmsp1g= k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU= k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= +rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.19/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns= +sigs.k8s.io/controller-runtime v0.15.2 h1:9V7b7SDQSJ08IIsJ6CY1CE85Okhp87dyTMNDG0FS7f4= sigs.k8s.io/controller-runtime v0.15.2/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= +sigs.k8s.io/controller-tools v0.6.2 h1:+Y8L0UsAugDipGRw8lrkPoAi6XqlQVZuf1DQHME3PgU= sigs.k8s.io/controller-tools v0.6.2/go.mod h1:oaeGpjXn6+ZSEIQkUe/+3I40PNiDYp9aeawbt3xTgJ8= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/kubebuilder-declarative-pattern v0.15.0-beta.2 h1:g6VgSNpmrGDeHqw2/CRYrzYRRFE/5UCODIQJu64TBww= sigs.k8s.io/kubebuilder-declarative-pattern v0.15.0-beta.2/go.mod h1:k0BHn+hXWDhdSfNTCVLABTF/xzdmvPRkcL1KKeTMqqg= +sigs.k8s.io/kubebuilder-declarative-pattern/applylib v0.0.0-20230420203711-4abaa68e1923 h1:5xT48TQEgFjPIehWDhGU76IHEe7aA8+m+3YfrSqbi+I= sigs.k8s.io/kubebuilder-declarative-pattern/applylib v0.0.0-20230420203711-4abaa68e1923/go.mod h1:tVK41IKmejKA0fzCtV4VOXvbaGrzIadep/i1WKas99A= +sigs.k8s.io/kubebuilder-declarative-pattern/mockkubeapiserver v0.0.0-20230303024857-d1f76c15e05b h1:VcgyLj8SawHulvC24SRgI37mnhMmR3hW+ZVqZGBmkbc= sigs.k8s.io/kubebuilder-declarative-pattern/mockkubeapiserver v0.0.0-20230303024857-d1f76c15e05b/go.mod h1:smCBkOX4Z3K9+MUGAscbschHAYgbuRZ+Pri49+x2zTc= +sigs.k8s.io/kustomize/api v0.12.1 h1:7YM7gW3kYBwtKvoY216ZzY+8hM+lV53LUayghNRJ0vM= sigs.k8s.io/kustomize/api v0.12.1/go.mod h1:y3JUhimkZkR6sbLNwfJHxvo1TCLwuwm14sCYnkH6S1s= +sigs.k8s.io/kustomize/kstatus v0.0.2-0.20200509233124-065f70705d4d h1:k+m3LgwVsvSDvcUWoaG2yUGcyN/HKR6Dq2lb0FYgbq8= sigs.k8s.io/kustomize/kstatus v0.0.2-0.20200509233124-065f70705d4d/go.mod h1:6qUKWLy4+yGExtjbs+fibz2tOBZG7413yx2NHyAzIU0= +sigs.k8s.io/kustomize/kyaml v0.13.9 h1:Qz53EAaFFANyNgyOEJbT/yoIHygK40/ZcvU3rgry2Tk= sigs.k8s.io/kustomize/kyaml v0.13.9/go.mod h1:QsRbD0/KcU+wdk0/L0fIp2KLnohkVzs6fQ85/nOXac4= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/structured-merge-diff v0.0.0-20190817042607-6149e4549fca/go.mod h1:IIgPezJWb76P0hotTxzDbWsMYB8APh18qZnxkomBpxA= sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= sigs.k8s.io/testing_frameworks v0.1.2/go.mod h1:ToQrwSC3s8Xf/lADdZp3Mktcql9CG0UAmdJG9th5i0w= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/pkg/test/resourcefixture/testdata/vcr/cassette/TestAllInSeries_fixtures_computenodegroup.yaml b/pkg/test/resourcefixture/testdata/vcr/cassette/TestAllInSeries_fixtures_computenodegroup.yaml new file mode 100644 index 0000000000..a23217710f --- /dev/null +++ b/pkg/test/resourcefixture/testdata/vcr/cassette/TestAllInSeries_fixtures_computenodegroup.yaml @@ -0,0 +1,844 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 248 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: | + {"cpuOvercommitType":"NONE","name":"computenodetemplate-bopydlzuxy26","nodeAffinityLabels":{"cnrm-test":"true","managed-by-cnrm":"true"},"nodeTypeFlexibility":{"cpus":"any","memory":"any"},"region":"projects/example-project/global/regions/us-central1"} + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates?alt=json + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#operation", + "id": "4843562213390748277", + "name": "operation-1711584409839-614ad4cc06925-af0e9382-1dca5523", + "operationType": "compute.nodeTemplates.insert", + "targetLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "targetId": "6096640396835228277", + "status": "RUNNING", + "user": "user@google.com", + "progress": 0, + "insertTime": "2024-03-27T17:06:50.106-07:00", + "startTime": "2024-03-27T17:06:50.142-07:00", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584409839-614ad4cc06925-af0e9382-1dca5523", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 415.843583ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + X-Goog-Api-Client: + - gl-go/1.21.5 gdcl/0.160.0 + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584409839-614ad4cc06925-af0e9382-1dca5523?alt=json&prettyPrint=false + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"kind":"compute#operation","id":"4843562213390748277","name":"operation-1711584409839-614ad4cc06925-af0e9382-1dca5523","operationType":"compute.nodeTemplates.insert","targetLink":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26","targetId":"6096640396835228277","status":"DONE","user":"user@google.com","progress":100,"insertTime":"2024-03-27T17:06:50.106-07:00","startTime":"2024-03-27T17:06:50.142-07:00","endTime":"2024-03-27T17:06:50.450-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584409839-614ad4cc06925-af0e9382-1dca5523","region":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1"}' + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 139.343885ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26?alt=json + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#nodeTemplate", + "id": "6096640396835228277", + "creationTimestamp": "2024-03-27T17:06:50.116-07:00", + "name": "computenodetemplate-bopydlzuxy26", + "nodeAffinityLabels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "status": "READY", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "nodeTypeFlexibility": { + "cpus": "any", + "memory": "any" + }, + "serverBinding": { + "type": "RESTART_NODE_ON_ANY_SERVER" + }, + "cpuOvercommitType": "NONE" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 139.403305ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26?alt=json + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#nodeTemplate", + "id": "6096640396835228277", + "creationTimestamp": "2024-03-27T17:06:50.116-07:00", + "name": "computenodetemplate-bopydlzuxy26", + "nodeAffinityLabels": { + "managed-by-cnrm": "true", + "cnrm-test": "true" + }, + "status": "READY", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "nodeTypeFlexibility": { + "cpus": "any", + "memory": "any" + }, + "serverBinding": { + "type": "RESTART_NODE_ON_ANY_SERVER" + }, + "cpuOvercommitType": "NONE" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 291.399689ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 309 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: | + {"description":"A single sole-tenant node in the us-central1-b zone.","maintenancePolicy":"DEFAULT","name":"computenodegroup-bopydlzuxy26","nodeTemplate":"projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26","size":1,"zone":"projects/example-project/global/zones/us-central1-b"} + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups?alt=json&initialNodeCount=1 + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#operation", + "id": "4564027878998084212", + "name": "operation-1711584411558-614ad4cdaa114-1320eae2-89aab2bd", + "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b", + "operationType": "compute.nodeGroups.insert", + "targetLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26", + "targetId": "6032112866626164", + "status": "RUNNING", + "user": "user@google.com", + "progress": 0, + "insertTime": "2024-03-27T17:06:51.906-07:00", + "startTime": "2024-03-27T17:06:51.969-07:00", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584411558-614ad4cdaa114-1320eae2-89aab2bd" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 567.820777ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + X-Goog-Api-Client: + - gl-go/1.21.5 gdcl/0.160.0 + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584411558-614ad4cdaa114-1320eae2-89aab2bd?alt=json&prettyPrint=false + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"kind":"compute#operation","id":"4564027878998084212","name":"operation-1711584411558-614ad4cdaa114-1320eae2-89aab2bd","zone":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b","operationType":"compute.nodeGroups.insert","targetLink":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26","targetId":"6032112866626164","status":"RUNNING","user":"user@google.com","progress":0,"insertTime":"2024-03-27T17:06:51.906-07:00","startTime":"2024-03-27T17:06:51.969-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584411558-614ad4cdaa114-1320eae2-89aab2bd"}' + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 287.896767ms + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + X-Goog-Api-Client: + - gl-go/1.21.5 gdcl/0.160.0 + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584411558-614ad4cdaa114-1320eae2-89aab2bd?alt=json&prettyPrint=false + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"kind":"compute#operation","id":"4564027878998084212","name":"operation-1711584411558-614ad4cdaa114-1320eae2-89aab2bd","zone":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b","operationType":"compute.nodeGroups.insert","targetLink":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26","targetId":"6032112866626164","status":"DONE","user":"user@google.com","progress":100,"insertTime":"2024-03-27T17:06:51.906-07:00","startTime":"2024-03-27T17:06:51.969-07:00","endTime":"2024-03-27T17:07:00.018-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584411558-614ad4cdaa114-1320eae2-89aab2bd"}' + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 144.386276ms + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26?alt=json + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#nodeGroup", + "id": "6032112866626164", + "creationTimestamp": "2024-03-27T17:06:51.916-07:00", + "name": "computenodegroup-bopydlzuxy26", + "description": "A single sole-tenant node in the us-central1-b zone.", + "nodeTemplate": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26", + "status": "READY", + "size": 1, + "autoscalingPolicy": { + "mode": "OFF", + "minNodes": 0 + }, + "maintenancePolicy": "DEFAULT", + "fingerprint": "i80_NJrsYPc=", + "shareSettings": { + "shareType": "LOCAL" + }, + "maintenanceInterval": "AS_NEEDED" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 156.350135ms + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26?alt=json + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#nodeGroup", + "id": "6032112866626164", + "creationTimestamp": "2024-03-27T17:06:51.916-07:00", + "name": "computenodegroup-bopydlzuxy26", + "description": "A single sole-tenant node in the us-central1-b zone.", + "nodeTemplate": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26", + "status": "READY", + "size": 1, + "autoscalingPolicy": { + "mode": "OFF", + "minNodes": 0 + }, + "maintenancePolicy": "DEFAULT", + "fingerprint": "i80_NJrsYPc=", + "shareSettings": { + "shareType": "LOCAL" + }, + "maintenanceInterval": "AS_NEEDED" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 244.13485ms + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26?alt=json + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#nodeTemplate", + "id": "6096640396835228277", + "creationTimestamp": "2024-03-27T17:06:50.116-07:00", + "name": "computenodetemplate-bopydlzuxy26", + "nodeAffinityLabels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "status": "READY", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "nodeTypeFlexibility": { + "cpus": "any", + "memory": "any" + }, + "serverBinding": { + "type": "RESTART_NODE_ON_ANY_SERVER" + }, + "cpuOvercommitType": "NONE" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 105.216237ms + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26?alt=json + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#nodeGroup", + "id": "6032112866626164", + "creationTimestamp": "2024-03-27T17:06:51.916-07:00", + "name": "computenodegroup-bopydlzuxy26", + "description": "A single sole-tenant node in the us-central1-b zone.", + "nodeTemplate": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26", + "status": "READY", + "size": 1, + "autoscalingPolicy": { + "mode": "OFF", + "minNodes": 0 + }, + "maintenancePolicy": "DEFAULT", + "fingerprint": "i80_NJrsYPc=", + "shareSettings": { + "shareType": "LOCAL" + }, + "maintenanceInterval": "AS_NEEDED" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 191.09825ms + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26?alt=json + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#operation", + "id": "3274958505268283974", + "name": "operation-1711584425280-614ad4dac022e-6bb8abfb-5209c090", + "zone": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b", + "operationType": "compute.nodeGroups.delete", + "targetLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26", + "targetId": "6032112866626164", + "status": "RUNNING", + "user": "user@google.com", + "progress": 0, + "insertTime": "2024-03-27T17:07:05.499-07:00", + "startTime": "2024-03-27T17:07:05.522-07:00", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584425280-614ad4dac022e-6bb8abfb-5209c090" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 519.590711ms + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + X-Goog-Api-Client: + - gl-go/1.21.5 gdcl/0.160.0 + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584425280-614ad4dac022e-6bb8abfb-5209c090?alt=json&prettyPrint=false + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"kind":"compute#operation","id":"3274958505268283974","name":"operation-1711584425280-614ad4dac022e-6bb8abfb-5209c090","zone":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b","operationType":"compute.nodeGroups.delete","targetLink":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26","targetId":"6032112866626164","status":"RUNNING","user":"user@google.com","progress":0,"insertTime":"2024-03-27T17:07:05.499-07:00","startTime":"2024-03-27T17:07:05.522-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584425280-614ad4dac022e-6bb8abfb-5209c090"}' + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 200.761686ms + - id: 13 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26?alt=json + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#nodeTemplate", + "id": "6096640396835228277", + "creationTimestamp": "2024-03-27T17:06:50.116-07:00", + "name": "computenodetemplate-bopydlzuxy26", + "nodeAffinityLabels": { + "managed-by-cnrm": "true", + "cnrm-test": "true" + }, + "status": "READY", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "nodeTypeFlexibility": { + "cpus": "any", + "memory": "any" + }, + "serverBinding": { + "type": "RESTART_NODE_ON_ANY_SERVER" + }, + "cpuOvercommitType": "NONE" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 107.133148ms + - id: 14 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26?alt=json + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#nodeTemplate", + "id": "6096640396835228277", + "creationTimestamp": "2024-03-27T17:06:50.116-07:00", + "name": "computenodetemplate-bopydlzuxy26", + "nodeAffinityLabels": { + "managed-by-cnrm": "true", + "cnrm-test": "true" + }, + "status": "READY", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "nodeTypeFlexibility": { + "cpus": "any", + "memory": "any" + }, + "serverBinding": { + "type": "RESTART_NODE_ON_ANY_SERVER" + }, + "cpuOvercommitType": "NONE" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 123.095189ms + - id: 15 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26?alt=json + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: | + { + "kind": "compute#operation", + "id": "1242290117753244251", + "name": "operation-1711584435801-614ad4e4c8d47-b1a00223-89f5ff7e", + "operationType": "compute.nodeTemplates.delete", + "targetLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26", + "targetId": "6096640396835228277", + "status": "RUNNING", + "user": "user@google.com", + "progress": 0, + "insertTime": "2024-03-27T17:07:16.021-07:00", + "startTime": "2024-03-27T17:07:16.060-07:00", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584435801-614ad4e4c8d47-b1a00223-89f5ff7e", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1" + } + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 358.478957ms + - id: 16 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + X-Goog-Api-Client: + - gl-go/1.21.5 gdcl/0.160.0 + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584435801-614ad4e4c8d47-b1a00223-89f5ff7e?alt=json&prettyPrint=false + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"kind":"compute#operation","id":"1242290117753244251","name":"operation-1711584435801-614ad4e4c8d47-b1a00223-89f5ff7e","operationType":"compute.nodeTemplates.delete","targetLink":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-bopydlzuxy26","targetId":"6096640396835228277","status":"DONE","user":"user@google.com","progress":100,"insertTime":"2024-03-27T17:07:16.021-07:00","startTime":"2024-03-27T17:07:16.060-07:00","endTime":"2024-03-27T17:07:16.558-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584435801-614ad4e4c8d47-b1a00223-89f5ff7e","region":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1"}' + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 149.154987ms + - id: 17 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: compute.googleapis.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + X-Goog-Api-Client: + - gl-go/1.21.5 gdcl/0.160.0 + url: https://compute.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584425280-614ad4dac022e-6bb8abfb-5209c090?alt=json&prettyPrint=false + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"kind":"compute#operation","id":"3274958505268283974","name":"operation-1711584425280-614ad4dac022e-6bb8abfb-5209c090","zone":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b","operationType":"compute.nodeGroups.delete","targetLink":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/nodeGroups/computenodegroup-bopydlzuxy26","targetId":"6032112866626164","status":"DONE","user":"user@google.com","progress":100,"insertTime":"2024-03-27T17:07:05.499-07:00","startTime":"2024-03-27T17:07:05.522-07:00","endTime":"2024-03-27T17:07:09.720-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/example-project/zones/us-central1-b/operations/operation-1711584425280-614ad4dac022e-6bb8abfb-5209c090"}' + headers: + Content-Type: + - application/json; charset=UTF-8 + status: 200 OK + code: 200 + duration: 159.007954ms diff --git a/pkg/test/resourcefixture/testdata/vcr/cassette/TestAllInSeries_fixtures_computenodetemplate.yaml b/pkg/test/resourcefixture/testdata/vcr/cassette/TestAllInSeries_fixtures_computenodetemplate.yaml index bf1c62a6c0..b5ce97984b 100644 --- a/pkg/test/resourcefixture/testdata/vcr/cassette/TestAllInSeries_fixtures_computenodetemplate.yaml +++ b/pkg/test/resourcefixture/testdata/vcr/cassette/TestAllInSeries_fixtures_computenodetemplate.yaml @@ -20,66 +20,19 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 0 + content_length: 409 transfer_encoding: [] trailer: {} host: compute.googleapis.com remote_addr: "" request_uri: "" - body: "" - form: {} - headers: - Content-Type: - - application/json - url: https://compute.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111?alt=json - method: GET - response: - proto: HTTP/2.0 - proto_major: 2 - proto_minor: 0 - transfer_encoding: [] - trailer: {} - content_length: -1 - uncompressed: true body: | - { - "error": { - "code": 404, - "message": "The resource 'projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111' was not found", - "errors": [ - { - "message": "The resource 'projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111' was not found", - "domain": "global", - "reason": "notFound", - "debugInfo": "fake debug info" - } - ] - } - } - headers: - Content-Type: - - application/json; charset=UTF-8 - status: 404 Not Found - code: 404 - duration: 217.52251ms - - id: 1 - request: - proto: HTTP/1.1 - proto_major: 1 - proto_minor: 1 - content_length: 417 - transfer_encoding: [] - trailer: {} - host: compute.googleapis.com - remote_addr: "" - request_uri: "" - body: | - {"cpuOvercommitType":"NONE","description":"Node template for sole tenant nodes running in us-central1, with 96vCPUs and any amount of memory on any machine type.","name":"computenodetemplate-uniqueid111111","nodeAffinityLabels":{"cnrm-test":"true","managed-by-cnrm":"true","memory_guarantee":"false"},"nodeTypeFlexibility":{"cpus":"96","memory":"any"},"region":"projects/cnrm-user/global/regions/us-central1"} + {"cpuOvercommitType":"NONE","description":"Node template for sole tenant nodes running in us-central1, with 96vCPUs and any amount of memory on any machine type.","name":"computenodetemplate-2avqvi66hp2d","nodeAffinityLabels":{"cnrm-test":"true","managed-by-cnrm":"true","memory_guarantee":"false"},"nodeTypeFlexibility":{"cpus":"96","memory":"any"},"region":"projects/example-project/global/regions/us-central1"} form: {} headers: Content-Type: - application/json - url: https://compute.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates?alt=json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates?alt=json method: POST response: proto: HTTP/2.0 @@ -92,26 +45,26 @@ interactions: body: | { "kind": "compute#operation", - "id": "1302384153447785103", - "name": "operation-1710742623772-613e94e645e42-0e46b5eb-36d6a6e7", + "id": "8384382365164177958", + "name": "operation-1711584457349-614ad4f95580f-7d92979e-c0c0deef", "operationType": "compute.nodeTemplates.insert", - "targetLink": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111", - "targetId": "1885163588622639759", + "targetLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d", + "targetId": "1988438877528459814", "status": "RUNNING", "user": "user@google.com", "progress": 0, - "insertTime": "2024-03-17T23:17:04.077-07:00", - "startTime": "2024-03-17T23:17:04.115-07:00", - "selfLink": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/operations/operation-1710742623772-613e94e645e42-0e46b5eb-36d6a6e7", - "region": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1" + "insertTime": "2024-03-27T17:07:37.672-07:00", + "startTime": "2024-03-27T17:07:37.712-07:00", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584457349-614ad4f95580f-7d92979e-c0c0deef", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1" } headers: Content-Type: - application/json; charset=UTF-8 status: 200 OK code: 200 - duration: 474.632907ms - - id: 2 + duration: 503.333228ms + - id: 1 request: proto: HTTP/1.1 proto_major: 1 @@ -127,7 +80,7 @@ interactions: headers: X-Goog-Api-Client: - gl-go/1.21.5 gdcl/0.160.0 - url: https://compute.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/operations/operation-1710742623772-613e94e645e42-0e46b5eb-36d6a6e7?alt=json&prettyPrint=false + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584457349-614ad4f95580f-7d92979e-c0c0deef?alt=json&prettyPrint=false method: GET response: proto: HTTP/2.0 @@ -137,14 +90,14 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"kind":"compute#operation","id":"1302384153447785103","name":"operation-1710742623772-613e94e645e42-0e46b5eb-36d6a6e7","operationType":"compute.nodeTemplates.insert","targetLink":"https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111","targetId":"1885163588622639759","status":"DONE","user":"user@google.com","progress":100,"insertTime":"2024-03-17T23:17:04.077-07:00","startTime":"2024-03-17T23:17:04.115-07:00","endTime":"2024-03-17T23:17:04.425-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/operations/operation-1710742623772-613e94e645e42-0e46b5eb-36d6a6e7","region":"https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1"}' + body: '{"kind":"compute#operation","id":"8384382365164177958","name":"operation-1711584457349-614ad4f95580f-7d92979e-c0c0deef","operationType":"compute.nodeTemplates.insert","targetLink":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d","targetId":"1988438877528459814","status":"DONE","user":"user@google.com","progress":100,"insertTime":"2024-03-27T17:07:37.672-07:00","startTime":"2024-03-27T17:07:37.712-07:00","endTime":"2024-03-27T17:07:38.077-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584457349-614ad4f95580f-7d92979e-c0c0deef","region":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1"}' headers: Content-Type: - application/json; charset=UTF-8 status: 200 OK code: 200 - duration: 154.077924ms - - id: 3 + duration: 132.964901ms + - id: 2 request: proto: HTTP/1.1 proto_major: 1 @@ -160,7 +113,7 @@ interactions: headers: Content-Type: - application/json - url: https://compute.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111?alt=json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d?alt=json method: GET response: proto: HTTP/2.0 @@ -173,9 +126,9 @@ interactions: body: | { "kind": "compute#nodeTemplate", - "id": "1885163588622639759", - "creationTimestamp": "2024-03-17T23:17:04.087-07:00", - "name": "computenodetemplate-uniqueid111111", + "id": "1988438877528459814", + "creationTimestamp": "2024-03-27T17:07:37.683-07:00", + "name": "computenodetemplate-2avqvi66hp2d", "description": "Node template for sole tenant nodes running in us-central1, with 96vCPUs and any amount of memory on any machine type.", "nodeAffinityLabels": { "memory_guarantee": "false", @@ -183,8 +136,8 @@ interactions: "cnrm-test": "true" }, "status": "READY", - "region": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1", - "selfLink": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d", "nodeTypeFlexibility": { "cpus": "96", "memory": "any" @@ -199,8 +152,8 @@ interactions: - application/json; charset=UTF-8 status: 200 OK code: 200 - duration: 250.057884ms - - id: 4 + duration: 110.104866ms + - id: 3 request: proto: HTTP/1.1 proto_major: 1 @@ -216,7 +169,7 @@ interactions: headers: Content-Type: - application/json - url: https://compute.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111?alt=json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d?alt=json method: GET response: proto: HTTP/2.0 @@ -229,9 +182,9 @@ interactions: body: | { "kind": "compute#nodeTemplate", - "id": "1885163588622639759", - "creationTimestamp": "2024-03-17T23:17:04.087-07:00", - "name": "computenodetemplate-uniqueid111111", + "id": "1988438877528459814", + "creationTimestamp": "2024-03-27T17:07:37.683-07:00", + "name": "computenodetemplate-2avqvi66hp2d", "description": "Node template for sole tenant nodes running in us-central1, with 96vCPUs and any amount of memory on any machine type.", "nodeAffinityLabels": { "cnrm-test": "true", @@ -239,8 +192,8 @@ interactions: "memory_guarantee": "false" }, "status": "READY", - "region": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1", - "selfLink": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d", "nodeTypeFlexibility": { "cpus": "96", "memory": "any" @@ -255,8 +208,8 @@ interactions: - application/json; charset=UTF-8 status: 200 OK code: 200 - duration: 108.804931ms - - id: 5 + duration: 137.374944ms + - id: 4 request: proto: HTTP/1.1 proto_major: 1 @@ -272,7 +225,7 @@ interactions: headers: Content-Type: - application/json - url: https://compute.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111?alt=json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d?alt=json method: GET response: proto: HTTP/2.0 @@ -285,18 +238,18 @@ interactions: body: | { "kind": "compute#nodeTemplate", - "id": "1885163588622639759", - "creationTimestamp": "2024-03-17T23:17:04.087-07:00", - "name": "computenodetemplate-uniqueid111111", + "id": "1988438877528459814", + "creationTimestamp": "2024-03-27T17:07:37.683-07:00", + "name": "computenodetemplate-2avqvi66hp2d", "description": "Node template for sole tenant nodes running in us-central1, with 96vCPUs and any amount of memory on any machine type.", "nodeAffinityLabels": { "cnrm-test": "true", - "managed-by-cnrm": "true", - "memory_guarantee": "false" + "memory_guarantee": "false", + "managed-by-cnrm": "true" }, "status": "READY", - "region": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1", - "selfLink": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d", "nodeTypeFlexibility": { "cpus": "96", "memory": "any" @@ -311,8 +264,8 @@ interactions: - application/json; charset=UTF-8 status: 200 OK code: 200 - duration: 172.9582ms - - id: 6 + duration: 157.804199ms + - id: 5 request: proto: HTTP/1.1 proto_major: 1 @@ -328,7 +281,7 @@ interactions: headers: Content-Type: - application/json - url: https://compute.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111?alt=json + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d?alt=json method: DELETE response: proto: HTTP/2.0 @@ -341,26 +294,26 @@ interactions: body: | { "kind": "compute#operation", - "id": "1935185951732687501", - "name": "operation-1710742626712-613e94e9139de-33ed3c19-1121ea67", + "id": "1811968627070011939", + "name": "operation-1711584460266-614ad4fc1dd26-f04486e1-6b047212", "operationType": "compute.nodeTemplates.delete", - "targetLink": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111", - "targetId": "1885163588622639759", + "targetLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d", + "targetId": "1988438877528459814", "status": "RUNNING", "user": "user@google.com", "progress": 0, - "insertTime": "2024-03-17T23:17:06.938-07:00", - "startTime": "2024-03-17T23:17:06.965-07:00", - "selfLink": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/operations/operation-1710742626712-613e94e9139de-33ed3c19-1121ea67", - "region": "https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1" + "insertTime": "2024-03-27T17:07:40.494-07:00", + "startTime": "2024-03-27T17:07:40.514-07:00", + "selfLink": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584460266-614ad4fc1dd26-f04486e1-6b047212", + "region": "https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1" } headers: Content-Type: - application/json; charset=UTF-8 status: 200 OK code: 200 - duration: 363.349932ms - - id: 7 + duration: 344.070566ms + - id: 6 request: proto: HTTP/1.1 proto_major: 1 @@ -376,7 +329,7 @@ interactions: headers: X-Goog-Api-Client: - gl-go/1.21.5 gdcl/0.160.0 - url: https://compute.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/operations/operation-1710742626712-613e94e9139de-33ed3c19-1121ea67?alt=json&prettyPrint=false + url: https://compute.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584460266-614ad4fc1dd26-f04486e1-6b047212?alt=json&prettyPrint=false method: GET response: proto: HTTP/2.0 @@ -386,10 +339,10 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"kind":"compute#operation","id":"1935185951732687501","name":"operation-1710742626712-613e94e9139de-33ed3c19-1121ea67","operationType":"compute.nodeTemplates.delete","targetLink":"https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/nodeTemplates/computenodetemplate-uniqueid111111","targetId":"1885163588622639759","status":"DONE","user":"user@google.com","progress":100,"insertTime":"2024-03-17T23:17:06.938-07:00","startTime":"2024-03-17T23:17:06.965-07:00","endTime":"2024-03-17T23:17:07.308-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1/operations/operation-1710742626712-613e94e9139de-33ed3c19-1121ea67","region":"https://www.googleapis.com/compute/beta/projects/cnrm-user/regions/us-central1"}' + body: '{"kind":"compute#operation","id":"1811968627070011939","name":"operation-1711584460266-614ad4fc1dd26-f04486e1-6b047212","operationType":"compute.nodeTemplates.delete","targetLink":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/nodeTemplates/computenodetemplate-2avqvi66hp2d","targetId":"1988438877528459814","status":"DONE","user":"user@google.com","progress":100,"insertTime":"2024-03-27T17:07:40.494-07:00","startTime":"2024-03-27T17:07:40.514-07:00","endTime":"2024-03-27T17:07:40.822-07:00","selfLink":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1/operations/operation-1711584460266-614ad4fc1dd26-f04486e1-6b047212","region":"https://www.googleapis.com/compute/beta/projects/example-project/regions/us-central1"}' headers: Content-Type: - application/json; charset=UTF-8 status: 200 OK code: 200 - duration: 171.223683ms + duration: 149.299712ms diff --git a/tests/e2e/unified_test.go b/tests/e2e/unified_test.go index d7100691bd..7e2af24fff 100644 --- a/tests/e2e/unified_test.go +++ b/tests/e2e/unified_test.go @@ -19,24 +19,24 @@ import ( "context" "encoding/json" "fmt" + testvariable "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/resourcefixture/variable" + "hash/fnv" "io" "io/ioutil" "net/http" "net/url" "os" "path/filepath" + "strconv" "strings" "testing" - "k8s.io/klog/v2" - "github.com/GoogleCloudPlatform/k8s-config-connector/config/tests/samples/create" opcorev1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/operator/pkg/apis/core/v1beta1" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test" testcontroller "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/controller" testgcp "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/gcp" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/resourcefixture" - testvariable "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/resourcefixture/variable" testyaml "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/yaml" "gopkg.in/dnaeon/go-vcr.v3/cassette" @@ -163,6 +163,12 @@ func testFixturesInSeries(ctx context.Context, t *testing.T, testPause bool, can } if os.Getenv("E2E_GCP_TARGET") == "vcr" { + hash := func(s string) uint64 { + h := fnv.New64a() + h.Write([]byte(s)) + return h.Sum64() + } + uniqueID = strconv.FormatUint(hash(t.Name()), 36) // Stop recording after tests finish and write to cassette t.Cleanup(func() { err := h.VCRRecorder.Stop() @@ -171,13 +177,42 @@ func testFixturesInSeries(ctx context.Context, t *testing.T, testPause bool, can } }) - replaceFunc := func(s string) string { - result := strings.Replace(s, uniqueID, "uniqueid111111", -1) - result = strings.Replace(result, project.ProjectID, "cnrm-user", -1) + replaceWellKnownValues := func(s string) string { + // Replace project id + result := strings.Replace(s, project.ProjectID, "example-project", -1) + + // Replace user info + obj := make(map[string]any) + if err := json.Unmarshal([]byte(s), &obj); err == nil { + toReplace, _, _ := unstructured.NestedString(obj, "user") + if len(toReplace) != 0 { + result = strings.Replace(result, toReplace, "user@google.com", -1) + } + } return result } + unique := make(map[string]bool) + hook := func(i *cassette.Interaction) error { + // Discard failed interactions + resCode := i.Response.Code + if resCode == 404 || resCode == 400 || resCode == 403 { + i.DiscardOnSave = true + } + // Discard repeated operation retry interactions + reqURL := i.Request.URL + resBody := i.Response.Body + + if strings.Contains(reqURL, "operations") { + sorted, _ := sortJSON(resBody) + if _, exists := unique[sorted]; !exists { + unique[sorted] = true // Mark as seen + } else { + i.DiscardOnSave = true + } + } + var requestHeadersToRemove = []string{ "Authorization", "User-Agent", @@ -200,36 +235,10 @@ func testFixturesInSeries(ctx context.Context, t *testing.T, testPause bool, can delete(i.Response.Headers, header) } - i.Request.Body = replaceFunc(i.Request.Body) - i.Response.Body = replaceFunc(i.Response.Body) - i.Request.URL = replaceFunc(i.Request.URL) - - s := i.Response.Body - obj := make(map[string]any) - if err := json.Unmarshal([]byte(s), &obj); err != nil { - klog.Fatalf("error from json.Unmarshal(%q): %v", s, err) - } - toReplace, _, _ := unstructured.NestedString(obj, "user") - if len(toReplace) != 0 { - s = strings.Replace(s, toReplace, "user@google.com", -1) - } + i.Request.Body = replaceWellKnownValues(i.Request.Body) + i.Response.Body = replaceWellKnownValues(i.Response.Body) + i.Request.URL = replaceWellKnownValues(i.Request.URL) - // A very hacky way to replace actual debug info from log. - // TODO(yuhou): This code block will be removed in an upcoming PR. - if strings.Contains(s, "error") && strings.Contains(s, "debugInfo") { - keyword := "\"debugInfo\": \"" - // Find index of the start of debugInfo string - startIndex := strings.Index(s, keyword) - // Find index of the end of debugInfo string, by searching for the end quote character - subString := s[startIndex+len(keyword):] - endIndex := strings.Index(subString, "\"") - // Use both indexes to get the string contains the message we need to remove - temp := s[startIndex+len(keyword) : startIndex+len(keyword)+endIndex] - // Replace - s = strings.Replace(s, temp, "fake debug info", -1) - } - - i.Response.Body = s return nil } h.VCRRecorder.AddHook(hook, recorder.BeforeSaveHook) @@ -237,7 +246,7 @@ func testFixturesInSeries(ctx context.Context, t *testing.T, testPause bool, can h.VCRRecorder.SetMatcher(func(r *http.Request, i cassette.Request) bool { // We applied BeforeSaveHook, need to modify the incoming request, // so that incoming request matches the saved request. - modifiedURL := replaceFunc(r.URL.String()) + modifiedURL := replaceWellKnownValues(r.URL.String()) if r.Method != i.Method || modifiedURL != i.URL { return false @@ -255,7 +264,7 @@ func testFixturesInSeries(ctx context.Context, t *testing.T, testPause bool, can r.Body.Close() r.Body = ioutil.NopCloser(bytes.NewBuffer(reqBody)) - modifiedBody := replaceFunc(string(reqBody)) + modifiedBody := replaceWellKnownValues(string(reqBody)) if modifiedBody != i.Body { return false } @@ -580,3 +589,16 @@ func verifyKubeWatches(h *create.Harness) { } } } + +// JSON might be the same, but reordered. Try to sort it before comparing +func sortJSON(s string) (string, error) { + var data map[string]interface{} + if err := json.Unmarshal([]byte(s), &data); err != nil { + return "", err + } + sortedJSON, err := json.Marshal(data) + if err != nil { + return "", err + } + return string(sortedJSON), nil +}