chore(driver/gcs): clean unit tests

Signed-off-by: Julien Breux <julienbreux@google.com>
pull/10922/head
Julien Breux 3 years ago
parent 5900066f7b
commit 33501af9ba
No known key found for this signature in database
GPG Key ID: BA2EB0E039AE0AB3

@ -46,8 +46,8 @@ require (
) )
require ( require (
cloud.google.com/go v0.100.2 // indirect cloud.google.com/go v0.101.0 // indirect
cloud.google.com/go/compute v1.5.0 // indirect cloud.google.com/go/compute v1.6.0 // indirect
cloud.google.com/go/iam v0.3.0 // indirect cloud.google.com/go/iam v0.3.0 // indirect
cloud.google.com/go/storage v1.22.0 // indirect cloud.google.com/go/storage v1.22.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
@ -96,9 +96,10 @@ require (
github.com/google/btree v1.0.1 // indirect github.com/google/btree v1.0.1 // indirect
github.com/google/go-cmp v0.5.7 // indirect github.com/google/go-cmp v0.5.7 // indirect
github.com/google/gofuzz v1.2.0 // indirect github.com/google/gofuzz v1.2.0 // indirect
github.com/google/martian/v3 v3.3.2 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.2.0 // indirect github.com/google/uuid v1.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.2.0 // indirect github.com/googleapis/gax-go/v2 v2.3.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect github.com/googleapis/gnostic v0.5.5 // indirect
github.com/googleapis/go-type-adapters v1.0.0 // indirect github.com/googleapis/go-type-adapters v1.0.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/handlers v1.5.1 // indirect
@ -147,15 +148,15 @@ require (
go.opencensus.io v0.23.0 // indirect go.opencensus.io v0.23.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886 // indirect golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886 // indirect
golang.org/x/text v0.3.7 // indirect golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
google.golang.org/api v0.74.0 // indirect google.golang.org/api v0.74.0 // indirect
google.golang.org/appengine v1.6.7 // indirect google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf // indirect google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 // indirect
google.golang.org/grpc v1.45.0 // indirect google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect

@ -31,6 +31,8 @@ cloud.google.com/go v0.99.0 h1:y/cM2iqGgGi5D5DQZl6D9STN/3dR/Vx5Mp8s752oJTY=
cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA=
cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y=
cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A=
cloud.google.com/go v0.101.0 h1:g+LL+JvpvdyGtcaD2xw2mSByE/6F9s471eJSoaysM84=
cloud.google.com/go v0.101.0/go.mod h1:hEiddgDb77jDQ+I80tURYNJEnuwPzFU8awCFFRLKjW0=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
@ -41,6 +43,8 @@ cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTB
cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM=
cloud.google.com/go/compute v1.5.0 h1:b1zWmYuuHz7gO9kDcM/EpHGr06UgsYNRpNJzI2kFiLM= cloud.google.com/go/compute v1.5.0 h1:b1zWmYuuHz7gO9kDcM/EpHGr06UgsYNRpNJzI2kFiLM=
cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M=
cloud.google.com/go/compute v1.6.0 h1:XdQIN5mdPTSBVwSIVDuY5e8ZzVAccsHvD3qTEz4zIps=
cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
@ -581,10 +585,13 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw=
github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
@ -613,6 +620,8 @@ github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pf
github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=
github.com/googleapis/gax-go/v2 v2.2.0 h1:s7jOdKSaksJVOxE0Y/S32otcfiP+UQ0cL8/GTKaONwE= github.com/googleapis/gax-go/v2 v2.2.0 h1:s7jOdKSaksJVOxE0Y/S32otcfiP+UQ0cL8/GTKaONwE=
github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM=
github.com/googleapis/gax-go/v2 v2.3.0 h1:nRJtk3y8Fm770D42QV6T90ZnvFZyk7agSo3Q+Z9p3WI=
github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM=
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw=
@ -1284,6 +1293,8 @@ golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a h1:qfl7ob3DIEs3Ml9oLuPwY2N04gymzAW04WsUQHIClgM= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a h1:qfl7ob3DIEs3Ml9oLuPwY2N04gymzAW04WsUQHIClgM=
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 h1:OSnWWcOd/CtWQC2cYSBgbTSJv3ciqd8r54ySIW2y3RE=
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -1507,6 +1518,8 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U=
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@ -1633,6 +1646,10 @@ google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2
google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf h1:JTjwKJX9erVpsw17w+OIPP7iAgEkN/r8urhWSunEDTs= google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf h1:JTjwKJX9erVpsw17w+OIPP7iAgEkN/r8urhWSunEDTs=
google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 h1:myaecH64R0bIEDjNORIel4iXubqzaHU1K2z8ajBwWcM=
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=

@ -261,32 +261,7 @@ func (s *GCS) Delete(key string) (*rspb.Release, error) {
return release, nil return release, nil
} }
// DeletePrefixedReleases deletes all prefixed releases // fullPathName returns the full path name composed by prefix, name and namespace
func (s *GCS) DeletePrefixedReleases() error {
query := storage.Query{
Prefix: fmt.Sprintf("%s/", s.pathPrefix),
}
ctx := context.Background()
objs := s.client.Bucket(s.bucket).Objects(ctx, &query)
for {
objAttrs, err := objs.Next()
if err == iterator.Done {
break
}
if err != nil {
s.Log("unable to delete objects", err)
return err
}
obj := s.client.Bucket(s.bucket).Object(objAttrs.Name)
if obj.Delete(ctx); err != nil {
s.Log("failed to delete object: (%s) %v", objAttrs.Name, err)
}
s.Log("object deleted successfully: (%s)", objAttrs.Name)
}
return nil
}
func (s *GCS) fullPathName(name, namespace string) string { func (s *GCS) fullPathName(name, namespace string) string {
if namespace == "" { if namespace == "" {
namespace = defaultNamespace namespace = defaultNamespace
@ -297,6 +272,7 @@ func (s *GCS) fullPathName(name, namespace string) string {
) )
} }
// metadata returns the metadata list from release
func (s *GCS) metadata(rls *rspb.Release, isCreation bool) map[string]string { func (s *GCS) metadata(rls *rspb.Release, isCreation bool) map[string]string {
ts := strconv.FormatInt(time.Now().UTC().UnixNano(), 10) ts := strconv.FormatInt(time.Now().UTC().UnixNano(), 10)
md := map[string]string{ md := map[string]string{
@ -313,6 +289,7 @@ func (s *GCS) metadata(rls *rspb.Release, isCreation bool) map[string]string {
return md return md
} }
// readRelease helps to read a release by the object key
func (s *GCS) readRelease(key string, withMetadata bool) (*rspb.Release, map[string]string, error) { func (s *GCS) readRelease(key string, withMetadata bool) (*rspb.Release, map[string]string, error) {
metadata := make(map[string]string) metadata := make(map[string]string)
ctx := context.Background() ctx := context.Background()
@ -349,6 +326,7 @@ func (s *GCS) readRelease(key string, withMetadata bool) (*rspb.Release, map[str
return release, metadata, nil return release, metadata, nil
} }
// listNamespaces helps to list namespaces inside a bucket
func (s *GCS) listNamespaces() ([]string, error) { func (s *GCS) listNamespaces() ([]string, error) {
if s.namespace != "" { if s.namespace != "" {
return []string{s.namespace}, nil return []string{s.namespace}, nil
@ -384,6 +362,7 @@ func (s *GCS) listNamespaces() ([]string, error) {
return namespaces, nil return namespaces, nil
} }
// listReleases helps to list releases in a namespace "folder"
func (s *GCS) listReleases(namespace string) ([]string, error) { func (s *GCS) listReleases(namespace string) ([]string, error) {
releases := []string{} releases := []string{}

File diff suppressed because one or more lines are too long

@ -17,38 +17,61 @@ limitations under the License.
package driver package driver
import ( import (
"fmt" "context"
"encoding/json"
"flag"
"net/http"
"os" "os"
"reflect" "reflect"
"testing" "testing"
"time"
"cloud.google.com/go/httpreplay"
"cloud.google.com/go/storage"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
rspb "helm.sh/helm/v3/pkg/release" rspb "helm.sh/helm/v3/pkg/release"
) )
var prefixes = []string{"helm-releases", "helm-releases-list"} var (
rec = flag.Bool("record", false, "record RPCs")
gcsDriver *GCS
)
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
removeReleases() cleanup := newTestFixtureGCS()
clearObjects()
retCode := m.Run() retCode := m.Run()
clearObjects()
// removeReleases() cleanup()
os.Exit(retCode) os.Exit(retCode)
} }
func removeReleases() { func clearObjects() {
for _, prefix := range prefixes { ctx := context.Background()
gcsDriver := newTestFixtureGCS(prefix, "default") objs := gcsDriver.client.
if err := gcsDriver.DeletePrefixedReleases(); err != nil { Bucket(gcsDriver.bucket).
fmt.Printf("Expected error on setup tests: %v", err) Objects(ctx, &storage.Query{Prefix: ""})
os.Exit(1) for {
objAttrs, err := objs.Next()
if err == iterator.Done {
break
} }
if err != nil {
panic(err)
}
obj := gcsDriver.client.
Bucket(gcsDriver.bucket).
Object(objAttrs.Name)
obj.Delete(ctx)
} }
} }
func TestGCSName(t *testing.T) { func TestGCSName(t *testing.T) {
gcsDriver := newTestFixtureGCS("helm-releases", "default") // gcsDriver := newTestFixtureGCS("helm-releases", "default")
if gcsDriver.Name() != GCSDriverName { if gcsDriver.Name() != GCSDriverName {
t.Errorf("Expected name to be %s, got %s", GCSDriverName, gcsDriver.Name()) t.Errorf("Expected name to be %s, got %s", GCSDriverName, gcsDriver.Name())
} }
@ -60,8 +83,6 @@ func TestGCSGet(t *testing.T) {
key := testKey(name, vers) key := testKey(name, vers)
rel := releaseStub(name, vers, "default", rspb.StatusDeployed) rel := releaseStub(name, vers, "default", rspb.StatusDeployed)
gcsDriver := newTestFixtureGCS("helm-releases", "default")
// create stub // create stub
if err := gcsDriver.Create(key, rel); err != nil { if err := gcsDriver.Create(key, rel); err != nil {
t.Fatalf("failed to create release with key %s: %v", key, err) t.Fatalf("failed to create release with key %s: %v", key, err)
@ -82,8 +103,6 @@ func TestGCSGetNotExist(t *testing.T) {
name := "gcs-test-get-not-exists" name := "gcs-test-get-not-exists"
key := testKey(name, vers) key := testKey(name, vers)
gcsDriver := newTestFixtureGCS("helm-releases", "default")
got, err := gcsDriver.Get(key) got, err := gcsDriver.Get(key)
if err == nil || got != nil { if err == nil || got != nil {
t.Fatal("Release must be not found") t.Fatal("Release must be not found")
@ -92,12 +111,10 @@ func TestGCSGetNotExist(t *testing.T) {
func TestGCSCreate(t *testing.T) { func TestGCSCreate(t *testing.T) {
vers := 1 vers := 1
name := "gcs-test" name := "gcs-test-create"
key := testKey(name, vers) key := testKey(name, vers)
rel := releaseStub(name, vers, "default", rspb.StatusDeployed) rel := releaseStub(name, vers, "default", rspb.StatusDeployed)
gcsDriver := newTestFixtureGCS("helm-releases", "default")
if err := gcsDriver.Create(key, rel); err != nil { if err := gcsDriver.Create(key, rel); err != nil {
t.Fatalf("failed to create release with key %s: %v", key, err) t.Fatalf("failed to create release with key %s: %v", key, err)
} }
@ -109,8 +126,6 @@ func TestGCSUpdate(t *testing.T) {
key := testKey(name, vers) key := testKey(name, vers)
rel := releaseStub(name, vers, "default", rspb.StatusDeployed) rel := releaseStub(name, vers, "default", rspb.StatusDeployed)
gcsDriver := newTestFixtureGCS("helm-releases", "default")
// create stub // create stub
if err := gcsDriver.Create(key, rel); err != nil { if err := gcsDriver.Create(key, rel); err != nil {
t.Fatalf("failed to create release with key %s: %v", key, err) t.Fatalf("failed to create release with key %s: %v", key, err)
@ -128,8 +143,6 @@ func TestGCSDelete(t *testing.T) {
key := testKey(name, vers) key := testKey(name, vers)
rel := releaseStub(name, vers, "default", rspb.StatusDeployed) rel := releaseStub(name, vers, "default", rspb.StatusDeployed)
gcsDriver := newTestFixtureGCS("helm-releases", "default")
// create stub // create stub
if err := gcsDriver.Create(key, rel); err != nil { if err := gcsDriver.Create(key, rel); err != nil {
t.Fatalf("failed to create release with key %s: %v", key, err) t.Fatalf("failed to create release with key %s: %v", key, err)
@ -151,14 +164,15 @@ func TestGCSDeleteNotFound(t *testing.T) {
name := "gcs-test-delete-not-found" name := "gcs-test-delete-not-found"
key := testKey(name, vers) key := testKey(name, vers)
gcsDriver := newTestFixtureGCS("helm-releases", "default")
if _, err := gcsDriver.Delete(key); err == nil { if _, err := gcsDriver.Delete(key); err == nil {
t.Fatalf("release found with key %s: %v", key, err) t.Fatalf("release found with key %s: %v", key, err)
} }
} }
func TestGCSList(t *testing.T) { func TestGCSList(t *testing.T) {
gcsDriver.pathPrefix = "helm-tests-list"
gcsDriver.namespace = ""
namespaceA := "list-a" namespaceA := "list-a"
namespaceB := "list-b" namespaceB := "list-b"
@ -175,8 +189,6 @@ func TestGCSList(t *testing.T) {
{"gcs-test-list-key-6", namespaceB, rspb.StatusSuperseded}, {"gcs-test-list-key-6", namespaceB, rspb.StatusSuperseded},
} }
gcsDriver := newTestFixtureGCS("helm-releases-list", "")
// create stubs // create stubs
for _, tt := range tests { for _, tt := range tests {
rel := releaseStub(tt.key, 1, tt.namespace, tt.status) rel := releaseStub(tt.key, 1, tt.namespace, tt.status)
@ -223,6 +235,8 @@ func TestGCSList(t *testing.T) {
} }
func TestGCSQuery(t *testing.T) { func TestGCSQuery(t *testing.T) {
gcsDriver.pathPrefix = "helm-tests-query"
namespace := "default" namespace := "default"
tests := []struct { tests := []struct {
key string key string
@ -237,8 +251,6 @@ func TestGCSQuery(t *testing.T) {
{"gcs-test-list-key-6", namespace, rspb.StatusSuperseded}, {"gcs-test-list-key-6", namespace, rspb.StatusSuperseded},
} }
gcsDriver := newTestFixtureGCS("helm-releases-query", "")
// create stubs // create stubs
for _, tt := range tests { for _, tt := range tests {
rel := releaseStub(tt.key, 1, tt.namespace, tt.status) rel := releaseStub(tt.key, 1, tt.namespace, tt.status)
@ -260,3 +272,67 @@ func TestGCSQuery(t *testing.T) {
t.Errorf("Expected {%v}, got {%v}", ErrReleaseNotFound, err) t.Errorf("Expected {%v}, got {%v}", ErrReleaseNotFound, err)
} }
} }
// newTestFixtureGCS mocks the GCS (for testing purposes)
func newTestFixtureGCS() func() {
flag.Parse()
prefix := "helm-tests"
namespace := "default"
replayFilename := "gcs.replay"
ctx := context.Background()
var hc *http.Client
cleanup := func() {}
if *rec {
now := time.Now().UTC()
if !httpreplay.Supported() {
panic("HTTP replay not supported")
}
nowBytes, err := json.Marshal(now)
if err != nil {
panic(err)
}
recorder, err := httpreplay.NewRecorder(replayFilename, nowBytes)
if err != nil {
panic(err)
}
hc, err = recorder.Client(ctx)
if err != nil {
panic(err)
}
cleanup = func() {
if err := recorder.Close(); err != nil {
panic(err)
}
}
} else {
httpreplay.DebugHeaders()
replayer, err := httpreplay.NewReplayer(replayFilename)
if err != nil {
panic(err)
}
var t time.Time
if err := json.Unmarshal(replayer.Initial(), &t); err != nil {
panic(err)
}
hc, err = replayer.Client(ctx)
if err != nil {
panic(err)
}
cleanup = func() {}
}
client, _ := storage.NewClient(ctx, option.WithHTTPClient(hc))
gcsDriver = &GCS{
client: client,
bucket: "helm-tests",
pathPrefix: prefix,
namespace: namespace,
Log: func(a string, b ...interface{}) {},
}
return cleanup
}

@ -21,7 +21,6 @@ import (
"fmt" "fmt"
"testing" "testing"
"cloud.google.com/go/storage"
sqlmock "github.com/DATA-DOG/go-sqlmock" sqlmock "github.com/DATA-DOG/go-sqlmock"
sq "github.com/Masterminds/squirrel" sq "github.com/Masterminds/squirrel"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
@ -264,18 +263,3 @@ func newTestFixtureSQL(t *testing.T, releases ...*rspb.Release) (*SQL, sqlmock.S
statementBuilder: sq.StatementBuilder.PlaceholderFormat(sq.Dollar), statementBuilder: sq.StatementBuilder.PlaceholderFormat(sq.Dollar),
}, mock }, mock
} }
// newTestFixtureGCS mocks the GCS (for testing purposes)
func newTestFixtureGCS(prefix, namespace string) *GCS {
client, _ := storage.NewClient(context.Background())
return &GCS{
client: client,
bucket: "helm-tests",
pathPrefix: prefix,
namespace: namespace,
Log: func(a string, b ...interface{}) {},
}
}

Loading…
Cancel
Save