diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 5f74d15bbe..63ea07ec4e 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -181,6 +181,12 @@ 'renovate', ], packageRules: [ + { + matchPackageNames: [ + 'git.sr.ht/~nelsam/hel', + ], + allowedVersions: '< 1.0.0', + }, { matchPackageNames: [ 'earthly/earthly', diff --git a/cmd/earthly/subcmd/cmds_test.go b/cmd/earthly/subcmd/cmds_test.go index baa44983e5..40792b337a 100644 --- a/cmd/earthly/subcmd/cmds_test.go +++ b/cmd/earthly/subcmd/cmds_test.go @@ -5,15 +5,14 @@ import ( "fmt" "testing" + "github.com/EarthBuild/earthbuild/cmd/earthly/app" + "github.com/EarthBuild/earthbuild/cmd/earthly/base" + "github.com/EarthBuild/earthbuild/cmd/earthly/subcmd" "github.com/EarthBuild/earthbuild/conslogging" "github.com/poy/onpar" "github.com/poy/onpar/expect" "github.com/poy/onpar/matchers" "github.com/urfave/cli/v2" - - "github.com/EarthBuild/earthbuild/cmd/earthly/app" - "github.com/EarthBuild/earthbuild/cmd/earthly/base" - "github.com/EarthBuild/earthbuild/cmd/earthly/subcmd" ) func TestRootCmdsHelp(t *testing.T) { @@ -24,7 +23,9 @@ func TestRootCmdsHelp(t *testing.T) { expect expect.Expectation } - o := onpar.BeforeEach(onpar.New(t), func(t *testing.T) testCtx { + o := onpar.New() + + o.BeforeEach(func(t *testing.T) testCtx { t.Helper() return testCtx{ @@ -32,7 +33,7 @@ func TestRootCmdsHelp(t *testing.T) { expect: expect.New(t), } }) - defer o.Run() + defer o.Run(t) ctx := context.TODO() newCLI := base.NewCLI(conslogging.ConsoleLogger{}, @@ -48,16 +49,13 @@ func TestRootCmdsHelp(t *testing.T) { rootCLI := app.BaseCLI.App().Commands - usageChecks := onpar.TableSpec(o, func(tt testCtx, cmd *cli.Command) { - tt.expect(cmd.Usage).To(matchers.Not(matchers.EndWith("."))) - }) - descChecks := onpar.TableSpec(o, func(tt testCtx, cmd *cli.Command) { - tt.expect(cmd.Description).To(matchers.EndWith(".")) - }) - - for _, subCmd := range checkSubCommands(rootCLI) { - usageChecks.Entry(fmt.Sprintf("Help usage for %s should not end with '.'", subCmd.Name), subCmd) - descChecks.Entry(fmt.Sprintf("Help description for %s should end with '.'", subCmd.Name), subCmd) + for _, cmd := range checkSubCommands(rootCLI) { + o.Spec(fmt.Sprintf("Help usage for %s should not end with '.'", cmd.Name), func(tt testCtx) { + tt.expect(cmd.Usage).To(matchers.Not(matchers.EndWith("."))) + }) + o.Spec(fmt.Sprintf("Help description for %s should end with '.'", cmd.Name), func(tt testCtx) { + tt.expect(cmd.Description).To(matchers.EndWith(".")) + }) } } diff --git a/go.mod b/go.mod index 59a27a0395..2d52a75337 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.25 require ( al.essio.dev/pkg/shellescape v1.6.0 - git.sr.ht/~nelsam/hel v0.6.6 + git.sr.ht/~nelsam/hel v0.9.0 github.com/adrg/xdg v0.5.3 github.com/alexcb/binarystream v0.0.0-20231130184431-f2f7a7543c6d github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230219212500-1f9a474cc2dc @@ -39,7 +39,7 @@ require ( github.com/opencontainers/image-spec v1.1.1 github.com/otiai10/copy v1.14.1 github.com/pkg/errors v0.9.1 - github.com/poy/onpar v0.3.5 + github.com/poy/onpar v1.1.2 github.com/sirupsen/logrus v1.9.4 github.com/stretchr/testify v1.11.1 github.com/tonistiigi/fsutil v0.0.0-20230825212630-f09800878302 @@ -55,7 +55,7 @@ require ( ) require ( - git.sr.ht/~nelsam/correct v0.0.5 // indirect + git.sr.ht/~nelsam/correct v0.1.1 // indirect github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/Microsoft/hcsshim v0.11.7 // indirect diff --git a/go.sum b/go.sum index f274372f2b..e77940e627 100644 --- a/go.sum +++ b/go.sum @@ -5,10 +5,10 @@ cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -git.sr.ht/~nelsam/correct v0.0.5 h1:99VgixW0fQBEnr48+yQy4U4pfcTpI/4wIMDy1q+r00c= -git.sr.ht/~nelsam/correct v0.0.5/go.mod h1:m/urdFD4XS5ULMnod9lCHbVKxVA7vU+uADq+BMZ3C2o= -git.sr.ht/~nelsam/hel v0.6.6 h1:5AJQPKZa9Y6ThwkfvdlxJKjOPEjT7rYqBsh+F1PKISI= -git.sr.ht/~nelsam/hel v0.6.6/go.mod h1:aAXF8r8V5vtry0o9Lk7jIJB5yW8RNqu9Hg/L5OilVF4= +git.sr.ht/~nelsam/correct v0.1.1 h1:DOIoaI1fwOqiBI3bA+24ZqLTwhKXeTFSUj1PyuIf7N4= +git.sr.ht/~nelsam/correct v0.1.1/go.mod h1:ftLUfw6zfxcpnS9LQQe/7FiOGey3m/iF46olkT53uwE= +git.sr.ht/~nelsam/hel v0.9.0 h1:j98FaW40jlSvQbUKqEdvEEgX9WEekDz9Kfz/fsRpSa4= +git.sr.ht/~nelsam/hel v0.9.0/go.mod h1:fsyI8ZSTf9VPVb2vlXFE1iVO7a6ErQHUgx419Y4nKO8= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 h1:59MxjQVfjXsBpLy+dbd2/ELV5ofnUkUZBvWSC85sheA= @@ -21,10 +21,14 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Microsoft/hcsshim v0.11.7 h1:vl/nj3Bar/CvJSYo7gIQPyRWc9f3c6IeSNavBTSZNZQ= github.com/Microsoft/hcsshim v0.11.7/go.mod h1:MV8xMfmECjl5HdO7U/3/hFVnkmSBjAjmA09d4bExKcU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/a8m/expect v1.0.0/go.mod h1:4IwSCMumY49ScypDnjNbYEjgVeqy1/U2cEs3Lat96eA= github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78= github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alexcb/binarystream v0.0.0-20231130184431-f2f7a7543c6d h1:ju0cQEdndxS7qyRPkwf0lkqD7fyVv6jHuwELISNZSwk= github.com/alexcb/binarystream v0.0.0-20231130184431-f2f7a7543c6d/go.mod h1:zKsqqCtJopbsBYivUZGuK3Tc6fFxvNUrjUJzGtxksq4= github.com/alexcb/go-flags v0.0.0-20210722203016-f11d7ecb5ee5 h1:im0niQRZXdxO8F1rw4zwb5rJmOJ9XnNtlnMFyfLenYE= @@ -33,6 +37,7 @@ github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 h1:aM1 github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230219212500-1f9a474cc2dc h1:ikxgKfnYm4kXCOohe1uCkVFwZcABDZbVsqginko+GY8= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230219212500-1f9a474cc2dc/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/aws/aws-sdk-go-v2 v1.41.1 h1:ABlyEARCDLN034NhxlRUSZr4l71mh+T5KAeGh6cerhU= github.com/aws/aws-sdk-go-v2 v1.41.1/go.mod h1:MayyLB8y+buD9hZqkCW3kX1AKq07Y5pXxtgB+rRFhz0= github.com/aws/aws-sdk-go-v2/config v1.32.7 h1:vxUyWGUwmkQ2g19n7JY/9YL8MfAIl7bTesIUykECXmY= @@ -62,7 +67,10 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.41.6/go.mod h1:qgFDZQSD/Kys7nJnVqYlW github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk= github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b h1:ga8SEFjZ60pxLcmhnThWgvH2wg8376yUJmPhEH4H3kw= @@ -98,6 +106,12 @@ github.com/containerd/ttrpc v1.2.7 h1:qIrroQvuOL9HQ1X6KHe2ohc7p+HP/0VE6XPU7elJRq github.com/containerd/ttrpc v1.2.7/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o= github.com/containerd/typeurl/v2 v2.1.1 h1:3Q4Pt7i8nYwy2KmQWIw2+1hTvwTE/6w9FqcttATPO/4= github.com/containerd/typeurl/v2 v2.1.1/go.mod h1:IDp2JFvbwZ31H8dQbEIY7sDl2L3o3HZj1hsSQlywkQ0= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= @@ -106,6 +120,8 @@ github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfv github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v29.1.5+incompatible h1:GckbANUt3j+lsnQ6eCcQd70mNSOismSHWt8vk2AX8ao= @@ -138,11 +154,17 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= @@ -154,18 +176,23 @@ github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -174,8 +201,12 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaU github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -185,17 +216,23 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/in-toto/in-toto-golang v0.5.0 h1:hb8bgwr0M2hGdDsLjkJ3ZqJ8JFLL/tgYdAxF/XEFBbY= github.com/in-toto/in-toto-golang v0.5.0/go.mod h1:/Rq0IZHLV7Ku5gielPT4wPHJfH1GdHMCq8+WPxw8/BE= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -205,14 +242,21 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= 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/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mikejholly/netrc v0.0.0-20221121193719-a154cb29ec2a h1:1XyP7Y19inZMSHUVJv1GSWLGag2xz/MUPzS54rQs42Y= github.com/mikejholly/netrc v0.0.0-20221121193719-a154cb29ec2a/go.mod h1:Zi/ZFkEqFHTm7qkjyNJjaWH4LQA9LQhGJyF0lTYGpxw= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 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/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= @@ -231,7 +275,11 @@ github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nelsam/hel/v2 v2.3.2 h1:tXRsJBqRxj4ISSPCrXhbqF8sT+BXA/UaIvjhYjP5Bhk= +github.com/nelsam/hel/v2 v2.3.2/go.mod h1:1ZTGfU2PFTOd5mx22i5O0Lc2GY933lQ2wb/ggy+rL3w= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 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/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= @@ -247,32 +295,56 @@ github.com/otiai10/copy v1.14.1 h1:5/7E6qsUMBaH5AnQ0sSLzzTg1oTECmcCmT6lvF45Na8= github.com/otiai10/copy v1.14.1/go.mod h1:oQwrEDDOci3IM8dJF0d8+jnbfPDllW6vUjNc3DoZm9I= github.com/otiai10/mint v1.6.3 h1:87qsV/aw1F5as1eH1zS/yqHY85ANKVMgkDrf9rcxbQs= github.com/otiai10/mint v1.6.3/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/poy/onpar v0.3.5 h1:AYOT1AvNtucJhmEK6BSD1KvLvtYXvp/50vL5yaPAljo= -github.com/poy/onpar v0.3.5/go.mod h1:Ae6eC73WNjI7NHdcughszLtcw+msOi0pb6eq6LzL97o= +github.com/poy/onpar v0.0.0-20200406201722-06f95a1c68e8/go.mod h1:nSbFQvMj97ZyhFRSJYtut+msi4sOY6zJDGCdSc+/rZU= +github.com/poy/onpar v1.1.2 h1:QaNrNiZx0+Nar5dLgTVp5mXkyoVFIbepjyEoGSnhbAY= +github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 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/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE= github.com/secure-systems-lab/go-securesystemslib v0.4.0/go.mod h1:FGBZgq2tXWICsxWQW1msNf49F0Pf2Op5Htayx335Qbs= github.com/shibumi/go-pathspec v1.3.0 h1:QUyMZhFo0Md5B8zV8x2tesohbb5kfbpTi9rBnKh5dkI= github.com/shibumi/go-pathspec v1.3.0/go.mod h1:Xutfslp817l2I1cZvgcfeMQJG5QnU2lh5tVaaMCl3jE= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spdx/tools-golang v0.5.1 h1:fJg3SVOGG+eIva9ZUBm/hvyA7PIPVFjRxUKe6fdAgwE= github.com/spdx/tools-golang v0.5.1/go.mod h1:/DRDQuBfB37HctM29YtrX1v+bXiVmT2OpQDalRmX9aU= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -288,19 +360,25 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 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/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea h1:SXhTLE6pb6eld/v/cCndK0AMpt1wiVFb/YYmqB3/QG0= github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea/go.mod h1:WPnis/6cRcDZSUvVmezrxJPkiO87ThFYsoUiMwWNDJk= github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531 h1:Y/M5lygoNPKwVNLMPXgVfsRT40CSFKXCxuU8LoHySjs= github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8= github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU= github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4= github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RVck= github.com/vbatts/tar-split v0.11.3/go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXSTY7wGrAokY= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo= go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= @@ -325,12 +403,16 @@ go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJr go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -347,9 +429,12 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -360,15 +445,21 @@ golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= 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-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -385,8 +476,10 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -394,6 +487,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200313205530-4303120df7d8/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= @@ -413,6 +507,7 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go. google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda h1:i/Q+bfisr7gq6feoJnS/DlpdwEL4ihp41fvRiM3Ork0= google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -423,11 +518,14 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/util/llbutil/authprovider/helheim_mocks_test.go b/util/llbutil/authprovider/helheim_mocks_test.go index 19a4680cc1..bab2baa502 100644 --- a/util/llbutil/authprovider/helheim_mocks_test.go +++ b/util/llbutil/authprovider/helheim_mocks_test.go @@ -9,311 +9,394 @@ package authprovider_test import ( "context" + "git.sr.ht/~nelsam/hel/pkg/pers" + "git.sr.ht/~nelsam/hel/vegr" + "github.com/moby/buildkit/session/auth" "io" "time" +) - "git.sr.ht/~nelsam/hel/vegr" - "github.com/moby/buildkit/session/auth" +var ( + _ = vegr.EnforceVersion(7 - vegr.MinVersion) + _ = vegr.EnforceVersion(vegr.MaxVersion - 7) ) -type mockProjectAdder struct { - t vegr.T - timeout time.Duration - AddProjectCalled chan bool - AddProjectInput struct { - Org, Project chan string - } +type mockChild_Credentials_In struct { + Arg0 context.Context + Arg1 *auth.CredentialsRequest } -func newMockProjectAdder(t vegr.T, timeout time.Duration) *mockProjectAdder { - m := &mockProjectAdder{t: t, timeout: timeout} - m.AddProjectCalled = make(chan bool, 100) - m.AddProjectInput.Org = make(chan string, 100) - m.AddProjectInput.Project = make(chan string, 100) - return m +func (mockChild_Credentials_In) Variadic() bool { + return false } -func (m *mockProjectAdder) AddProject(org, project string) { - m.t.Helper() - m.AddProjectCalled <- true - m.AddProjectInput.Org <- org - m.AddProjectInput.Project <- project + +type mockChild_Credentials_Out struct { + Panic_ any + Ret0 *auth.CredentialsResponse + Ret1 error +} +type mockChild_Credentials struct { + vegr.Method[mockChild_Credentials_In, mockChild_Credentials_Out] +} +type mockChild_FetchToken_In struct { + Arg0 context.Context + Arg1 *auth.FetchTokenRequest +} + +func (mockChild_FetchToken_In) Variadic() bool { + return false +} + +type mockChild_FetchToken_Out struct { + Panic_ any + Ret0 *auth.FetchTokenResponse + Ret1 error +} +type mockChild_FetchToken struct { + vegr.Method[mockChild_FetchToken_In, mockChild_FetchToken_Out] +} +type mockChild_GetTokenAuthority_In struct { + Arg0 context.Context + Arg1 *auth.GetTokenAuthorityRequest +} + +func (mockChild_GetTokenAuthority_In) Variadic() bool { + return false +} + +type mockChild_GetTokenAuthority_Out struct { + Panic_ any + Ret0 *auth.GetTokenAuthorityResponse + Ret1 error +} +type mockChild_GetTokenAuthority struct { + vegr.Method[mockChild_GetTokenAuthority_In, mockChild_GetTokenAuthority_Out] +} +type mockChild_VerifyTokenAuthority_In struct { + Arg0 context.Context + Arg1 *auth.VerifyTokenAuthorityRequest } +func (mockChild_VerifyTokenAuthority_In) Variadic() bool { + return false +} + +type mockChild_VerifyTokenAuthority_Out struct { + Panic_ any + Ret0 *auth.VerifyTokenAuthorityResponse + Ret1 error +} +type mockChild_VerifyTokenAuthority struct { + vegr.Method[mockChild_VerifyTokenAuthority_In, mockChild_VerifyTokenAuthority_Out] +} type mockChild struct { - t vegr.T - timeout time.Duration - CredentialsCalled chan bool - CredentialsInput struct { - Arg0 chan context.Context - Arg1 chan *auth.CredentialsRequest - } - CredentialsOutput struct { - Ret0 chan *auth.CredentialsResponse - Ret1 chan error - } - FetchTokenCalled chan bool - FetchTokenInput struct { - Arg0 chan context.Context - Arg1 chan *auth.FetchTokenRequest - } - FetchTokenOutput struct { - Ret0 chan *auth.FetchTokenResponse - Ret1 chan error - } - GetTokenAuthorityCalled chan bool - GetTokenAuthorityInput struct { - Arg0 chan context.Context - Arg1 chan *auth.GetTokenAuthorityRequest - } - GetTokenAuthorityOutput struct { - Ret0 chan *auth.GetTokenAuthorityResponse - Ret1 chan error - } - VerifyTokenAuthorityCalled chan bool - VerifyTokenAuthorityInput struct { - Arg0 chan context.Context - Arg1 chan *auth.VerifyTokenAuthorityRequest - } - VerifyTokenAuthorityOutput struct { - Ret0 chan *auth.VerifyTokenAuthorityResponse - Ret1 chan error + prefs vegr.Prefs + method struct { + Credentials mockChild_Credentials + FetchToken mockChild_FetchToken + GetTokenAuthority mockChild_GetTokenAuthority + VerifyTokenAuthority mockChild_VerifyTokenAuthority } } -func newMockChild(t vegr.T, timeout time.Duration) *mockChild { - m := &mockChild{t: t, timeout: timeout} - m.CredentialsCalled = make(chan bool, 100) - m.CredentialsInput.Arg0 = make(chan context.Context, 100) - m.CredentialsInput.Arg1 = make(chan *auth.CredentialsRequest, 100) - m.CredentialsOutput.Ret0 = make(chan *auth.CredentialsResponse, 100) - m.CredentialsOutput.Ret1 = make(chan error, 100) - m.FetchTokenCalled = make(chan bool, 100) - m.FetchTokenInput.Arg0 = make(chan context.Context, 100) - m.FetchTokenInput.Arg1 = make(chan *auth.FetchTokenRequest, 100) - m.FetchTokenOutput.Ret0 = make(chan *auth.FetchTokenResponse, 100) - m.FetchTokenOutput.Ret1 = make(chan error, 100) - m.GetTokenAuthorityCalled = make(chan bool, 100) - m.GetTokenAuthorityInput.Arg0 = make(chan context.Context, 100) - m.GetTokenAuthorityInput.Arg1 = make(chan *auth.GetTokenAuthorityRequest, 100) - m.GetTokenAuthorityOutput.Ret0 = make(chan *auth.GetTokenAuthorityResponse, 100) - m.GetTokenAuthorityOutput.Ret1 = make(chan error, 100) - m.VerifyTokenAuthorityCalled = make(chan bool, 100) - m.VerifyTokenAuthorityInput.Arg0 = make(chan context.Context, 100) - m.VerifyTokenAuthorityInput.Arg1 = make(chan *auth.VerifyTokenAuthorityRequest, 100) - m.VerifyTokenAuthorityOutput.Ret0 = make(chan *auth.VerifyTokenAuthorityResponse, 100) - m.VerifyTokenAuthorityOutput.Ret1 = make(chan error, 100) +func newMockChild(cst pers.Constructor) *mockChild { + m := &mockChild{prefs: vegr.MakePrefs(cst)} + m.method.Credentials.Method = vegr.NewMethod[mockChild_Credentials_In, mockChild_Credentials_Out]("mockChild", "Credentials", 100, vegr.WithPrefs(m.prefs)) + m.method.FetchToken.Method = vegr.NewMethod[mockChild_FetchToken_In, mockChild_FetchToken_Out]("mockChild", "FetchToken", 100, vegr.WithPrefs(m.prefs)) + m.method.GetTokenAuthority.Method = vegr.NewMethod[mockChild_GetTokenAuthority_In, mockChild_GetTokenAuthority_Out]("mockChild", "GetTokenAuthority", 100, vegr.WithPrefs(m.prefs)) + m.method.VerifyTokenAuthority.Method = vegr.NewMethod[mockChild_VerifyTokenAuthority_In, mockChild_VerifyTokenAuthority_Out]("mockChild", "VerifyTokenAuthority", 100, vegr.WithPrefs(m.prefs)) return m } func (m *mockChild) Credentials(arg0 context.Context, arg1 *auth.CredentialsRequest) (ret0 *auth.CredentialsResponse, ret1 error) { - m.t.Helper() - m.CredentialsCalled <- true - m.CredentialsInput.Arg0 <- arg0 - m.CredentialsInput.Arg1 <- arg1 - vegr.PopulateReturns(m.t, "Credentials", m.timeout, m.CredentialsOutput, &ret0, &ret1) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Credentials, mockChild_Credentials_In{Arg0: arg0, Arg1: arg1}, &ret0, &ret1) return ret0, ret1 } func (m *mockChild) FetchToken(arg0 context.Context, arg1 *auth.FetchTokenRequest) (ret0 *auth.FetchTokenResponse, ret1 error) { - m.t.Helper() - m.FetchTokenCalled <- true - m.FetchTokenInput.Arg0 <- arg0 - m.FetchTokenInput.Arg1 <- arg1 - vegr.PopulateReturns(m.t, "FetchToken", m.timeout, m.FetchTokenOutput, &ret0, &ret1) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.FetchToken, mockChild_FetchToken_In{Arg0: arg0, Arg1: arg1}, &ret0, &ret1) return ret0, ret1 } func (m *mockChild) GetTokenAuthority(arg0 context.Context, arg1 *auth.GetTokenAuthorityRequest) (ret0 *auth.GetTokenAuthorityResponse, ret1 error) { - m.t.Helper() - m.GetTokenAuthorityCalled <- true - m.GetTokenAuthorityInput.Arg0 <- arg0 - m.GetTokenAuthorityInput.Arg1 <- arg1 - vegr.PopulateReturns(m.t, "GetTokenAuthority", m.timeout, m.GetTokenAuthorityOutput, &ret0, &ret1) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.GetTokenAuthority, mockChild_GetTokenAuthority_In{Arg0: arg0, Arg1: arg1}, &ret0, &ret1) return ret0, ret1 } func (m *mockChild) VerifyTokenAuthority(arg0 context.Context, arg1 *auth.VerifyTokenAuthorityRequest) (ret0 *auth.VerifyTokenAuthorityResponse, ret1 error) { - m.t.Helper() - m.VerifyTokenAuthorityCalled <- true - m.VerifyTokenAuthorityInput.Arg0 <- arg0 - m.VerifyTokenAuthorityInput.Arg1 <- arg1 - vegr.PopulateReturns(m.t, "VerifyTokenAuthority", m.timeout, m.VerifyTokenAuthorityOutput, &ret0, &ret1) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.VerifyTokenAuthority, mockChild_VerifyTokenAuthority_In{Arg0: arg0, Arg1: arg1}, &ret0, &ret1) return ret0, ret1 } -type mockOS struct { - t vegr.T - timeout time.Duration - OpenCalled chan bool - OpenInput struct { - Arg0 chan string - } - OpenOutput struct { - Ret0 chan io.ReadCloser - Ret1 chan error - } - GetenvCalled chan bool - GetenvInput struct { - Arg0 chan string - } - GetenvOutput struct { - Ret0 chan string - } +type mockContext_Deadline_In struct { } -func newMockOS(t vegr.T, timeout time.Duration) *mockOS { - m := &mockOS{t: t, timeout: timeout} - m.OpenCalled = make(chan bool, 100) - m.OpenInput.Arg0 = make(chan string, 100) - m.OpenOutput.Ret0 = make(chan io.ReadCloser, 100) - m.OpenOutput.Ret1 = make(chan error, 100) - m.GetenvCalled = make(chan bool, 100) - m.GetenvInput.Arg0 = make(chan string, 100) - m.GetenvOutput.Ret0 = make(chan string, 100) - return m +func (mockContext_Deadline_In) Variadic() bool { + return false } -func (m *mockOS) Open(arg0 string) (ret0 io.ReadCloser, ret1 error) { - m.t.Helper() - m.OpenCalled <- true - m.OpenInput.Arg0 <- arg0 - vegr.PopulateReturns(m.t, "Open", m.timeout, m.OpenOutput, &ret0, &ret1) - return ret0, ret1 + +type mockContext_Deadline_Out struct { + Panic_ any + Deadline time.Time + Ok bool } -func (m *mockOS) Getenv(arg0 string) (ret0 string) { - m.t.Helper() - m.GetenvCalled <- true - m.GetenvInput.Arg0 <- arg0 - vegr.PopulateReturns(m.t, "Getenv", m.timeout, m.GetenvOutput, &ret0) - return ret0 +type mockContext_Deadline struct { + vegr.Method[mockContext_Deadline_In, mockContext_Deadline_Out] +} +type mockContext_Done_In struct { } +func (mockContext_Done_In) Variadic() bool { + return false +} + +type mockContext_Done_Out struct { + Panic_ any + Ret0 <-chan struct{} +} +type mockContext_Done struct { + vegr.Method[mockContext_Done_In, mockContext_Done_Out] +} +type mockContext_Err_In struct { +} + +func (mockContext_Err_In) Variadic() bool { + return false +} + +type mockContext_Err_Out struct { + Panic_ any + Ret0 error +} +type mockContext_Err struct { + vegr.Method[mockContext_Err_In, mockContext_Err_Out] +} +type mockContext_Value_In struct { + Key any +} + +func (mockContext_Value_In) Variadic() bool { + return false +} + +type mockContext_Value_Out struct { + Panic_ any + Ret0 any +} +type mockContext_Value struct { + vegr.Method[mockContext_Value_In, mockContext_Value_Out] +} type mockContext struct { - t vegr.T - timeout time.Duration - DeadlineCalled chan bool - DeadlineOutput struct { - Deadline chan time.Time - Ok chan bool - } - DoneCalled chan bool - DoneOutput struct { - Ret0 chan (<-chan struct{}) - } - ErrCalled chan bool - ErrOutput struct { - Ret0 chan error - } - ValueCalled chan bool - ValueInput struct { - Key chan any - } - ValueOutput struct { - Ret0 chan any + prefs vegr.Prefs + method struct { + Deadline mockContext_Deadline + Done mockContext_Done + Err mockContext_Err + Value mockContext_Value } } -func newMockContext(t vegr.T, timeout time.Duration) *mockContext { - m := &mockContext{t: t, timeout: timeout} - m.DeadlineCalled = make(chan bool, 100) - m.DeadlineOutput.Deadline = make(chan time.Time, 100) - m.DeadlineOutput.Ok = make(chan bool, 100) - m.DoneCalled = make(chan bool, 100) - m.DoneOutput.Ret0 = make(chan (<-chan struct{}), 100) - m.ErrCalled = make(chan bool, 100) - m.ErrOutput.Ret0 = make(chan error, 100) - m.ValueCalled = make(chan bool, 100) - m.ValueInput.Key = make(chan any, 100) - m.ValueOutput.Ret0 = make(chan any, 100) +func newMockContext(cst pers.Constructor) *mockContext { + m := &mockContext{prefs: vegr.MakePrefs(cst)} + m.method.Deadline.Method = vegr.NewMethod[mockContext_Deadline_In, mockContext_Deadline_Out]("mockContext", "Deadline", 100, vegr.WithPrefs(m.prefs)) + m.method.Done.Method = vegr.NewMethod[mockContext_Done_In, mockContext_Done_Out]("mockContext", "Done", 100, vegr.WithPrefs(m.prefs)) + m.method.Err.Method = vegr.NewMethod[mockContext_Err_In, mockContext_Err_Out]("mockContext", "Err", 100, vegr.WithPrefs(m.prefs)) + m.method.Value.Method = vegr.NewMethod[mockContext_Value_In, mockContext_Value_Out]("mockContext", "Value", 100, vegr.WithPrefs(m.prefs)) return m } func (m *mockContext) Deadline() (deadline time.Time, ok bool) { - m.t.Helper() - m.DeadlineCalled <- true - vegr.PopulateReturns(m.t, "Deadline", m.timeout, m.DeadlineOutput, &deadline, &ok) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Deadline, mockContext_Deadline_In{}, &deadline, &ok) return deadline, ok } func (m *mockContext) Done() (ret0 <-chan struct{}) { - m.t.Helper() - m.DoneCalled <- true - vegr.PopulateReturns(m.t, "Done", m.timeout, m.DoneOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Done, mockContext_Done_In{}, &ret0) return ret0 } func (m *mockContext) Err() (ret0 error) { - m.t.Helper() - m.ErrCalled <- true - vegr.PopulateReturns(m.t, "Err", m.timeout, m.ErrOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Err, mockContext_Err_In{}, &ret0) return ret0 } func (m *mockContext) Value(key any) (ret0 any) { - m.t.Helper() - m.ValueCalled <- true - m.ValueInput.Key <- key - vegr.PopulateReturns(m.t, "Value", m.timeout, m.ValueOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Value, mockContext_Value_In{Key: key}, &ret0) return ret0 } -type mockReadCloser struct { - t vegr.T - timeout time.Duration - ReadCalled chan bool - ReadInput struct { - P chan []byte +type mockProjectAdder_AddProject_In struct { + Org, Project string +} + +func (mockProjectAdder_AddProject_In) Variadic() bool { + return false +} + +type mockProjectAdder_AddProject_Out struct { + Panic_ any +} +type mockProjectAdder_AddProject struct { + vegr.Method[mockProjectAdder_AddProject_In, mockProjectAdder_AddProject_Out] +} +type mockProjectAdder struct { + prefs vegr.Prefs + method struct { + AddProject mockProjectAdder_AddProject } - ReadOutput struct { - N chan int - Err chan error +} + +func newMockProjectAdder(cst pers.Constructor) *mockProjectAdder { + m := &mockProjectAdder{prefs: vegr.MakePrefs(cst)} + m.method.AddProject.Method = vegr.NewMethod[mockProjectAdder_AddProject_In, mockProjectAdder_AddProject_Out]("mockProjectAdder", "AddProject", 100, vegr.WithPrefs(m.prefs)) + return m +} +func (m *mockProjectAdder) AddProject(org, project string) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.AddProject, mockProjectAdder_AddProject_In{Org: org, Project: project}) +} + +type mockOS_Open_In struct { + Arg0 string +} + +func (mockOS_Open_In) Variadic() bool { + return false +} + +type mockOS_Open_Out struct { + Panic_ any + Ret0 io.ReadCloser + Ret1 error +} +type mockOS_Open struct { + vegr.Method[mockOS_Open_In, mockOS_Open_Out] +} +type mockOS_Getenv_In struct { + Arg0 string +} + +func (mockOS_Getenv_In) Variadic() bool { + return false +} + +type mockOS_Getenv_Out struct { + Panic_ any + Ret0 string +} +type mockOS_Getenv struct { + vegr.Method[mockOS_Getenv_In, mockOS_Getenv_Out] +} +type mockOS struct { + prefs vegr.Prefs + method struct { + Open mockOS_Open + Getenv mockOS_Getenv } - CloseCalled chan bool - CloseOutput struct { - Ret0 chan error +} + +func newMockOS(cst pers.Constructor) *mockOS { + m := &mockOS{prefs: vegr.MakePrefs(cst)} + m.method.Open.Method = vegr.NewMethod[mockOS_Open_In, mockOS_Open_Out]("mockOS", "Open", 100, vegr.WithPrefs(m.prefs)) + m.method.Getenv.Method = vegr.NewMethod[mockOS_Getenv_In, mockOS_Getenv_Out]("mockOS", "Getenv", 100, vegr.WithPrefs(m.prefs)) + return m +} +func (m *mockOS) Open(arg0 string) (ret0 io.ReadCloser, ret1 error) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Open, mockOS_Open_In{Arg0: arg0}, &ret0, &ret1) + return ret0, ret1 +} +func (m *mockOS) Getenv(arg0 string) (ret0 string) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Getenv, mockOS_Getenv_In{Arg0: arg0}, &ret0) + return ret0 +} + +type mockReadCloser_Read_In struct { + P []byte +} + +func (mockReadCloser_Read_In) Variadic() bool { + return false +} + +type mockReadCloser_Read_Out struct { + Panic_ any + N int + Err error +} +type mockReadCloser_Read struct { + vegr.Method[mockReadCloser_Read_In, mockReadCloser_Read_Out] +} +type mockReadCloser_Close_In struct { +} + +func (mockReadCloser_Close_In) Variadic() bool { + return false +} + +type mockReadCloser_Close_Out struct { + Panic_ any + Ret0 error +} +type mockReadCloser_Close struct { + vegr.Method[mockReadCloser_Close_In, mockReadCloser_Close_Out] +} +type mockReadCloser struct { + prefs vegr.Prefs + method struct { + Read mockReadCloser_Read + Close mockReadCloser_Close } } -func newMockReadCloser(t vegr.T, timeout time.Duration) *mockReadCloser { - m := &mockReadCloser{t: t, timeout: timeout} - m.ReadCalled = make(chan bool, 100) - m.ReadInput.P = make(chan []byte, 100) - m.ReadOutput.N = make(chan int, 100) - m.ReadOutput.Err = make(chan error, 100) - m.CloseCalled = make(chan bool, 100) - m.CloseOutput.Ret0 = make(chan error, 100) +func newMockReadCloser(cst pers.Constructor) *mockReadCloser { + m := &mockReadCloser{prefs: vegr.MakePrefs(cst)} + m.method.Read.Method = vegr.NewMethod[mockReadCloser_Read_In, mockReadCloser_Read_Out]("mockReadCloser", "Read", 100, vegr.WithPrefs(m.prefs)) + m.method.Close.Method = vegr.NewMethod[mockReadCloser_Close_In, mockReadCloser_Close_Out]("mockReadCloser", "Close", 100, vegr.WithPrefs(m.prefs)) return m } func (m *mockReadCloser) Read(p []byte) (n int, err error) { - m.t.Helper() - m.ReadCalled <- true - m.ReadInput.P <- p - vegr.PopulateReturns(m.t, "Read", m.timeout, m.ReadOutput, &n, &err) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Read, mockReadCloser_Read_In{P: p}, &n, &err) return n, err } func (m *mockReadCloser) Close() (ret0 error) { - m.t.Helper() - m.CloseCalled <- true - vegr.PopulateReturns(m.t, "Close", m.timeout, m.CloseOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Close, mockReadCloser_Close_In{}, &ret0) return ret0 } +type mockWriter_Write_In struct { + P []byte +} + +func (mockWriter_Write_In) Variadic() bool { + return false +} + +type mockWriter_Write_Out struct { + Panic_ any + N int + Err error +} +type mockWriter_Write struct { + vegr.Method[mockWriter_Write_In, mockWriter_Write_Out] +} type mockWriter struct { - t vegr.T - timeout time.Duration - WriteCalled chan bool - WriteInput struct { - P chan []byte - } - WriteOutput struct { - N chan int - Err chan error + prefs vegr.Prefs + method struct { + Write mockWriter_Write } } -func newMockWriter(t vegr.T, timeout time.Duration) *mockWriter { - m := &mockWriter{t: t, timeout: timeout} - m.WriteCalled = make(chan bool, 100) - m.WriteInput.P = make(chan []byte, 100) - m.WriteOutput.N = make(chan int, 100) - m.WriteOutput.Err = make(chan error, 100) +func newMockWriter(cst pers.Constructor) *mockWriter { + m := &mockWriter{prefs: vegr.MakePrefs(cst)} + m.method.Write.Method = vegr.NewMethod[mockWriter_Write_In, mockWriter_Write_Out]("mockWriter", "Write", 100, vegr.WithPrefs(m.prefs)) return m } func (m *mockWriter) Write(p []byte) (n int, err error) { - m.t.Helper() - m.WriteCalled <- true - m.WriteInput.P <- p - vegr.PopulateReturns(m.t, "Write", m.timeout, m.WriteOutput, &n, &err) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Write, mockWriter_Write_In{P: p}, &n, &err) return n, err } diff --git a/util/llbutil/authprovider/multiauthprovider_test.go b/util/llbutil/authprovider/multiauthprovider_test.go index bf089bf5d5..aa47d7c021 100644 --- a/util/llbutil/authprovider/multiauthprovider_test.go +++ b/util/llbutil/authprovider/multiauthprovider_test.go @@ -32,12 +32,14 @@ func TestMultiAuth(t *testing.T) { children []*mockChild } - o := onpar.BeforeEach(onpar.New(t), func(t *testing.T) testCtx { + o := onpar.New() + + o.BeforeEach(func(t *testing.T) testCtx { t.Helper() children := []*mockChild{ - newMockChild(t, mockTimeout), - newMockChild(t, mockTimeout), + newMockChild(pers.WithTimeout(t, mockTimeout)), + newMockChild(pers.WithTimeout(t, mockTimeout)), } srv := make([]authprovider.Child, 0, len(children)) @@ -52,7 +54,7 @@ func TestMultiAuth(t *testing.T) { multi: authprovider.New(newConsLogger(), srv), } }) - defer o.Run() + defer o.Run(t) type fetchResult struct { resp *auth.FetchTokenResponse @@ -66,12 +68,13 @@ func TestMultiAuth(t *testing.T) { } p := projectProvider{ - mockChild: newMockChild(t, mockTimeout), - mockProjectAdder: newMockProjectAdder(t, mockTimeout), + mockChild: newMockChild(pers.WithTimeout(t, mockTimeout)), + mockProjectAdder: newMockProjectAdder(pers.WithTimeout(t, mockTimeout)), } t.multi = authprovider.New(newConsLogger(), []authprovider.Child{p}) + pers.Return(p.mockProjectAdder.method.AddProject) t.multi.AddProject("foo", "bar") - t.expect(p.mockProjectAdder).To(haveMethodExecuted("AddProject", withArgs("foo", "bar"))) + t.expect(p.mockProjectAdder.method.AddProject).To(haveMethodExecuted(withArgs("foo", "bar"))) }) o.Spec("it does not continue to contact servers with no credentials for a given host", func(t testCtx) { @@ -88,8 +91,7 @@ func TestMultiAuth(t *testing.T) { }() for _, c := range t.children { - t.expect(c).To(haveMethodExecuted( - "FetchToken", + t.expect(c.method.FetchToken).To(haveMethodExecuted( within(timeout), withArgs(pers.Any, equal(&auth.FetchTokenRequest{Host: host})), returning(nil, authprovider.ErrAuthProviderNoResponse), @@ -110,9 +112,8 @@ func TestMultiAuth(t *testing.T) { }() for _, c := range t.children { - t.expect(c).To(not(haveMethodExecuted( - "FetchToken", - within(10*time.Millisecond), + t.expect(c.method.FetchToken).To(not(haveMethodExecuted( + within(10 * time.Millisecond), ))) } @@ -152,8 +153,7 @@ func TestMultiAuth(t *testing.T) { } } - t.expect(c).To(haveMethodExecuted( - "FetchToken", + t.expect(c.method.FetchToken).To(haveMethodExecuted( within(timeout), withArgs(pers.Any, equal(&auth.FetchTokenRequest{Host: host})), returning(ret...), @@ -175,8 +175,7 @@ func TestMultiAuth(t *testing.T) { }() for _, c := range t.children { - t.expect(c).To(haveMethodExecuted( - "FetchToken", + t.expect(c.method.FetchToken).To(haveMethodExecuted( within(timeout), withArgs(pers.Any, equal(&auth.FetchTokenRequest{Host: host})), returning(nil, authprovider.ErrAuthProviderNoResponse), diff --git a/util/llbutil/authprovider/podman_test.go b/util/llbutil/authprovider/podman_test.go index b4fc08c1ea..0c6a045102 100644 --- a/util/llbutil/authprovider/podman_test.go +++ b/util/llbutil/authprovider/podman_test.go @@ -11,6 +11,7 @@ import ( "testing" "time" + "git.sr.ht/~nelsam/hel/pkg/pers" "github.com/EarthBuild/earthbuild/util/llbutil/authprovider" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/auth" @@ -45,14 +46,16 @@ func TestPodmanProvider(topT *testing.T) { Credentials(ctx context.Context, req *auth.CredentialsRequest) (*auth.CredentialsResponse, error) } - o := onpar.BeforeEach(onpar.New(topT), func(t *testing.T) testCtx { + o := onpar.New() + + o.BeforeEach(func(t *testing.T) testCtx { t.Helper() tt := testCtx{ t: t, expect: expect.New(t), - os: newMockOS(t, mockTimeout), - stderr: newMockWriter(t, mockTimeout), + os: newMockOS(pers.WithTimeout(t, mockTimeout)), + stderr: newMockWriter(pers.WithTimeout(t, mockTimeout)), result: make(chan session.Attachable), } @@ -64,7 +67,7 @@ func TestPodmanProvider(topT *testing.T) { return tt }) - defer o.Run() + defer o.Run(topT) o.AfterEach(func(tt testCtx) { _, ok := <-tt.result @@ -83,101 +86,120 @@ func TestPodmanProvider(topT *testing.T) { envs []string } - onpar.TableSpec(o, func(tt testCtx, e entry) { - for _, env := range e.envs { - name, val, ok := strings.Cut(env, "=") - tt.expect(ok).To(beTrue()) - tt.expect(tt.os).To(haveMethodExecuted("Getenv", - within(timeout), - withArgs(name), - returning(val), - )) - } + for _, tt := range []struct { + name string + entry entry + }{ + { + name: "it prefers REGISTRY_AUTH_FILE", + entry: entry{ + envs: []string{ + "REGISTRY_AUTH_FILE=/path/to/someFile", + }, + auth: &authFile{ + path: "/path/to/someFile", + host: "foo.bar", + user: "foo", + secret: "bar", + }, + }, + }, + { + name: "it falls back to XDG_RUNTIME_DIR/containers/auth.json", + entry: entry{ + envs: []string{ + "REGISTRY_AUTH_FILE=", + "XDG_RUNTIME_DIR=/path/to/some/dir", + }, + auth: &authFile{ + path: "/path/to/some/dir/containers/auth.json", + host: "bacon.eggs", + user: "eggs", + secret: "bacon", + }, + }, + }, + { + name: "it checks the root runtime dir last", + entry: entry{ + envs: []string{ + "REGISTRY_AUTH_FILE=", + "XDG_RUNTIME_DIR=", + }, + auth: &authFile{ + path: matchRegexp("/run/containers/[0-9]*/auth.json"), + host: "foo", + user: "bar", + secret: "baz", + }, + }, + }, + { + name: "it returns a provider even when no podman auth file exists", + entry: entry{ + envs: []string{ + "REGISTRY_AUTH_FILE=", + "XDG_RUNTIME_DIR=", + }, + auth: nil, + }, + }, + } { + e := tt.entry + o.Spec(tt.name, func(tt testCtx) { + for _, env := range e.envs { + name, val, ok := strings.Cut(env, "=") + tt.expect(ok).To(beTrue()) + tt.expect(tt.os.method.Getenv).To(haveMethodExecuted( + within(timeout), + withArgs(name), + returning(val), + )) + } - if e.auth == nil { - // The code should fall back to the default docker auth provider, - // which we can't really mock out - but we can at least verify that - // the return value is the correct type. - tt.expect(tt.os).To(haveMethodExecuted("Open", within(timeout), returning(nil, fs.ErrNotExist))) + if e.auth == nil { + // The code should fall back to the default docker auth provider, + // which we can't really mock out - but we can at least verify that + // the return value is the correct type. + tt.expect(tt.os.method.Open).To(haveMethodExecuted(within(timeout), returning(nil, fs.ErrNotExist))) + + select { + case res := <-tt.result: + _, ok := res.(credentials) + tt.expect(ok).To(beTrue()) + case <-time.After(timeout): + tt.t.Fatalf("timed out waiting to fall back to the default docker auth provider") + } + + return + } + + creds := base64.StdEncoding.EncodeToString(fmt.Appendf(nil, "%s:%s", e.auth.user, e.auth.secret)) + authFile := io.NopCloser(bytes.NewBufferString(fmt.Sprintf(authFmt, e.auth.host, creds))) + tt.expect(tt.os.method.Open).To(haveMethodExecuted( + within(timeout), + withArgs(e.auth.path), + returning(authFile, nil))) select { case res := <-tt.result: - _, ok := res.(credentials) + creds, ok := res.(credentials) tt.expect(ok).To(beTrue()) - case <-time.After(timeout): - tt.t.Fatalf("timed out waiting to fall back to the default docker auth provider") - } - return - } - - creds := base64.StdEncoding.EncodeToString(fmt.Appendf(nil, "%s:%s", e.auth.user, e.auth.secret)) - authFile := io.NopCloser(bytes.NewBufferString(fmt.Sprintf(authFmt, e.auth.host, creds))) - tt.expect(tt.os).To(haveMethodExecuted("Open", - within(timeout), - withArgs(e.auth.path), - returning(authFile, nil))) + req := &auth.CredentialsRequest{ + Host: e.auth.host, + } - select { - case res := <-tt.result: - creds, ok := res.(credentials) - tt.expect(ok).To(beTrue()) + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() - req := &auth.CredentialsRequest{ - Host: e.auth.host, + resp, err := creds.Credentials(ctx, req) + tt.expect(err).To(not(haveOccurred())) + tt.expect(resp.Username).To(equal(e.auth.user)) + tt.expect(resp.Secret).To(equal(e.auth.secret)) + case <-time.After(timeout): + tt.t.Fatalf("timed out waiting for a podman auth provider") } - - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() - - resp, err := creds.Credentials(ctx, req) - tt.expect(err).To(not(haveOccurred())) - tt.expect(resp.Username).To(equal(e.auth.user)) - tt.expect(resp.Secret).To(equal(e.auth.secret)) - case <-time.After(timeout): - tt.t.Fatalf("timed out waiting for a podman auth provider") - } - }). - Entry("it prefers REGISTRY_AUTH_FILE", entry{ - envs: []string{ - "REGISTRY_AUTH_FILE=/path/to/someFile", - }, - auth: &authFile{ - path: "/path/to/someFile", - host: "foo.bar", - user: "foo", - secret: "bar", - }, - }). - Entry("it falls back to XDG_RUNTIME_DIR/containers/auth.json", entry{ - envs: []string{ - "REGISTRY_AUTH_FILE=", - "XDG_RUNTIME_DIR=/path/to/some/dir", - }, - auth: &authFile{ - path: "/path/to/some/dir/containers/auth.json", - host: "bacon.eggs", - user: "eggs", - secret: "bacon", - }, - }). - Entry("it checks the root runtime dir last", entry{ - envs: []string{ - "REGISTRY_AUTH_FILE=", - "XDG_RUNTIME_DIR=", - }, - auth: &authFile{ - path: matchRegexp("/run/containers/[0-9]*/auth.json"), - host: "foo", - user: "bar", - secret: "baz", - }, - }). - Entry("it returns a provider even when no podman auth file exists", entry{ - envs: []string{ - "REGISTRY_AUTH_FILE=", - "XDG_RUNTIME_DIR=", - }, - auth: nil, }) + } } diff --git a/util/proj/golang_test.go b/util/proj/golang_test.go index a6adc95776..43b894fdc3 100644 --- a/util/proj/golang_test.go +++ b/util/proj/golang_test.go @@ -36,11 +36,13 @@ func TestGolang(t *testing.T) { cancel func() } - o := onpar.BeforeEach(onpar.New(t), func(t *testing.T) testCtx { + o := onpar.New() + + o.BeforeEach(func(t *testing.T) testCtx { t.Helper() - fs := newMockFS(t, mockTimeout) - exec := newMockExecer(t, mockTimeout) + fs := newMockFS(pers.WithTimeout(t, mockTimeout)) + exec := newMockExecer(pers.WithTimeout(t, mockTimeout)) ctx, cancel := context.WithTimeout(context.Background(), timeout) return testCtx{ @@ -53,7 +55,7 @@ func TestGolang(t *testing.T) { cancel: cancel, } }) - defer o.Run() + defer o.Run(t) o.AfterEach(func(t testCtx) { t.cancel() @@ -65,34 +67,34 @@ func TestGolang(t *testing.T) { o.Group("ForDir", func() { o.Spec("it skips projects without a go.mod", func(t testCtx) { - pers.Return(t.fs.StatOutput, nil, fs.ErrNotExist) + pers.Return(t.fs.method.Stat, nil, fs.ErrNotExist) _, err := t.golang.ForDir(t.ctx, ".") - t.expect(t.fs).To(haveMethodExecuted("Stat", withArgs("go.mod"))) + t.expect(t.fs.method.Stat).To(haveMethodExecuted(withArgs("go.mod"))) t.expect(err).To(beErr(proj.ErrSkip)) }) o.Spec("it errors if reading go.mod fails", func(t testCtx) { - pers.Return(t.fs.StatOutput, nil, errors.New("boom")) + pers.Return(t.fs.method.Stat, nil, errors.New("boom")) _, err := t.golang.ForDir(t.ctx, ".") - t.expect(t.fs).To(haveMethodExecuted("Stat", withArgs("go.mod"))) + t.expect(t.fs.method.Stat).To(haveMethodExecuted(withArgs("go.mod"))) t.expect(err).To(haveOccurred()) t.expect(err).To(not(beErr(proj.ErrSkip))) }) o.Spec("it errors if 'go' is not available", func(t testCtx) { - pers.Return(t.fs.StatOutput, nil, nil) - cmd := newMockCmd(t, mockTimeout) - pers.Return(t.exec.CommandOutput, cmd) + pers.Return(t.fs.method.Stat, nil, nil) + cmd := newMockCmd(pers.WithTimeout(t, mockTimeout)) + pers.Return(t.exec.method.Command, cmd) const projDir = "some/path/to/a/project" stdout := bytes.NewBufferString(projDir) - pers.Return(cmd.RunOutput, stdout, nil, fs.ErrNotExist) + pers.Return(cmd.method.Run, stdout, nil, fs.ErrNotExist) _, err := t.golang.ForDir(t.ctx, ".") - t.expect(t.fs).To(haveMethodExecuted("Stat", withArgs("go.mod"))) - t.expect(t.exec).To(haveMethodExecuted("Command", withArgs("go", "list", "-f", "{{.Dir}}"))) - t.expect(cmd).To(haveMethodExecuted("Run")) + t.expect(t.fs.method.Stat).To(haveMethodExecuted(withArgs("go.mod"))) + t.expect(t.exec.method.Command).To(haveMethodExecuted(withArgs("go", "list", "-f", "{{.Dir}}"))) + t.expect(cmd.method.Run).To(haveMethodExecuted()) t.expect(err).To(haveOccurred()) t.expect(err).To(not(beErr(proj.ErrSkip))) }) diff --git a/util/proj/helheim_mocks_test.go b/util/proj/helheim_mocks_test.go index d1daef7277..b72bfe1d4c 100644 --- a/util/proj/helheim_mocks_test.go +++ b/util/proj/helheim_mocks_test.go @@ -9,359 +9,519 @@ package proj_test import ( "context" + "git.sr.ht/~nelsam/hel/pkg/pers" + "git.sr.ht/~nelsam/hel/vegr" + "github.com/EarthBuild/earthbuild/util/proj" "io" "io/fs" "time" +) - "git.sr.ht/~nelsam/hel/vegr" - "github.com/EarthBuild/earthbuild/util/proj" +var ( + _ = vegr.EnforceVersion(7 - vegr.MinVersion) + _ = vegr.EnforceVersion(vegr.MaxVersion - 7) ) +type mockFS_Open_In struct { + Name string +} + +func (mockFS_Open_In) Variadic() bool { + return false +} + +type mockFS_Open_Out struct { + Panic_ any + Ret0 fs.File + Ret1 error +} +type mockFS_Open struct { + vegr.Method[mockFS_Open_In, mockFS_Open_Out] +} +type mockFS_Stat_In struct { + Name string +} + +func (mockFS_Stat_In) Variadic() bool { + return false +} + +type mockFS_Stat_Out struct { + Panic_ any + Ret0 fs.FileInfo + Ret1 error +} +type mockFS_Stat struct { + vegr.Method[mockFS_Stat_In, mockFS_Stat_Out] +} type mockFS struct { - t vegr.T - timeout time.Duration - OpenCalled chan bool - OpenInput struct { - Name chan string - } - OpenOutput struct { - Ret0 chan fs.File - Ret1 chan error - } - StatCalled chan bool - StatInput struct { - Name chan string - } - StatOutput struct { - Ret0 chan fs.FileInfo - Ret1 chan error + prefs vegr.Prefs + method struct { + Open mockFS_Open + Stat mockFS_Stat } } -func newMockFS(t vegr.T, timeout time.Duration) *mockFS { - m := &mockFS{t: t, timeout: timeout} - m.OpenCalled = make(chan bool, 100) - m.OpenInput.Name = make(chan string, 100) - m.OpenOutput.Ret0 = make(chan fs.File, 100) - m.OpenOutput.Ret1 = make(chan error, 100) - m.StatCalled = make(chan bool, 100) - m.StatInput.Name = make(chan string, 100) - m.StatOutput.Ret0 = make(chan fs.FileInfo, 100) - m.StatOutput.Ret1 = make(chan error, 100) +func newMockFS(cst pers.Constructor) *mockFS { + m := &mockFS{prefs: vegr.MakePrefs(cst)} + m.method.Open.Method = vegr.NewMethod[mockFS_Open_In, mockFS_Open_Out]("mockFS", "Open", 100, vegr.WithPrefs(m.prefs)) + m.method.Stat.Method = vegr.NewMethod[mockFS_Stat_In, mockFS_Stat_Out]("mockFS", "Stat", 100, vegr.WithPrefs(m.prefs)) return m } func (m *mockFS) Open(name string) (ret0 fs.File, ret1 error) { - m.t.Helper() - m.OpenCalled <- true - m.OpenInput.Name <- name - vegr.PopulateReturns(m.t, "Open", m.timeout, m.OpenOutput, &ret0, &ret1) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Open, mockFS_Open_In{Name: name}, &ret0, &ret1) return ret0, ret1 } func (m *mockFS) Stat(name string) (ret0 fs.FileInfo, ret1 error) { - m.t.Helper() - m.StatCalled <- true - m.StatInput.Name <- name - vegr.PopulateReturns(m.t, "Stat", m.timeout, m.StatOutput, &ret0, &ret1) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Stat, mockFS_Stat_In{Name: name}, &ret0, &ret1) return ret0, ret1 } -type mockCmd struct { - t vegr.T - timeout time.Duration - RunCalled chan bool - RunInput struct { - Ctx chan context.Context - } - RunOutput struct { - Stdout, Stderr chan io.Reader - Ret1 chan error - } +type mockFile_Stat_In struct { } -func newMockCmd(t vegr.T, timeout time.Duration) *mockCmd { - m := &mockCmd{t: t, timeout: timeout} - m.RunCalled = make(chan bool, 100) - m.RunInput.Ctx = make(chan context.Context, 100) - m.RunOutput.Stdout = make(chan io.Reader, 100) - m.RunOutput.Stderr = make(chan io.Reader, 100) - m.RunOutput.Ret1 = make(chan error, 100) - return m +func (mockFile_Stat_In) Variadic() bool { + return false } -func (m *mockCmd) Run(ctx context.Context) (stdout, stderr io.Reader, ret1 error) { - m.t.Helper() - m.RunCalled <- true - m.RunInput.Ctx <- ctx - vegr.PopulateReturns(m.t, "Run", m.timeout, m.RunOutput, &stdout, &stderr, &ret1) - return stdout, stderr, ret1 + +type mockFile_Stat_Out struct { + Panic_ any + Ret0 fs.FileInfo + Ret1 error +} +type mockFile_Stat struct { + vegr.Method[mockFile_Stat_In, mockFile_Stat_Out] +} +type mockFile_Read_In struct { + Arg0 []byte } -type mockExecer struct { - t vegr.T - timeout time.Duration - CommandCalled chan bool - CommandInput struct { - Name chan string - Args chan []string - } - CommandOutput struct { - Ret0 chan proj.Cmd +func (mockFile_Read_In) Variadic() bool { + return false +} + +type mockFile_Read_Out struct { + Panic_ any + Ret0 int + Ret1 error +} +type mockFile_Read struct { + vegr.Method[mockFile_Read_In, mockFile_Read_Out] +} +type mockFile_Close_In struct { +} + +func (mockFile_Close_In) Variadic() bool { + return false +} + +type mockFile_Close_Out struct { + Panic_ any + Ret0 error +} +type mockFile_Close struct { + vegr.Method[mockFile_Close_In, mockFile_Close_Out] +} +type mockFile struct { + prefs vegr.Prefs + method struct { + Stat mockFile_Stat + Read mockFile_Read + Close mockFile_Close } } -func newMockExecer(t vegr.T, timeout time.Duration) *mockExecer { - m := &mockExecer{t: t, timeout: timeout} - m.CommandCalled = make(chan bool, 100) - m.CommandInput.Name = make(chan string, 100) - m.CommandInput.Args = make(chan []string, 100) - m.CommandOutput.Ret0 = make(chan proj.Cmd, 100) +func newMockFile(cst pers.Constructor) *mockFile { + m := &mockFile{prefs: vegr.MakePrefs(cst)} + m.method.Stat.Method = vegr.NewMethod[mockFile_Stat_In, mockFile_Stat_Out]("mockFile", "Stat", 100, vegr.WithPrefs(m.prefs)) + m.method.Read.Method = vegr.NewMethod[mockFile_Read_In, mockFile_Read_Out]("mockFile", "Read", 100, vegr.WithPrefs(m.prefs)) + m.method.Close.Method = vegr.NewMethod[mockFile_Close_In, mockFile_Close_Out]("mockFile", "Close", 100, vegr.WithPrefs(m.prefs)) return m } -func (m *mockExecer) Command(name string, args ...string) (ret0 proj.Cmd) { - m.t.Helper() - m.CommandCalled <- true - m.CommandInput.Name <- name - m.CommandInput.Args <- args - vegr.PopulateReturns(m.t, "Command", m.timeout, m.CommandOutput, &ret0) +func (m *mockFile) Stat() (ret0 fs.FileInfo, ret1 error) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Stat, mockFile_Stat_In{}, &ret0, &ret1) + return ret0, ret1 +} +func (m *mockFile) Read(arg0 []byte) (ret0 int, ret1 error) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Read, mockFile_Read_In{Arg0: arg0}, &ret0, &ret1) + return ret0, ret1 +} +func (m *mockFile) Close() (ret0 error) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Close, mockFile_Close_In{}, &ret0) return ret0 } -type mockProject struct { - t vegr.T - timeout time.Duration +type mockFileInfo_Name_In struct { } -func newMockProject(t vegr.T, timeout time.Duration) *mockProject { - m := &mockProject{t: t, timeout: timeout} - return m +func (mockFileInfo_Name_In) Variadic() bool { + return false +} + +type mockFileInfo_Name_Out struct { + Panic_ any + Ret0 string +} +type mockFileInfo_Name struct { + vegr.Method[mockFileInfo_Name_In, mockFileInfo_Name_Out] +} +type mockFileInfo_Size_In struct { +} + +func (mockFileInfo_Size_In) Variadic() bool { + return false +} + +type mockFileInfo_Size_Out struct { + Panic_ any + Ret0 int64 +} +type mockFileInfo_Size struct { + vegr.Method[mockFileInfo_Size_In, mockFileInfo_Size_Out] +} +type mockFileInfo_Mode_In struct { +} + +func (mockFileInfo_Mode_In) Variadic() bool { + return false } +type mockFileInfo_Mode_Out struct { + Panic_ any + Ret0 fs.FileMode +} +type mockFileInfo_Mode struct { + vegr.Method[mockFileInfo_Mode_In, mockFileInfo_Mode_Out] +} +type mockFileInfo_ModTime_In struct { +} + +func (mockFileInfo_ModTime_In) Variadic() bool { + return false +} + +type mockFileInfo_ModTime_Out struct { + Panic_ any + Ret0 time.Time +} +type mockFileInfo_ModTime struct { + vegr.Method[mockFileInfo_ModTime_In, mockFileInfo_ModTime_Out] +} +type mockFileInfo_IsDir_In struct { +} + +func (mockFileInfo_IsDir_In) Variadic() bool { + return false +} + +type mockFileInfo_IsDir_Out struct { + Panic_ any + Ret0 bool +} +type mockFileInfo_IsDir struct { + vegr.Method[mockFileInfo_IsDir_In, mockFileInfo_IsDir_Out] +} +type mockFileInfo_Sys_In struct { +} + +func (mockFileInfo_Sys_In) Variadic() bool { + return false +} + +type mockFileInfo_Sys_Out struct { + Panic_ any + Ret0 any +} +type mockFileInfo_Sys struct { + vegr.Method[mockFileInfo_Sys_In, mockFileInfo_Sys_Out] +} type mockFileInfo struct { - t vegr.T - timeout time.Duration - NameCalled chan bool - NameOutput struct { - Ret0 chan string - } - SizeCalled chan bool - SizeOutput struct { - Ret0 chan int64 - } - ModeCalled chan bool - ModeOutput struct { - Ret0 chan fs.FileMode - } - ModTimeCalled chan bool - ModTimeOutput struct { - Ret0 chan time.Time - } - IsDirCalled chan bool - IsDirOutput struct { - Ret0 chan bool - } - SysCalled chan bool - SysOutput struct { - Ret0 chan any + prefs vegr.Prefs + method struct { + Name mockFileInfo_Name + Size mockFileInfo_Size + Mode mockFileInfo_Mode + ModTime mockFileInfo_ModTime + IsDir mockFileInfo_IsDir + Sys mockFileInfo_Sys } } -func newMockFileInfo(t vegr.T, timeout time.Duration) *mockFileInfo { - m := &mockFileInfo{t: t, timeout: timeout} - m.NameCalled = make(chan bool, 100) - m.NameOutput.Ret0 = make(chan string, 100) - m.SizeCalled = make(chan bool, 100) - m.SizeOutput.Ret0 = make(chan int64, 100) - m.ModeCalled = make(chan bool, 100) - m.ModeOutput.Ret0 = make(chan fs.FileMode, 100) - m.ModTimeCalled = make(chan bool, 100) - m.ModTimeOutput.Ret0 = make(chan time.Time, 100) - m.IsDirCalled = make(chan bool, 100) - m.IsDirOutput.Ret0 = make(chan bool, 100) - m.SysCalled = make(chan bool, 100) - m.SysOutput.Ret0 = make(chan any, 100) +func newMockFileInfo(cst pers.Constructor) *mockFileInfo { + m := &mockFileInfo{prefs: vegr.MakePrefs(cst)} + m.method.Name.Method = vegr.NewMethod[mockFileInfo_Name_In, mockFileInfo_Name_Out]("mockFileInfo", "Name", 100, vegr.WithPrefs(m.prefs)) + m.method.Size.Method = vegr.NewMethod[mockFileInfo_Size_In, mockFileInfo_Size_Out]("mockFileInfo", "Size", 100, vegr.WithPrefs(m.prefs)) + m.method.Mode.Method = vegr.NewMethod[mockFileInfo_Mode_In, mockFileInfo_Mode_Out]("mockFileInfo", "Mode", 100, vegr.WithPrefs(m.prefs)) + m.method.ModTime.Method = vegr.NewMethod[mockFileInfo_ModTime_In, mockFileInfo_ModTime_Out]("mockFileInfo", "ModTime", 100, vegr.WithPrefs(m.prefs)) + m.method.IsDir.Method = vegr.NewMethod[mockFileInfo_IsDir_In, mockFileInfo_IsDir_Out]("mockFileInfo", "IsDir", 100, vegr.WithPrefs(m.prefs)) + m.method.Sys.Method = vegr.NewMethod[mockFileInfo_Sys_In, mockFileInfo_Sys_Out]("mockFileInfo", "Sys", 100, vegr.WithPrefs(m.prefs)) return m } func (m *mockFileInfo) Name() (ret0 string) { - m.t.Helper() - m.NameCalled <- true - vegr.PopulateReturns(m.t, "Name", m.timeout, m.NameOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Name, mockFileInfo_Name_In{}, &ret0) return ret0 } func (m *mockFileInfo) Size() (ret0 int64) { - m.t.Helper() - m.SizeCalled <- true - vegr.PopulateReturns(m.t, "Size", m.timeout, m.SizeOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Size, mockFileInfo_Size_In{}, &ret0) return ret0 } func (m *mockFileInfo) Mode() (ret0 fs.FileMode) { - m.t.Helper() - m.ModeCalled <- true - vegr.PopulateReturns(m.t, "Mode", m.timeout, m.ModeOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Mode, mockFileInfo_Mode_In{}, &ret0) return ret0 } func (m *mockFileInfo) ModTime() (ret0 time.Time) { - m.t.Helper() - m.ModTimeCalled <- true - vegr.PopulateReturns(m.t, "ModTime", m.timeout, m.ModTimeOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.ModTime, mockFileInfo_ModTime_In{}, &ret0) return ret0 } func (m *mockFileInfo) IsDir() (ret0 bool) { - m.t.Helper() - m.IsDirCalled <- true - vegr.PopulateReturns(m.t, "IsDir", m.timeout, m.IsDirOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.IsDir, mockFileInfo_IsDir_In{}, &ret0) return ret0 } func (m *mockFileInfo) Sys() (ret0 any) { - m.t.Helper() - m.SysCalled <- true - vegr.PopulateReturns(m.t, "Sys", m.timeout, m.SysOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Sys, mockFileInfo_Sys_In{}, &ret0) return ret0 } -type mockFile struct { - t vegr.T - timeout time.Duration - StatCalled chan bool - StatOutput struct { - Ret0 chan fs.FileInfo - Ret1 chan error - } - ReadCalled chan bool - ReadInput struct { - Arg0 chan []byte - } - ReadOutput struct { - Ret0 chan int - Ret1 chan error +type mockExecer_Command_In struct { + Name string + Args []string +} + +func (mockExecer_Command_In) Variadic() bool { + return true +} + +type mockExecer_Command_Out struct { + Panic_ any + Ret0 proj.Cmd +} +type mockExecer_Command struct { + vegr.Method[mockExecer_Command_In, mockExecer_Command_Out] +} +type mockExecer struct { + prefs vegr.Prefs + method struct { + Command mockExecer_Command } - CloseCalled chan bool - CloseOutput struct { - Ret0 chan error +} + +func newMockExecer(cst pers.Constructor) *mockExecer { + m := &mockExecer{prefs: vegr.MakePrefs(cst)} + m.method.Command.Method = vegr.NewMethod[mockExecer_Command_In, mockExecer_Command_Out]("mockExecer", "Command", 100, vegr.WithPrefs(m.prefs)) + return m +} +func (m *mockExecer) Command(name string, args ...string) (ret0 proj.Cmd) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Command, mockExecer_Command_In{Name: name, Args: args}, &ret0) + return ret0 +} + +type mockCmd_Run_In struct { + Ctx context.Context +} + +func (mockCmd_Run_In) Variadic() bool { + return false +} + +type mockCmd_Run_Out struct { + Panic_ any + Stdout, Stderr io.Reader + Ret1 error +} +type mockCmd_Run struct { + vegr.Method[mockCmd_Run_In, mockCmd_Run_Out] +} +type mockCmd struct { + prefs vegr.Prefs + method struct { + Run mockCmd_Run } } -func newMockFile(t vegr.T, timeout time.Duration) *mockFile { - m := &mockFile{t: t, timeout: timeout} - m.StatCalled = make(chan bool, 100) - m.StatOutput.Ret0 = make(chan fs.FileInfo, 100) - m.StatOutput.Ret1 = make(chan error, 100) - m.ReadCalled = make(chan bool, 100) - m.ReadInput.Arg0 = make(chan []byte, 100) - m.ReadOutput.Ret0 = make(chan int, 100) - m.ReadOutput.Ret1 = make(chan error, 100) - m.CloseCalled = make(chan bool, 100) - m.CloseOutput.Ret0 = make(chan error, 100) +func newMockCmd(cst pers.Constructor) *mockCmd { + m := &mockCmd{prefs: vegr.MakePrefs(cst)} + m.method.Run.Method = vegr.NewMethod[mockCmd_Run_In, mockCmd_Run_Out]("mockCmd", "Run", 100, vegr.WithPrefs(m.prefs)) return m } -func (m *mockFile) Stat() (ret0 fs.FileInfo, ret1 error) { - m.t.Helper() - m.StatCalled <- true - vegr.PopulateReturns(m.t, "Stat", m.timeout, m.StatOutput, &ret0, &ret1) - return ret0, ret1 +func (m *mockCmd) Run(ctx context.Context) (stdout, stderr io.Reader, ret1 error) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Run, mockCmd_Run_In{Ctx: ctx}, &stdout, &stderr, &ret1) + return stdout, stderr, ret1 } -func (m *mockFile) Read(arg0 []byte) (ret0 int, ret1 error) { - m.t.Helper() - m.ReadCalled <- true - m.ReadInput.Arg0 <- arg0 - vegr.PopulateReturns(m.t, "Read", m.timeout, m.ReadOutput, &ret0, &ret1) - return ret0, ret1 + +type mockContext_Deadline_In struct { } -func (m *mockFile) Close() (ret0 error) { - m.t.Helper() - m.CloseCalled <- true - vegr.PopulateReturns(m.t, "Close", m.timeout, m.CloseOutput, &ret0) - return ret0 + +func (mockContext_Deadline_In) Variadic() bool { + return false } +type mockContext_Deadline_Out struct { + Panic_ any + Deadline time.Time + Ok bool +} +type mockContext_Deadline struct { + vegr.Method[mockContext_Deadline_In, mockContext_Deadline_Out] +} +type mockContext_Done_In struct { +} + +func (mockContext_Done_In) Variadic() bool { + return false +} + +type mockContext_Done_Out struct { + Panic_ any + Ret0 <-chan struct{} +} +type mockContext_Done struct { + vegr.Method[mockContext_Done_In, mockContext_Done_Out] +} +type mockContext_Err_In struct { +} + +func (mockContext_Err_In) Variadic() bool { + return false +} + +type mockContext_Err_Out struct { + Panic_ any + Ret0 error +} +type mockContext_Err struct { + vegr.Method[mockContext_Err_In, mockContext_Err_Out] +} +type mockContext_Value_In struct { + Key any +} + +func (mockContext_Value_In) Variadic() bool { + return false +} + +type mockContext_Value_Out struct { + Panic_ any + Ret0 any +} +type mockContext_Value struct { + vegr.Method[mockContext_Value_In, mockContext_Value_Out] +} type mockContext struct { - t vegr.T - timeout time.Duration - DeadlineCalled chan bool - DeadlineOutput struct { - Deadline chan time.Time - Ok chan bool - } - DoneCalled chan bool - DoneOutput struct { - Ret0 chan (<-chan struct{}) - } - ErrCalled chan bool - ErrOutput struct { - Ret0 chan error - } - ValueCalled chan bool - ValueInput struct { - Key chan any - } - ValueOutput struct { - Ret0 chan any + prefs vegr.Prefs + method struct { + Deadline mockContext_Deadline + Done mockContext_Done + Err mockContext_Err + Value mockContext_Value } } -func newMockContext(t vegr.T, timeout time.Duration) *mockContext { - m := &mockContext{t: t, timeout: timeout} - m.DeadlineCalled = make(chan bool, 100) - m.DeadlineOutput.Deadline = make(chan time.Time, 100) - m.DeadlineOutput.Ok = make(chan bool, 100) - m.DoneCalled = make(chan bool, 100) - m.DoneOutput.Ret0 = make(chan (<-chan struct{}), 100) - m.ErrCalled = make(chan bool, 100) - m.ErrOutput.Ret0 = make(chan error, 100) - m.ValueCalled = make(chan bool, 100) - m.ValueInput.Key = make(chan any, 100) - m.ValueOutput.Ret0 = make(chan any, 100) +func newMockContext(cst pers.Constructor) *mockContext { + m := &mockContext{prefs: vegr.MakePrefs(cst)} + m.method.Deadline.Method = vegr.NewMethod[mockContext_Deadline_In, mockContext_Deadline_Out]("mockContext", "Deadline", 100, vegr.WithPrefs(m.prefs)) + m.method.Done.Method = vegr.NewMethod[mockContext_Done_In, mockContext_Done_Out]("mockContext", "Done", 100, vegr.WithPrefs(m.prefs)) + m.method.Err.Method = vegr.NewMethod[mockContext_Err_In, mockContext_Err_Out]("mockContext", "Err", 100, vegr.WithPrefs(m.prefs)) + m.method.Value.Method = vegr.NewMethod[mockContext_Value_In, mockContext_Value_Out]("mockContext", "Value", 100, vegr.WithPrefs(m.prefs)) return m } func (m *mockContext) Deadline() (deadline time.Time, ok bool) { - m.t.Helper() - m.DeadlineCalled <- true - vegr.PopulateReturns(m.t, "Deadline", m.timeout, m.DeadlineOutput, &deadline, &ok) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Deadline, mockContext_Deadline_In{}, &deadline, &ok) return deadline, ok } func (m *mockContext) Done() (ret0 <-chan struct{}) { - m.t.Helper() - m.DoneCalled <- true - vegr.PopulateReturns(m.t, "Done", m.timeout, m.DoneOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Done, mockContext_Done_In{}, &ret0) return ret0 } func (m *mockContext) Err() (ret0 error) { - m.t.Helper() - m.ErrCalled <- true - vegr.PopulateReturns(m.t, "Err", m.timeout, m.ErrOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Err, mockContext_Err_In{}, &ret0) return ret0 } func (m *mockContext) Value(key any) (ret0 any) { - m.t.Helper() - m.ValueCalled <- true - m.ValueInput.Key <- key - vegr.PopulateReturns(m.t, "Value", m.timeout, m.ValueOutput, &ret0) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Value, mockContext_Value_In{Key: key}, &ret0) return ret0 } +type mockReader_Read_In struct { + P []byte +} + +func (mockReader_Read_In) Variadic() bool { + return false +} + +type mockReader_Read_Out struct { + Panic_ any + N int + Err error +} +type mockReader_Read struct { + vegr.Method[mockReader_Read_In, mockReader_Read_Out] +} type mockReader struct { - t vegr.T - timeout time.Duration - ReadCalled chan bool - ReadInput struct { - P chan []byte - } - ReadOutput struct { - N chan int - Err chan error + prefs vegr.Prefs + method struct { + Read mockReader_Read } } -func newMockReader(t vegr.T, timeout time.Duration) *mockReader { - m := &mockReader{t: t, timeout: timeout} - m.ReadCalled = make(chan bool, 100) - m.ReadInput.P = make(chan []byte, 100) - m.ReadOutput.N = make(chan int, 100) - m.ReadOutput.Err = make(chan error, 100) +func newMockReader(cst pers.Constructor) *mockReader { + m := &mockReader{prefs: vegr.MakePrefs(cst)} + m.method.Read.Method = vegr.NewMethod[mockReader_Read_In, mockReader_Read_Out]("mockReader", "Read", 100, vegr.WithPrefs(m.prefs)) return m } func (m *mockReader) Read(p []byte) (n int, err error) { - m.t.Helper() - m.ReadCalled <- true - m.ReadInput.P <- p - vegr.PopulateReturns(m.t, "Read", m.timeout, m.ReadOutput, &n, &err) + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Read, mockReader_Read_In{P: p}, &n, &err) + return n, err +} + +type mockWriter_Write_In struct { + P []byte +} + +func (mockWriter_Write_In) Variadic() bool { + return false +} + +type mockWriter_Write_Out struct { + Panic_ any + N int + Err error +} +type mockWriter_Write struct { + vegr.Method[mockWriter_Write_In, mockWriter_Write_Out] +} +type mockWriter struct { + prefs vegr.Prefs + method struct { + Write mockWriter_Write + } +} + +func newMockWriter(cst pers.Constructor) *mockWriter { + m := &mockWriter{prefs: vegr.MakePrefs(cst)} + m.method.Write.Method = vegr.NewMethod[mockWriter_Write_In, mockWriter_Write_Out]("mockWriter", "Write", 100, vegr.WithPrefs(m.prefs)) + return m +} +func (m *mockWriter) Write(p []byte) (n int, err error) { + m.prefs.T().Helper() + vegr.Perform(m.prefs.T(), m.method.Write, mockWriter_Write_In{P: p}, &n, &err) return n, err } diff --git a/variables/collection_test.go b/variables/collection_test.go index 3ec01e0c75..ec1c6d2d53 100644 --- a/variables/collection_test.go +++ b/variables/collection_test.go @@ -21,7 +21,9 @@ func TestCollection(topT *testing.T) { features *features.Features } - o := onpar.BeforeEach(onpar.New(topT), func(t *testing.T) testCtx { + o := onpar.New() + + o.BeforeEach(func(t *testing.T) testCtx { t.Helper() expect := expect.New(t) @@ -35,9 +37,9 @@ func TestCollection(topT *testing.T) { features: f, } }) - defer o.Run() + defer o.Run(topT) - registerBaseSpecs := func(o *onpar.Onpar[testCtx, testCtx]) { + registerBaseSpecs := func(o *onpar.Onpar) { // This is a quick and dirty workaround for registering the same specs // with multiple setup/teardown functions. It should be a first class // feature in onpar some day, but for now this will do. @@ -55,7 +57,7 @@ func TestCollection(topT *testing.T) { } o.Group("Defaults", func() { - o := onpar.BeforeEach(o, func(tc testCtx) testCtx { + o.BeforeEach(func(tc testCtx) testCtx { tc.coll = variables.NewCollection(variables.NewCollectionOpt{ PlatformResolver: platutil.NewResolver(specs.Platform{ Architecture: "foo", @@ -77,7 +79,7 @@ func TestCollection(topT *testing.T) { }) o.Group("ArgScopeSet", func() { - o := onpar.BeforeEach(o, func(tc testCtx) testCtx { + o.BeforeEach(func(tc testCtx) testCtx { tc.features.ArgScopeSet = true tc.coll = variables.NewCollection(variables.NewCollectionOpt{ PlatformResolver: platutil.NewResolver(specs.Platform{ diff --git a/variables/scope_test.go b/variables/scope_test.go index e3020ea351..e2e1a04f12 100644 --- a/variables/scope_test.go +++ b/variables/scope_test.go @@ -17,7 +17,9 @@ func TestScope(topT *testing.T) { scope *variables.Scope } - o := onpar.BeforeEach(onpar.New(topT), func(t *testing.T) testCtx { + o := onpar.New() + + o.BeforeEach(func(t *testing.T) testCtx { t.Helper() return testCtx{ @@ -26,7 +28,7 @@ func TestScope(topT *testing.T) { scope: variables.NewScope(), } }) - defer o.Run() + defer o.Run(topT) o.Spec("it returns false for unset variables", func(tc testCtx) { _, ok := tc.scope.Get("foo")