diff --git a/.mockery.yaml b/.mockery.yaml index d489af4119f..33cf8951e7e 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -1,22 +1,19 @@ -with-expecter: False -mockname: "{{.InterfaceName}}" -filename: "{{.InterfaceNameSnake}}.go" -outpkg: "mocks" -dir: '{{trimPrefix .PackagePath "github.com/projectcontour/contour/" }}/mocks' -disable-version-string: True -resolve-type-alias: False +template: testify +dir: "{{.InterfaceDir}}/mocks" +filename: "mock_{{.InterfaceName | snakecase}}.go" +pkgname: mocks packages: - github.com/projectcontour/contour/internal/debug: - interfaces: - DagBuilder: - github.com/projectcontour/contour/internal/k8s: - interfaces: - StatusMetrics: - sigs.k8s.io/controller-runtime/pkg/cache: - config: - dir: "internal/k8s/mocks" - interfaces: - Cache: - github.com/projectcontour/contour/internal/leadership: - interfaces: - NeedLeaderElectionNotification: \ No newline at end of file + github.com/projectcontour/contour/internal/debug: + interfaces: + DagBuilder: {} + github.com/projectcontour/contour/internal/k8s: + interfaces: + StatusMetrics: {} + github.com/projectcontour/contour/internal/leadership: + interfaces: + NeedLeaderElectionNotification: {} + sigs.k8s.io/controller-runtime/pkg/cache: + config: + dir: internal/k8s/mocks + interfaces: + Cache: {} diff --git a/Makefile b/Makefile index fc314e94729..44e3d949c38 100644 --- a/Makefile +++ b/Makefile @@ -270,7 +270,7 @@ generate-metrics-docs: .PHONY: generate-go generate-go: @echo "Generating mocks..." - @go run github.com/vektra/mockery/v2 + @go run github.com/vektra/mockery/v3 .PHONY: check-generate check-generate: generate diff --git a/go.mod b/go.mod index 6c04f07f899..607e662781f 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/sirupsen/logrus v1.9.4 github.com/stretchr/testify v1.11.1 github.com/tsaarni/certyaml v0.11.0 - github.com/vektra/mockery/v2 v2.53.6 + github.com/vektra/mockery/v3 v3.7.0 go.uber.org/automaxprocs v1.6.0 golang.org/x/net v0.55.0 golang.org/x/oauth2 v0.36.0 @@ -58,14 +58,16 @@ require ( github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/brunoga/deep v1.3.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/chigopher/pathlib v0.19.1 // indirect + github.com/clipperhouse/uax29/v2 v2.2.0 // indirect github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/fatih/color v1.19.0 // indirect + github.com/fatih/structs v1.1.0 // indirect github.com/fsnotify/fsnotify v1.10.0 // indirect github.com/fxamacker/cbor/v2 v2.9.1 // indirect github.com/go-asn1-ber/asn1-ber v1.5.7 // indirect @@ -92,41 +94,46 @@ require ( github.com/google/go-querystring v1.1.0 // indirect github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 // indirect github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect - github.com/huandu/xstrings v1.4.0 // indirect - github.com/iancoleman/strcase v0.3.0 // indirect + github.com/huandu/xstrings v1.5.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/jinzhu/copier v0.4.0 // indirect + github.com/jedib0t/go-pretty/v6 v6.7.8 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/knadh/koanf/maps v0.1.2 // indirect + github.com/knadh/koanf/parsers/yaml v1.1.0 // indirect + github.com/knadh/koanf/providers/env v1.1.0 // indirect + github.com/knadh/koanf/providers/file v1.2.1 // indirect + github.com/knadh/koanf/providers/posflag v1.0.1 // indirect + github.com/knadh/koanf/providers/structs v1.0.0 // indirect + github.com/knadh/koanf/v2 v2.3.2 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.19 // indirect github.com/miekg/dns v1.1.65 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/moby/spdystream v0.5.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/procfs v0.20.1 // indirect github.com/rs/zerolog v1.34.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sagikazarmark/locafero v0.12.0 // indirect - github.com/spf13/afero v1.15.0 // indirect - github.com/spf13/cast v1.10.0 // indirect github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect - github.com/spf13/viper v1.21.0 // indirect github.com/stretchr/objx v0.5.3 // indirect - github.com/subosito/gotenv v1.6.0 // indirect github.com/tsaarni/x500dn v1.1.0 // indirect github.com/x448/float16 v0.8.4 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.51.0 // indirect + golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a // indirect golang.org/x/image v0.38.0 // indirect golang.org/x/mod v0.35.0 // indirect golang.org/x/sync v0.20.0 // indirect diff --git a/go.sum b/go.sum index bfc9bd899e2..89d87c8c9f7 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,8 @@ github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjH github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= -github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= -github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= +github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= +github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -41,14 +41,16 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/bombsimon/logrusr/v4 v4.1.0 h1:uZNPbwusB0eUXlO8hIUwStE6Lr5bLN6IgYgG+75kuh4= github.com/bombsimon/logrusr/v4 v4.1.0/go.mod h1:pjfHC5e59CvjTBIU3V3sGhFWFAnsnhOR03TRc6im0l8= +github.com/brunoga/deep v1.3.1 h1:bSrL6FhAZa6JlVv4vsi7Hg8SLwroDb1kgDERRVipBCo= +github.com/brunoga/deep v1.3.1/go.mod h1:GDV6dnXqn80ezsLSZ5Wlv1PdKAWAO4L5PnKYtv2dgaI= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chigopher/pathlib v0.19.1 h1:RoLlUJc0CqBGwq239cilyhxPNLXTK+HXoASGyGznx5A= -github.com/chigopher/pathlib v0.19.1/go.mod h1:tzC1dZLW8o33UQpWkNkhvPwL5n4yyFRFm/jL1YGWFvY= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY= +github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= @@ -74,16 +76,16 @@ github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJP github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= -github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= -github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= +github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.10.0 h1:Xx/5Ydg9CeBDX/wi4VJqStNtohYjitZhhlHt4h3St1M= github.com/fsnotify/fsnotify v1.10.0/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo= github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ= @@ -187,14 +189,12 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= -github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= -github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= -github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= +github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= -github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jedib0t/go-pretty/v6 v6.7.8 h1:BVYrDy5DPBA3Qn9ICT+PokP9cvCv1KaHv2i+Hc8sr5o= +github.com/jedib0t/go-pretty/v6 v6.7.8/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU= github.com/joshdk/go-junit v1.0.0 h1:S86cUKIdwBHWwA6xCmFlf3RTLfVXYQfvanM5Uh+K6GE= github.com/joshdk/go-junit v1.0.0/go.mod h1:TiiV0PqkaNfFXjEiyjWM3XXrhVyCa1K4Zfga6W52ung= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -203,6 +203,20 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo= +github.com/knadh/koanf/maps v0.1.2/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/parsers/yaml v1.1.0 h1:3ltfm9ljprAHt4jxgeYLlFPmUaunuCgu1yILuTXRdM4= +github.com/knadh/koanf/parsers/yaml v1.1.0/go.mod h1:HHmcHXUrp9cOPcuC+2wrr44GTUB0EC+PyfN3HZD9tFg= +github.com/knadh/koanf/providers/env v1.1.0 h1:U2VXPY0f+CsNDkvdsG8GcsnK4ah85WwWyJgef9oQMSc= +github.com/knadh/koanf/providers/env v1.1.0/go.mod h1:QhHHHZ87h9JxJAn2czdEl6pdkNnDh/JS1Vtsyt65hTY= +github.com/knadh/koanf/providers/file v1.2.1 h1:bEWbtQwYrA+W2DtdBrQWyXqJaJSG3KrP3AESOJYp9wM= +github.com/knadh/koanf/providers/file v1.2.1/go.mod h1:bp1PM5f83Q+TOUu10J/0ApLBd9uIzg+n9UgthfY+nRA= +github.com/knadh/koanf/providers/posflag v1.0.1 h1:EnMxHSrPkYCFnKgBUl5KBgrjed8gVFrcXDzaW4l/C6Y= +github.com/knadh/koanf/providers/posflag v1.0.1/go.mod h1:3Wn3+YG3f4ljzRyCUgIwH7G0sZ1pMjCOsNBovrbKmAk= +github.com/knadh/koanf/providers/structs v1.0.0 h1:DznjB7NQykhqCar2LvNug3MuxEQsZ5KvfgMbio+23u4= +github.com/knadh/koanf/providers/structs v1.0.0/go.mod h1:kjo5TFtgpaZORlpoJqcbeLowM2cINodv8kX+oFAeQ1w= +github.com/knadh/koanf/v2 v2.3.2 h1:Ee6tuzQYFwcZXQpc2MiVeC6qHMandf5SMUJJNoFp/c4= +github.com/knadh/koanf/v2 v2.3.2/go.mod h1:gRb40VRAbd4iJMYYD5IxZ6hfuopFcXBpc9bbQpZwo28= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -222,14 +236,16 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= +github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE= github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A= github.com/miekg/dns v1.1.65 h1:0+tIPHzUW0GCge7IiK3guGP57VAw7hoPDfApjkMD1Fc= github.com/miekg/dns v1.1.65/go.mod h1:Dzw9769uoKVaLuODMDZz9M6ynFU6Em65csPuoi8G0ck= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.5.1 h1:9sNYeYZUcci9R6/w7KDaFWEWeV4LStVG78Mpyq/Zm/Y= github.com/moby/spdystream v0.5.1/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -251,8 +267,6 @@ github.com/onsi/gomega v1.41.0/go.mod h1:M/Uqpu/8qTjtzCLUA2zJHX9Iilrau25x1PdoSRb github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= -github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -281,22 +295,14 @@ github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4= -github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= -github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= -github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= -github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= -github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU= -github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -317,8 +323,6 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= -github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -331,10 +335,17 @@ github.com/tsaarni/certyaml v0.11.0 h1:qpiXKPCGZvQaYf3ParnvLcxMZmWqBIeU4XDAywfQU github.com/tsaarni/certyaml v0.11.0/go.mod h1:AiWJjkISlmC8shtMWPxsY9vMFpu+VYB8arwWr8079f4= github.com/tsaarni/x500dn v1.1.0 h1:+rgqGj7LQEkdIIRLsYJm5S6M2dDBscb6/xiEcGW678s= github.com/tsaarni/x500dn v1.1.0/go.mod h1:vzfi5pu5wr1eeFf9/0rIr5Bc1kxeyes4jFMCcp0wfCk= -github.com/vektra/mockery/v2 v2.53.6 h1:qfUB6saauu652ZlMF/mEdlj7B/A0fw2XR0XBACBrf7Y= -github.com/vektra/mockery/v2 v2.53.6/go.mod h1:fjxC+mskIZqf67+z34pHxRRyyZnPnWNA36Cirf01Pkg= +github.com/vektra/mockery/v3 v3.7.0 h1:Dd0EeaOcRJBVP9n3oYOVPV7KdPaaE3EcwTppaZIsFSM= +github.com/vektra/mockery/v3 v3.7.0/go.mod h1:z9Wr23Ha8etImqQwS3boTNR9WkjX6tIklW5c88DRkSw= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -381,8 +392,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.51.0 h1:IBPXwPfKxY7cWQZ38ZCIRPI50YLeevDLlLnyC5wRGTI= golang.org/x/crypto v0.51.0/go.mod h1:8AdwkbraGNABw2kOX6YFPs3WM22XqI4EXEd8g+x7Oc8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= -golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= +golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a h1:ovFr6Z0MNmU7nH8VaX5xqw+05ST2uO1exVfZPVqRC5o= +golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA= golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE= golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/internal/debug/dot_test.go b/internal/debug/dot_test.go index 284bc159a7c..964f7aab36e 100644 --- a/internal/debug/dot_test.go +++ b/internal/debug/dot_test.go @@ -33,7 +33,7 @@ func TestWriteDotEscapesLabels(t *testing.T) { for _, l := range getTestListeners() { d.Listeners[l.Name] = l } - b := mocks.DagBuilder{} + b := mocks.MockDagBuilder{} b.On("Build").Return(&d) dw := &dotWriter{ @@ -63,7 +63,7 @@ func TestWriteDotLineCount(t *testing.T) { for _, l := range getTestListeners() { d.Listeners[l.Name] = l } - b := mocks.DagBuilder{} + b := mocks.MockDagBuilder{} b.On("Build").Return(&d) dw := &dotWriter{ diff --git a/internal/debug/mocks/dag_builder.go b/internal/debug/mocks/dag_builder.go deleted file mode 100644 index 2ddde5b81aa..00000000000 --- a/internal/debug/mocks/dag_builder.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import ( - dag "github.com/projectcontour/contour/internal/dag" - - mock "github.com/stretchr/testify/mock" -) - -// DagBuilder is an autogenerated mock type for the DagBuilder type -type DagBuilder struct { - mock.Mock -} - -// Build provides a mock function with no fields -func (_m *DagBuilder) Build() *dag.DAG { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Build") - } - - var r0 *dag.DAG - if rf, ok := ret.Get(0).(func() *dag.DAG); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*dag.DAG) - } - } - - return r0 -} - -// NewDagBuilder creates a new instance of DagBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewDagBuilder(t interface { - mock.TestingT - Cleanup(func()) -}) *DagBuilder { - mock := &DagBuilder{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/internal/debug/mocks/mock_dag_builder.go b/internal/debug/mocks/mock_dag_builder.go new file mode 100644 index 00000000000..5c8b64f7d45 --- /dev/null +++ b/internal/debug/mocks/mock_dag_builder.go @@ -0,0 +1,83 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "github.com/projectcontour/contour/internal/dag" + mock "github.com/stretchr/testify/mock" +) + +// NewMockDagBuilder creates a new instance of MockDagBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockDagBuilder(t interface { + mock.TestingT + Cleanup(func()) +}) *MockDagBuilder { + mock := &MockDagBuilder{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockDagBuilder is an autogenerated mock type for the DagBuilder type +type MockDagBuilder struct { + mock.Mock +} + +type MockDagBuilder_Expecter struct { + mock *mock.Mock +} + +func (_m *MockDagBuilder) EXPECT() *MockDagBuilder_Expecter { + return &MockDagBuilder_Expecter{mock: &_m.Mock} +} + +// Build provides a mock function for the type MockDagBuilder +func (_mock *MockDagBuilder) Build() *dag.DAG { + ret := _mock.Called() + + if len(ret) == 0 { + panic("no return value specified for Build") + } + + var r0 *dag.DAG + if returnFunc, ok := ret.Get(0).(func() *dag.DAG); ok { + r0 = returnFunc() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*dag.DAG) + } + } + return r0 +} + +// MockDagBuilder_Build_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Build' +type MockDagBuilder_Build_Call struct { + *mock.Call +} + +// Build is a helper method to define mock.On call +func (_e *MockDagBuilder_Expecter) Build() *MockDagBuilder_Build_Call { + return &MockDagBuilder_Build_Call{Call: _e.mock.On("Build")} +} + +func (_c *MockDagBuilder_Build_Call) Run(run func()) *MockDagBuilder_Build_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockDagBuilder_Build_Call) Return(dAG *dag.DAG) *MockDagBuilder_Build_Call { + _c.Call.Return(dAG) + return _c +} + +func (_c *MockDagBuilder_Build_Call) RunAndReturn(run func() *dag.DAG) *MockDagBuilder_Build_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/k8s/mocks/cache.go b/internal/k8s/mocks/cache.go deleted file mode 100644 index 79017120e9b..00000000000 --- a/internal/k8s/mocks/cache.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import ( - cache "sigs.k8s.io/controller-runtime/pkg/cache" - client "sigs.k8s.io/controller-runtime/pkg/client" - - context "context" - - mock "github.com/stretchr/testify/mock" - - schema "k8s.io/apimachinery/pkg/runtime/schema" -) - -// Cache is an autogenerated mock type for the Cache type -type Cache struct { - mock.Mock -} - -// Get provides a mock function with given fields: ctx, key, obj, opts -func (_m *Cache) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, key, obj) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for Get") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, client.ObjectKey, client.Object, ...client.GetOption) error); ok { - r0 = rf(ctx, key, obj, opts...) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// GetInformer provides a mock function with given fields: ctx, obj, opts -func (_m *Cache) GetInformer(ctx context.Context, obj client.Object, opts ...cache.InformerGetOption) (cache.Informer, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, obj) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetInformer") - } - - var r0 cache.Informer - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, client.Object, ...cache.InformerGetOption) (cache.Informer, error)); ok { - return rf(ctx, obj, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, client.Object, ...cache.InformerGetOption) cache.Informer); ok { - r0 = rf(ctx, obj, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(cache.Informer) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, client.Object, ...cache.InformerGetOption) error); ok { - r1 = rf(ctx, obj, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetInformerForKind provides a mock function with given fields: ctx, gvk, opts -func (_m *Cache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind, opts ...cache.InformerGetOption) (cache.Informer, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, gvk) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetInformerForKind") - } - - var r0 cache.Informer - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, schema.GroupVersionKind, ...cache.InformerGetOption) (cache.Informer, error)); ok { - return rf(ctx, gvk, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, schema.GroupVersionKind, ...cache.InformerGetOption) cache.Informer); ok { - r0 = rf(ctx, gvk, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(cache.Informer) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, schema.GroupVersionKind, ...cache.InformerGetOption) error); ok { - r1 = rf(ctx, gvk, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// IndexField provides a mock function with given fields: ctx, obj, field, extractValue -func (_m *Cache) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error { - ret := _m.Called(ctx, obj, field, extractValue) - - if len(ret) == 0 { - panic("no return value specified for IndexField") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, client.Object, string, client.IndexerFunc) error); ok { - r0 = rf(ctx, obj, field, extractValue) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// List provides a mock function with given fields: ctx, list, opts -func (_m *Cache) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, list) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for List") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, client.ObjectList, ...client.ListOption) error); ok { - r0 = rf(ctx, list, opts...) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// RemoveInformer provides a mock function with given fields: ctx, obj -func (_m *Cache) RemoveInformer(ctx context.Context, obj client.Object) error { - ret := _m.Called(ctx, obj) - - if len(ret) == 0 { - panic("no return value specified for RemoveInformer") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, client.Object) error); ok { - r0 = rf(ctx, obj) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Start provides a mock function with given fields: ctx -func (_m *Cache) Start(ctx context.Context) error { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for Start") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(ctx) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// WaitForCacheSync provides a mock function with given fields: ctx -func (_m *Cache) WaitForCacheSync(ctx context.Context) bool { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for WaitForCacheSync") - } - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context) bool); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// NewCache creates a new instance of Cache. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewCache(t interface { - mock.TestingT - Cleanup(func()) -}) *Cache { - mock := &Cache{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/internal/k8s/mocks/mock_cache.go b/internal/k8s/mocks/mock_cache.go new file mode 100644 index 00000000000..f577a22bb9e --- /dev/null +++ b/internal/k8s/mocks/mock_cache.go @@ -0,0 +1,585 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "context" + + mock "github.com/stretchr/testify/mock" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// NewMockCache creates a new instance of MockCache. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockCache(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCache { + mock := &MockCache{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockCache is an autogenerated mock type for the Cache type +type MockCache struct { + mock.Mock +} + +type MockCache_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCache) EXPECT() *MockCache_Expecter { + return &MockCache_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function for the type MockCache +func (_mock *MockCache) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, key, obj, opts) + } else { + tmpRet = _mock.Called(ctx, key, obj) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, client.ObjectKey, client.Object, ...client.GetOption) error); ok { + r0 = returnFunc(ctx, key, obj, opts...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockCache_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - key client.ObjectKey +// - obj client.Object +// - opts ...client.GetOption +func (_e *MockCache_Expecter) Get(ctx interface{}, key interface{}, obj interface{}, opts ...interface{}) *MockCache_Get_Call { + return &MockCache_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{ctx, key, obj}, opts...)...)} +} + +func (_c *MockCache_Get_Call) Run(run func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption)) *MockCache_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 client.ObjectKey + if args[1] != nil { + arg1 = args[1].(client.ObjectKey) + } + var arg2 client.Object + if args[2] != nil { + arg2 = args[2].(client.Object) + } + var arg3 []client.GetOption + var variadicArgs []client.GetOption + if len(args) > 3 { + variadicArgs = args[3].([]client.GetOption) + } + arg3 = variadicArgs + run( + arg0, + arg1, + arg2, + arg3..., + ) + }) + return _c +} + +func (_c *MockCache_Get_Call) Return(err error) *MockCache_Get_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_Get_Call) RunAndReturn(run func(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error) *MockCache_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetInformer provides a mock function for the type MockCache +func (_mock *MockCache) GetInformer(ctx context.Context, obj client.Object, opts ...cache.InformerGetOption) (cache.Informer, error) { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, obj, opts) + } else { + tmpRet = _mock.Called(ctx, obj) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for GetInformer") + } + + var r0 cache.Informer + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, client.Object, ...cache.InformerGetOption) (cache.Informer, error)); ok { + return returnFunc(ctx, obj, opts...) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, client.Object, ...cache.InformerGetOption) cache.Informer); ok { + r0 = returnFunc(ctx, obj, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(cache.Informer) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, client.Object, ...cache.InformerGetOption) error); ok { + r1 = returnFunc(ctx, obj, opts...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockCache_GetInformer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInformer' +type MockCache_GetInformer_Call struct { + *mock.Call +} + +// GetInformer is a helper method to define mock.On call +// - ctx context.Context +// - obj client.Object +// - opts ...cache.InformerGetOption +func (_e *MockCache_Expecter) GetInformer(ctx interface{}, obj interface{}, opts ...interface{}) *MockCache_GetInformer_Call { + return &MockCache_GetInformer_Call{Call: _e.mock.On("GetInformer", + append([]interface{}{ctx, obj}, opts...)...)} +} + +func (_c *MockCache_GetInformer_Call) Run(run func(ctx context.Context, obj client.Object, opts ...cache.InformerGetOption)) *MockCache_GetInformer_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 client.Object + if args[1] != nil { + arg1 = args[1].(client.Object) + } + var arg2 []cache.InformerGetOption + var variadicArgs []cache.InformerGetOption + if len(args) > 2 { + variadicArgs = args[2].([]cache.InformerGetOption) + } + arg2 = variadicArgs + run( + arg0, + arg1, + arg2..., + ) + }) + return _c +} + +func (_c *MockCache_GetInformer_Call) Return(informer cache.Informer, err error) *MockCache_GetInformer_Call { + _c.Call.Return(informer, err) + return _c +} + +func (_c *MockCache_GetInformer_Call) RunAndReturn(run func(ctx context.Context, obj client.Object, opts ...cache.InformerGetOption) (cache.Informer, error)) *MockCache_GetInformer_Call { + _c.Call.Return(run) + return _c +} + +// GetInformerForKind provides a mock function for the type MockCache +func (_mock *MockCache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind, opts ...cache.InformerGetOption) (cache.Informer, error) { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, gvk, opts) + } else { + tmpRet = _mock.Called(ctx, gvk) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for GetInformerForKind") + } + + var r0 cache.Informer + var r1 error + if returnFunc, ok := ret.Get(0).(func(context.Context, schema.GroupVersionKind, ...cache.InformerGetOption) (cache.Informer, error)); ok { + return returnFunc(ctx, gvk, opts...) + } + if returnFunc, ok := ret.Get(0).(func(context.Context, schema.GroupVersionKind, ...cache.InformerGetOption) cache.Informer); ok { + r0 = returnFunc(ctx, gvk, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(cache.Informer) + } + } + if returnFunc, ok := ret.Get(1).(func(context.Context, schema.GroupVersionKind, ...cache.InformerGetOption) error); ok { + r1 = returnFunc(ctx, gvk, opts...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockCache_GetInformerForKind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInformerForKind' +type MockCache_GetInformerForKind_Call struct { + *mock.Call +} + +// GetInformerForKind is a helper method to define mock.On call +// - ctx context.Context +// - gvk schema.GroupVersionKind +// - opts ...cache.InformerGetOption +func (_e *MockCache_Expecter) GetInformerForKind(ctx interface{}, gvk interface{}, opts ...interface{}) *MockCache_GetInformerForKind_Call { + return &MockCache_GetInformerForKind_Call{Call: _e.mock.On("GetInformerForKind", + append([]interface{}{ctx, gvk}, opts...)...)} +} + +func (_c *MockCache_GetInformerForKind_Call) Run(run func(ctx context.Context, gvk schema.GroupVersionKind, opts ...cache.InformerGetOption)) *MockCache_GetInformerForKind_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 schema.GroupVersionKind + if args[1] != nil { + arg1 = args[1].(schema.GroupVersionKind) + } + var arg2 []cache.InformerGetOption + var variadicArgs []cache.InformerGetOption + if len(args) > 2 { + variadicArgs = args[2].([]cache.InformerGetOption) + } + arg2 = variadicArgs + run( + arg0, + arg1, + arg2..., + ) + }) + return _c +} + +func (_c *MockCache_GetInformerForKind_Call) Return(informer cache.Informer, err error) *MockCache_GetInformerForKind_Call { + _c.Call.Return(informer, err) + return _c +} + +func (_c *MockCache_GetInformerForKind_Call) RunAndReturn(run func(ctx context.Context, gvk schema.GroupVersionKind, opts ...cache.InformerGetOption) (cache.Informer, error)) *MockCache_GetInformerForKind_Call { + _c.Call.Return(run) + return _c +} + +// IndexField provides a mock function for the type MockCache +func (_mock *MockCache) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error { + ret := _mock.Called(ctx, obj, field, extractValue) + + if len(ret) == 0 { + panic("no return value specified for IndexField") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, client.Object, string, client.IndexerFunc) error); ok { + r0 = returnFunc(ctx, obj, field, extractValue) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_IndexField_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IndexField' +type MockCache_IndexField_Call struct { + *mock.Call +} + +// IndexField is a helper method to define mock.On call +// - ctx context.Context +// - obj client.Object +// - field string +// - extractValue client.IndexerFunc +func (_e *MockCache_Expecter) IndexField(ctx interface{}, obj interface{}, field interface{}, extractValue interface{}) *MockCache_IndexField_Call { + return &MockCache_IndexField_Call{Call: _e.mock.On("IndexField", ctx, obj, field, extractValue)} +} + +func (_c *MockCache_IndexField_Call) Run(run func(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc)) *MockCache_IndexField_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 client.Object + if args[1] != nil { + arg1 = args[1].(client.Object) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + var arg3 client.IndexerFunc + if args[3] != nil { + arg3 = args[3].(client.IndexerFunc) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockCache_IndexField_Call) Return(err error) *MockCache_IndexField_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_IndexField_Call) RunAndReturn(run func(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error) *MockCache_IndexField_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function for the type MockCache +func (_mock *MockCache) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { + var tmpRet mock.Arguments + if len(opts) > 0 { + tmpRet = _mock.Called(ctx, list, opts) + } else { + tmpRet = _mock.Called(ctx, list) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, client.ObjectList, ...client.ListOption) error); ok { + r0 = returnFunc(ctx, list, opts...) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockCache_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - list client.ObjectList +// - opts ...client.ListOption +func (_e *MockCache_Expecter) List(ctx interface{}, list interface{}, opts ...interface{}) *MockCache_List_Call { + return &MockCache_List_Call{Call: _e.mock.On("List", + append([]interface{}{ctx, list}, opts...)...)} +} + +func (_c *MockCache_List_Call) Run(run func(ctx context.Context, list client.ObjectList, opts ...client.ListOption)) *MockCache_List_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 client.ObjectList + if args[1] != nil { + arg1 = args[1].(client.ObjectList) + } + var arg2 []client.ListOption + var variadicArgs []client.ListOption + if len(args) > 2 { + variadicArgs = args[2].([]client.ListOption) + } + arg2 = variadicArgs + run( + arg0, + arg1, + arg2..., + ) + }) + return _c +} + +func (_c *MockCache_List_Call) Return(err error) *MockCache_List_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_List_Call) RunAndReturn(run func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error) *MockCache_List_Call { + _c.Call.Return(run) + return _c +} + +// RemoveInformer provides a mock function for the type MockCache +func (_mock *MockCache) RemoveInformer(ctx context.Context, obj client.Object) error { + ret := _mock.Called(ctx, obj) + + if len(ret) == 0 { + panic("no return value specified for RemoveInformer") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context, client.Object) error); ok { + r0 = returnFunc(ctx, obj) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_RemoveInformer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveInformer' +type MockCache_RemoveInformer_Call struct { + *mock.Call +} + +// RemoveInformer is a helper method to define mock.On call +// - ctx context.Context +// - obj client.Object +func (_e *MockCache_Expecter) RemoveInformer(ctx interface{}, obj interface{}) *MockCache_RemoveInformer_Call { + return &MockCache_RemoveInformer_Call{Call: _e.mock.On("RemoveInformer", ctx, obj)} +} + +func (_c *MockCache_RemoveInformer_Call) Run(run func(ctx context.Context, obj client.Object)) *MockCache_RemoveInformer_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + var arg1 client.Object + if args[1] != nil { + arg1 = args[1].(client.Object) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockCache_RemoveInformer_Call) Return(err error) *MockCache_RemoveInformer_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_RemoveInformer_Call) RunAndReturn(run func(ctx context.Context, obj client.Object) error) *MockCache_RemoveInformer_Call { + _c.Call.Return(run) + return _c +} + +// Start provides a mock function for the type MockCache +func (_mock *MockCache) Start(ctx context.Context) error { + ret := _mock.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for Start") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = returnFunc(ctx) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockCache_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type MockCache_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockCache_Expecter) Start(ctx interface{}) *MockCache_Start_Call { + return &MockCache_Start_Call{Call: _e.mock.On("Start", ctx)} +} + +func (_c *MockCache_Start_Call) Run(run func(ctx context.Context)) *MockCache_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockCache_Start_Call) Return(err error) *MockCache_Start_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCache_Start_Call) RunAndReturn(run func(ctx context.Context) error) *MockCache_Start_Call { + _c.Call.Return(run) + return _c +} + +// WaitForCacheSync provides a mock function for the type MockCache +func (_mock *MockCache) WaitForCacheSync(ctx context.Context) bool { + ret := _mock.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for WaitForCacheSync") + } + + var r0 bool + if returnFunc, ok := ret.Get(0).(func(context.Context) bool); ok { + r0 = returnFunc(ctx) + } else { + r0 = ret.Get(0).(bool) + } + return r0 +} + +// MockCache_WaitForCacheSync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WaitForCacheSync' +type MockCache_WaitForCacheSync_Call struct { + *mock.Call +} + +// WaitForCacheSync is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockCache_Expecter) WaitForCacheSync(ctx interface{}) *MockCache_WaitForCacheSync_Call { + return &MockCache_WaitForCacheSync_Call{Call: _e.mock.On("WaitForCacheSync", ctx)} +} + +func (_c *MockCache_WaitForCacheSync_Call) Run(run func(ctx context.Context)) *MockCache_WaitForCacheSync_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 context.Context + if args[0] != nil { + arg0 = args[0].(context.Context) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockCache_WaitForCacheSync_Call) Return(b bool) *MockCache_WaitForCacheSync_Call { + _c.Call.Return(b) + return _c +} + +func (_c *MockCache_WaitForCacheSync_Call) RunAndReturn(run func(ctx context.Context) bool) *MockCache_WaitForCacheSync_Call { + _c.Call.Return(run) + return _c +} diff --git a/internal/k8s/mocks/mock_status_metrics.go b/internal/k8s/mocks/mock_status_metrics.go new file mode 100644 index 00000000000..413e8720a87 --- /dev/null +++ b/internal/k8s/mocks/mock_status_metrics.go @@ -0,0 +1,290 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + "time" + + mock "github.com/stretchr/testify/mock" +) + +// NewMockStatusMetrics creates a new instance of MockStatusMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockStatusMetrics(t interface { + mock.TestingT + Cleanup(func()) +}) *MockStatusMetrics { + mock := &MockStatusMetrics{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockStatusMetrics is an autogenerated mock type for the StatusMetrics type +type MockStatusMetrics struct { + mock.Mock +} + +type MockStatusMetrics_Expecter struct { + mock *mock.Mock +} + +func (_m *MockStatusMetrics) EXPECT() *MockStatusMetrics_Expecter { + return &MockStatusMetrics_Expecter{mock: &_m.Mock} +} + +// SetStatusUpdateConflict provides a mock function for the type MockStatusMetrics +func (_mock *MockStatusMetrics) SetStatusUpdateConflict(kind string) { + _mock.Called(kind) + return +} + +// MockStatusMetrics_SetStatusUpdateConflict_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStatusUpdateConflict' +type MockStatusMetrics_SetStatusUpdateConflict_Call struct { + *mock.Call +} + +// SetStatusUpdateConflict is a helper method to define mock.On call +// - kind string +func (_e *MockStatusMetrics_Expecter) SetStatusUpdateConflict(kind interface{}) *MockStatusMetrics_SetStatusUpdateConflict_Call { + return &MockStatusMetrics_SetStatusUpdateConflict_Call{Call: _e.mock.On("SetStatusUpdateConflict", kind)} +} + +func (_c *MockStatusMetrics_SetStatusUpdateConflict_Call) Run(run func(kind string)) *MockStatusMetrics_SetStatusUpdateConflict_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateConflict_Call) Return() *MockStatusMetrics_SetStatusUpdateConflict_Call { + _c.Call.Return() + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateConflict_Call) RunAndReturn(run func(kind string)) *MockStatusMetrics_SetStatusUpdateConflict_Call { + _c.Run(run) + return _c +} + +// SetStatusUpdateDuration provides a mock function for the type MockStatusMetrics +func (_mock *MockStatusMetrics) SetStatusUpdateDuration(duration time.Duration, kind string, onError bool) { + _mock.Called(duration, kind, onError) + return +} + +// MockStatusMetrics_SetStatusUpdateDuration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStatusUpdateDuration' +type MockStatusMetrics_SetStatusUpdateDuration_Call struct { + *mock.Call +} + +// SetStatusUpdateDuration is a helper method to define mock.On call +// - duration time.Duration +// - kind string +// - onError bool +func (_e *MockStatusMetrics_Expecter) SetStatusUpdateDuration(duration interface{}, kind interface{}, onError interface{}) *MockStatusMetrics_SetStatusUpdateDuration_Call { + return &MockStatusMetrics_SetStatusUpdateDuration_Call{Call: _e.mock.On("SetStatusUpdateDuration", duration, kind, onError)} +} + +func (_c *MockStatusMetrics_SetStatusUpdateDuration_Call) Run(run func(duration time.Duration, kind string, onError bool)) *MockStatusMetrics_SetStatusUpdateDuration_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 time.Duration + if args[0] != nil { + arg0 = args[0].(time.Duration) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + var arg2 bool + if args[2] != nil { + arg2 = args[2].(bool) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateDuration_Call) Return() *MockStatusMetrics_SetStatusUpdateDuration_Call { + _c.Call.Return() + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateDuration_Call) RunAndReturn(run func(duration time.Duration, kind string, onError bool)) *MockStatusMetrics_SetStatusUpdateDuration_Call { + _c.Run(run) + return _c +} + +// SetStatusUpdateFailed provides a mock function for the type MockStatusMetrics +func (_mock *MockStatusMetrics) SetStatusUpdateFailed(kind string) { + _mock.Called(kind) + return +} + +// MockStatusMetrics_SetStatusUpdateFailed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStatusUpdateFailed' +type MockStatusMetrics_SetStatusUpdateFailed_Call struct { + *mock.Call +} + +// SetStatusUpdateFailed is a helper method to define mock.On call +// - kind string +func (_e *MockStatusMetrics_Expecter) SetStatusUpdateFailed(kind interface{}) *MockStatusMetrics_SetStatusUpdateFailed_Call { + return &MockStatusMetrics_SetStatusUpdateFailed_Call{Call: _e.mock.On("SetStatusUpdateFailed", kind)} +} + +func (_c *MockStatusMetrics_SetStatusUpdateFailed_Call) Run(run func(kind string)) *MockStatusMetrics_SetStatusUpdateFailed_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateFailed_Call) Return() *MockStatusMetrics_SetStatusUpdateFailed_Call { + _c.Call.Return() + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateFailed_Call) RunAndReturn(run func(kind string)) *MockStatusMetrics_SetStatusUpdateFailed_Call { + _c.Run(run) + return _c +} + +// SetStatusUpdateNoop provides a mock function for the type MockStatusMetrics +func (_mock *MockStatusMetrics) SetStatusUpdateNoop(kind string) { + _mock.Called(kind) + return +} + +// MockStatusMetrics_SetStatusUpdateNoop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStatusUpdateNoop' +type MockStatusMetrics_SetStatusUpdateNoop_Call struct { + *mock.Call +} + +// SetStatusUpdateNoop is a helper method to define mock.On call +// - kind string +func (_e *MockStatusMetrics_Expecter) SetStatusUpdateNoop(kind interface{}) *MockStatusMetrics_SetStatusUpdateNoop_Call { + return &MockStatusMetrics_SetStatusUpdateNoop_Call{Call: _e.mock.On("SetStatusUpdateNoop", kind)} +} + +func (_c *MockStatusMetrics_SetStatusUpdateNoop_Call) Run(run func(kind string)) *MockStatusMetrics_SetStatusUpdateNoop_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateNoop_Call) Return() *MockStatusMetrics_SetStatusUpdateNoop_Call { + _c.Call.Return() + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateNoop_Call) RunAndReturn(run func(kind string)) *MockStatusMetrics_SetStatusUpdateNoop_Call { + _c.Run(run) + return _c +} + +// SetStatusUpdateSuccess provides a mock function for the type MockStatusMetrics +func (_mock *MockStatusMetrics) SetStatusUpdateSuccess(kind string) { + _mock.Called(kind) + return +} + +// MockStatusMetrics_SetStatusUpdateSuccess_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStatusUpdateSuccess' +type MockStatusMetrics_SetStatusUpdateSuccess_Call struct { + *mock.Call +} + +// SetStatusUpdateSuccess is a helper method to define mock.On call +// - kind string +func (_e *MockStatusMetrics_Expecter) SetStatusUpdateSuccess(kind interface{}) *MockStatusMetrics_SetStatusUpdateSuccess_Call { + return &MockStatusMetrics_SetStatusUpdateSuccess_Call{Call: _e.mock.On("SetStatusUpdateSuccess", kind)} +} + +func (_c *MockStatusMetrics_SetStatusUpdateSuccess_Call) Run(run func(kind string)) *MockStatusMetrics_SetStatusUpdateSuccess_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateSuccess_Call) Return() *MockStatusMetrics_SetStatusUpdateSuccess_Call { + _c.Call.Return() + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateSuccess_Call) RunAndReturn(run func(kind string)) *MockStatusMetrics_SetStatusUpdateSuccess_Call { + _c.Run(run) + return _c +} + +// SetStatusUpdateTotal provides a mock function for the type MockStatusMetrics +func (_mock *MockStatusMetrics) SetStatusUpdateTotal(kind string) { + _mock.Called(kind) + return +} + +// MockStatusMetrics_SetStatusUpdateTotal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStatusUpdateTotal' +type MockStatusMetrics_SetStatusUpdateTotal_Call struct { + *mock.Call +} + +// SetStatusUpdateTotal is a helper method to define mock.On call +// - kind string +func (_e *MockStatusMetrics_Expecter) SetStatusUpdateTotal(kind interface{}) *MockStatusMetrics_SetStatusUpdateTotal_Call { + return &MockStatusMetrics_SetStatusUpdateTotal_Call{Call: _e.mock.On("SetStatusUpdateTotal", kind)} +} + +func (_c *MockStatusMetrics_SetStatusUpdateTotal_Call) Run(run func(kind string)) *MockStatusMetrics_SetStatusUpdateTotal_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateTotal_Call) Return() *MockStatusMetrics_SetStatusUpdateTotal_Call { + _c.Call.Return() + return _c +} + +func (_c *MockStatusMetrics_SetStatusUpdateTotal_Call) RunAndReturn(run func(kind string)) *MockStatusMetrics_SetStatusUpdateTotal_Call { + _c.Run(run) + return _c +} diff --git a/internal/k8s/mocks/status_metrics.go b/internal/k8s/mocks/status_metrics.go deleted file mode 100644 index 55f04488e58..00000000000 --- a/internal/k8s/mocks/status_metrics.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import ( - time "time" - - mock "github.com/stretchr/testify/mock" -) - -// StatusMetrics is an autogenerated mock type for the StatusMetrics type -type StatusMetrics struct { - mock.Mock -} - -// SetStatusUpdateConflict provides a mock function with given fields: kind -func (_m *StatusMetrics) SetStatusUpdateConflict(kind string) { - _m.Called(kind) -} - -// SetStatusUpdateDuration provides a mock function with given fields: duration, kind, onError -func (_m *StatusMetrics) SetStatusUpdateDuration(duration time.Duration, kind string, onError bool) { - _m.Called(duration, kind, onError) -} - -// SetStatusUpdateFailed provides a mock function with given fields: kind -func (_m *StatusMetrics) SetStatusUpdateFailed(kind string) { - _m.Called(kind) -} - -// SetStatusUpdateNoop provides a mock function with given fields: kind -func (_m *StatusMetrics) SetStatusUpdateNoop(kind string) { - _m.Called(kind) -} - -// SetStatusUpdateSuccess provides a mock function with given fields: kind -func (_m *StatusMetrics) SetStatusUpdateSuccess(kind string) { - _m.Called(kind) -} - -// SetStatusUpdateTotal provides a mock function with given fields: kind -func (_m *StatusMetrics) SetStatusUpdateTotal(kind string) { - _m.Called(kind) -} - -// NewStatusMetrics creates a new instance of StatusMetrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewStatusMetrics(t interface { - mock.TestingT - Cleanup(func()) -}) *StatusMetrics { - mock := &StatusMetrics{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/internal/k8s/status_test.go b/internal/k8s/status_test.go index 620b4c691bf..80aac1b23aa 100644 --- a/internal/k8s/status_test.go +++ b/internal/k8s/status_test.go @@ -42,7 +42,7 @@ func TestStatusUpdateHandlerApplyOutputsMetrics(t *testing.T) { } c := fake.NewClientBuilder().WithObjects(fooIngress) - mockStatusMetrics := mocks.NewStatusMetrics(t) + mockStatusMetrics := mocks.NewMockStatusMetrics(t) suh := NewStatusUpdateHandler(fixture.NewTestLogger(t), c.Build(), mockStatusMetrics) diff --git a/internal/k8s/statusaddress_test.go b/internal/k8s/statusaddress_test.go index e8bbf88cf18..b5d468a5c75 100644 --- a/internal/k8s/statusaddress_test.go +++ b/internal/k8s/statusaddress_test.go @@ -517,7 +517,7 @@ func TestStatusAddressUpdater_Gateway(t *testing.T) { suc := StatusUpdateCacher{} assert.True(t, suc.Add(tc.preop.Name, tc.preop.Namespace, tc.preop), "unable to add object to cache") - mockCache := &mocks.Cache{} + mockCache := &mocks.MockCache{} mockCache. On("Get", mock.Anything, client.ObjectKey{Name: string(tc.preop.Spec.GatewayClassName)}, mock.Anything). Return(nil) @@ -540,7 +540,7 @@ func TestStatusAddressUpdater_Gateway(t *testing.T) { suc := StatusUpdateCacher{} assert.True(t, suc.Add(tc.preop.Name, tc.preop.Namespace, tc.preop), "unable to add object to cache") - mockCache := &mocks.Cache{} + mockCache := &mocks.MockCache{} mockCache. On("Get", mock.Anything, client.ObjectKey{Name: string(tc.preop.Spec.GatewayClassName)}, mock.Anything). Return(nil) diff --git a/internal/leadership/mocks/mock_need_leader_election_notification.go b/internal/leadership/mocks/mock_need_leader_election_notification.go new file mode 100644 index 00000000000..896ff4196eb --- /dev/null +++ b/internal/leadership/mocks/mock_need_leader_election_notification.go @@ -0,0 +1,69 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockNeedLeaderElectionNotification creates a new instance of MockNeedLeaderElectionNotification. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewMockNeedLeaderElectionNotification(t interface { + mock.TestingT + Cleanup(func()) +}) *MockNeedLeaderElectionNotification { + mock := &MockNeedLeaderElectionNotification{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockNeedLeaderElectionNotification is an autogenerated mock type for the NeedLeaderElectionNotification type +type MockNeedLeaderElectionNotification struct { + mock.Mock +} + +type MockNeedLeaderElectionNotification_Expecter struct { + mock *mock.Mock +} + +func (_m *MockNeedLeaderElectionNotification) EXPECT() *MockNeedLeaderElectionNotification_Expecter { + return &MockNeedLeaderElectionNotification_Expecter{mock: &_m.Mock} +} + +// OnElectedLeader provides a mock function for the type MockNeedLeaderElectionNotification +func (_mock *MockNeedLeaderElectionNotification) OnElectedLeader() { + _mock.Called() + return +} + +// MockNeedLeaderElectionNotification_OnElectedLeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnElectedLeader' +type MockNeedLeaderElectionNotification_OnElectedLeader_Call struct { + *mock.Call +} + +// OnElectedLeader is a helper method to define mock.On call +func (_e *MockNeedLeaderElectionNotification_Expecter) OnElectedLeader() *MockNeedLeaderElectionNotification_OnElectedLeader_Call { + return &MockNeedLeaderElectionNotification_OnElectedLeader_Call{Call: _e.mock.On("OnElectedLeader")} +} + +func (_c *MockNeedLeaderElectionNotification_OnElectedLeader_Call) Run(run func()) *MockNeedLeaderElectionNotification_OnElectedLeader_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockNeedLeaderElectionNotification_OnElectedLeader_Call) Return() *MockNeedLeaderElectionNotification_OnElectedLeader_Call { + _c.Call.Return() + return _c +} + +func (_c *MockNeedLeaderElectionNotification_OnElectedLeader_Call) RunAndReturn(run func()) *MockNeedLeaderElectionNotification_OnElectedLeader_Call { + _c.Run(run) + return _c +} diff --git a/internal/leadership/mocks/need_leader_election_notification.go b/internal/leadership/mocks/need_leader_election_notification.go deleted file mode 100644 index 953eef8e196..00000000000 --- a/internal/leadership/mocks/need_leader_election_notification.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// NeedLeaderElectionNotification is an autogenerated mock type for the NeedLeaderElectionNotification type -type NeedLeaderElectionNotification struct { - mock.Mock -} - -// OnElectedLeader provides a mock function with no fields -func (_m *NeedLeaderElectionNotification) OnElectedLeader() { - _m.Called() -} - -// NewNeedLeaderElectionNotification creates a new instance of NeedLeaderElectionNotification. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewNeedLeaderElectionNotification(t interface { - mock.TestingT - Cleanup(func()) -}) *NeedLeaderElectionNotification { - mock := &NeedLeaderElectionNotification{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/internal/leadership/notifier_test.go b/internal/leadership/notifier_test.go index d1830199b04..8e0e7dcb187 100644 --- a/internal/leadership/notifier_test.go +++ b/internal/leadership/notifier_test.go @@ -27,9 +27,9 @@ import ( ) func TestNotifier(t *testing.T) { - toNotify1 := &mocks.NeedLeaderElectionNotification{} + toNotify1 := &mocks.MockNeedLeaderElectionNotification{} toNotify1.On("OnElectedLeader").Once() - toNotify2 := &mocks.NeedLeaderElectionNotification{} + toNotify2 := &mocks.MockNeedLeaderElectionNotification{} toNotify2.On("OnElectedLeader").Once() notifier := &leadership.Notifier{ diff --git a/tools.go b/tools.go index 5b2a9751851..4ce29652d70 100644 --- a/tools.go +++ b/tools.go @@ -8,7 +8,7 @@ import ( // nolint:typecheck _ "github.com/onsi/ginkgo/v2/ginkgo" // nolint:typecheck - _ "github.com/vektra/mockery/v2" + _ "github.com/vektra/mockery/v3" // nolint:typecheck _ "sigs.k8s.io/controller-tools/cmd/controller-gen" _ "sigs.k8s.io/kustomize/kyaml"