diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5a07296..40b8461 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,22 +6,25 @@ jobs: check: name: Check runs-on: ubuntu-latest - # Execute the checks inside the container instead the VM. - container: golangci/golangci-lint:v1.42.0-alpine + container: golangci/golangci-lint:v1.61.0-alpine steps: - - uses: actions/checkout@v3.0.2 - - run: ./scripts/check/check.sh + - uses: actions/checkout@v4 + - run: | + # We need this go flag because it started to error after golangci-lint is using Go 1.21. + # TODO(slok): Remove it on next (>1.54.1) golangci-lint upgrade to check if this problem has gone. + export GOFLAGS="-buildvcs=false" + ./scripts/check/check.sh unit-test: name: Unit test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.0.2 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: 1.17 + go-version-file: go.mod - run: make ci-test - - uses: codecov/codecov-action@v3.1.0 + - uses: codecov/codecov-action@v4.5.0 with: token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} file: ./.test_coverage.txt @@ -38,7 +41,7 @@ jobs: name: Release image runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.0.2 + - uses: actions/checkout@v4 - name: Build image run: make build-image - name: Docker login @@ -56,7 +59,7 @@ jobs: runs-on: ubuntu-latest steps: - run: echo "VERSION=${GITHUB_REF#refs/*/}" >> ${GITHUB_ENV} # Sets VERSION env var. - - uses: actions/checkout@v3.0.2 + - uses: actions/checkout@v4 - name: Build image run: make build-image - name: Docker login @@ -72,17 +75,17 @@ jobs: runs-on: ubuntu-latest steps: - run: echo "VERSION=${GITHUB_REF#refs/*/}" >> ${GITHUB_ENV} # Sets VERSION env var. - - uses: actions/checkout@v3.0.2 + - uses: actions/checkout@v4 - name: Build binaries run: | mkdir -p ./bin chmod -R 0777 ./bin make build-all - name: Upload binaries - uses: xresloader/upload-to-github-release@v1.3.3 + uses: xresloader/upload-to-github-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - file: 'bin/*' + file: "bin/*" tags: true - draft: true \ No newline at end of file + draft: true diff --git a/.golangci.yml b/.golangci.yml index 485d373..ebcc58a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,6 @@ --- - run: + timeout: 3m build-tags: - integration @@ -10,5 +10,12 @@ linters: - goimports - revive - gofmt - - depguard - - godot \ No newline at end of file + #- depguard + - godot + +linters-settings: + revive: + rules: + # Spammy linter and complex to fix on lots of parameters. Makes more harm that it solves. + - name: unused-parameter + disabled: true \ No newline at end of file diff --git a/cmd/agebox/commands/cat.go b/cmd/agebox/commands/cat.go index f7d643a..4dac622 100644 --- a/cmd/agebox/commands/cat.go +++ b/cmd/agebox/commands/cat.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "gopkg.in/alecthomas/kingpin.v2" + "github.com/alecthomas/kingpin/v2" boxcat "github.com/slok/agebox/internal/box/cat" keyage "github.com/slok/agebox/internal/key/age" diff --git a/cmd/agebox/commands/decrypt.go b/cmd/agebox/commands/decrypt.go index 8fa48f7..c690f8c 100644 --- a/cmd/agebox/commands/decrypt.go +++ b/cmd/agebox/commands/decrypt.go @@ -6,7 +6,7 @@ import ( "os" "regexp" - "gopkg.in/alecthomas/kingpin.v2" + "github.com/alecthomas/kingpin/v2" boxdecrypt "github.com/slok/agebox/internal/box/decrypt" keyage "github.com/slok/agebox/internal/key/age" diff --git a/cmd/agebox/commands/encrypt.go b/cmd/agebox/commands/encrypt.go index afa9ce3..8524624 100644 --- a/cmd/agebox/commands/encrypt.go +++ b/cmd/agebox/commands/encrypt.go @@ -6,7 +6,7 @@ import ( "os" "regexp" - "gopkg.in/alecthomas/kingpin.v2" + "github.com/alecthomas/kingpin/v2" boxencrypt "github.com/slok/agebox/internal/box/encrypt" keyage "github.com/slok/agebox/internal/key/age" diff --git a/cmd/agebox/commands/init.go b/cmd/agebox/commands/init.go index b0692d0..40c29fb 100644 --- a/cmd/agebox/commands/init.go +++ b/cmd/agebox/commands/init.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "gopkg.in/alecthomas/kingpin.v2" + "github.com/alecthomas/kingpin/v2" boxinit "github.com/slok/agebox/internal/box/init" storagefs "github.com/slok/agebox/internal/storage/fs" diff --git a/cmd/agebox/commands/reencrypt.go b/cmd/agebox/commands/reencrypt.go index aa523e1..d16aafe 100644 --- a/cmd/agebox/commands/reencrypt.go +++ b/cmd/agebox/commands/reencrypt.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "gopkg.in/alecthomas/kingpin.v2" + "github.com/alecthomas/kingpin/v2" boxreencrypt "github.com/slok/agebox/internal/box/reencrypt" keyage "github.com/slok/agebox/internal/key/age" diff --git a/cmd/agebox/commands/root.go b/cmd/agebox/commands/root.go index 57c4672..59d1b54 100644 --- a/cmd/agebox/commands/root.go +++ b/cmd/agebox/commands/root.go @@ -4,7 +4,7 @@ import ( "context" "io" - "gopkg.in/alecthomas/kingpin.v2" + "github.com/alecthomas/kingpin/v2" "github.com/slok/agebox/internal/log" ) diff --git a/cmd/agebox/commands/untrack.go b/cmd/agebox/commands/untrack.go index 4d73c42..18a1ac2 100644 --- a/cmd/agebox/commands/untrack.go +++ b/cmd/agebox/commands/untrack.go @@ -6,7 +6,7 @@ import ( "os" "regexp" - "gopkg.in/alecthomas/kingpin.v2" + "github.com/alecthomas/kingpin/v2" boxuntrack "github.com/slok/agebox/internal/box/untrack" "github.com/slok/agebox/internal/secret/expand" diff --git a/cmd/agebox/commands/validate.go b/cmd/agebox/commands/validate.go index aacb5bc..21c7e29 100644 --- a/cmd/agebox/commands/validate.go +++ b/cmd/agebox/commands/validate.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "gopkg.in/alecthomas/kingpin.v2" + "github.com/alecthomas/kingpin/v2" boxvalidate "github.com/slok/agebox/internal/box/validate" keyage "github.com/slok/agebox/internal/key/age" diff --git a/cmd/agebox/main.go b/cmd/agebox/main.go index 9ac417f..19c9f4b 100644 --- a/cmd/agebox/main.go +++ b/cmd/agebox/main.go @@ -6,8 +6,8 @@ import ( "io" "os" + "github.com/alecthomas/kingpin/v2" "github.com/sirupsen/logrus" - "gopkg.in/alecthomas/kingpin.v2" "github.com/slok/agebox/cmd/agebox/commands" "github.com/slok/agebox/internal/log" diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 7e8ad19..d6239ea 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -1,7 +1,7 @@ -FROM golang:1.18.1 +FROM golang:1.23 -ARG GOLANGCI_LINT_VERSION="1.42.0" -ARG MOCKERY_VERSION="2.8.0" +ARG GOLANGCI_LINT_VERSION="1.61.0" +ARG MOCKERY_VERSION="2.46.2" ARG ostype=Linux RUN apt-get update && apt-get install -y \ diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfile index a9a73ca..23d37a6 100644 --- a/docker/prod/Dockerfile +++ b/docker/prod/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.18.1-alpine as build-stage +FROM golang:1.23-alpine as build-stage RUN apk --no-cache add \ g++ \ diff --git a/go.mod b/go.mod index 2bdff85..7bfd356 100644 --- a/go.mod +++ b/go.mod @@ -1,25 +1,25 @@ module github.com/slok/agebox -go 1.17 +go 1.23 require ( - filippo.io/age v1.0.0 + filippo.io/age v1.2.0 + github.com/alecthomas/kingpin/v2 v2.4.0 github.com/ghodss/yaml v1.0.0 - github.com/sirupsen/logrus v1.8.1 - github.com/stretchr/testify v1.7.1 - golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 - golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b - gopkg.in/alecthomas/kingpin.v2 v2.2.6 + github.com/sirupsen/logrus v1.9.3 + github.com/stretchr/testify v1.9.0 + golang.org/x/crypto v0.27.0 + golang.org/x/term v0.24.0 ) require ( - filippo.io/edwards25519 v1.0.0-rc.1 // indirect - github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect - github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 // indirect + filippo.io/edwards25519 v1.1.0 // indirect + github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/objx v0.1.0 // indirect - golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect - gopkg.in/yaml.v2 v2.2.2 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + github.com/stretchr/objx v0.5.2 // indirect + github.com/xhit/go-str2duration/v2 v2.1.0 // indirect + golang.org/x/sys v0.25.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9a7a8d1..2c89606 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,13 @@ -filippo.io/age v1.0.0 h1:V6q14n0mqYU3qKFkZ6oOaF9oXneOviS3ubXsSVBRSzc= -filippo.io/age v1.0.0/go.mod h1:PaX+Si/Sd5G8LgfCwldsSba3H1DDQZhIhFGkhbHaBq8= -filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= -filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 h1:AUNCr9CiJuwrRYS3XieqF+Z9B9gNxo/eANAJCF2eiN4= -github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +c2sp.org/CCTV/age v0.0.0-20240306222714-3ec4d716e805 h1:u2qwJeEvnypw+OCPUHmoZE3IqwfuN5kgDfo5MLzpNM0= +c2sp.org/CCTV/age v0.0.0-20240306222714-3ec4d716e805/go.mod h1:FomMrUJ2Lxt5jCLmZkG3FHa72zUprnhd3v/Z18Snm4w= +filippo.io/age v1.2.0 h1:vRDp7pUMaAJzXNIWJVAZnEf/Dyi4Vu4wI8S1LBzufhE= +filippo.io/age v1.2.0/go.mod h1:JL9ew2lTN+Pyft4RiNGguFfOpewKwSHm5ayKD/A4004= +filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= +filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= +github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY= +github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= github.com/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= @@ -13,32 +15,32 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 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/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210903071746-97244b99971b h1:3Dq0eVHn0uaQJmPO+/aYPI/fRMqdrVDbu7MQcku54gg= -golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= +github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/box/cat/catmock/secret_printer.go b/internal/box/cat/catmock/secret_printer.go index 385cda3..a23e6e6 100644 --- a/internal/box/cat/catmock/secret_printer.go +++ b/internal/box/cat/catmock/secret_printer.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.46.2. DO NOT EDIT. package catmock @@ -18,6 +18,10 @@ type SecretPrinter struct { func (_m *SecretPrinter) PrintSecret(ctx context.Context, secret *model.Secret) error { ret := _m.Called(ctx, secret) + if len(ret) == 0 { + panic("no return value specified for PrintSecret") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, *model.Secret) error); ok { r0 = rf(ctx, secret) @@ -27,3 +31,17 @@ func (_m *SecretPrinter) PrintSecret(ctx context.Context, secret *model.Secret) return r0 } + +// NewSecretPrinter creates a new instance of SecretPrinter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSecretPrinter(t interface { + mock.TestingT + Cleanup(func()) +}) *SecretPrinter { + mock := &SecretPrinter{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/key/keymock/factory.go b/internal/key/keymock/factory.go index f8adbc2..902f2cb 100644 --- a/internal/key/keymock/factory.go +++ b/internal/key/keymock/factory.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.46.2. DO NOT EDIT. package keymock @@ -19,7 +19,15 @@ type Factory struct { func (_m *Factory) GetPrivateKey(ctx context.Context, data []byte) (model.PrivateKey, error) { ret := _m.Called(ctx, data) + if len(ret) == 0 { + panic("no return value specified for GetPrivateKey") + } + var r0 model.PrivateKey + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, []byte) (model.PrivateKey, error)); ok { + return rf(ctx, data) + } if rf, ok := ret.Get(0).(func(context.Context, []byte) model.PrivateKey); ok { r0 = rf(ctx, data) } else { @@ -28,7 +36,6 @@ func (_m *Factory) GetPrivateKey(ctx context.Context, data []byte) (model.Privat } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, []byte) error); ok { r1 = rf(ctx, data) } else { @@ -42,7 +49,15 @@ func (_m *Factory) GetPrivateKey(ctx context.Context, data []byte) (model.Privat func (_m *Factory) GetPublicKey(ctx context.Context, data []byte) (model.PublicKey, error) { ret := _m.Called(ctx, data) + if len(ret) == 0 { + panic("no return value specified for GetPublicKey") + } + var r0 model.PublicKey + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, []byte) (model.PublicKey, error)); ok { + return rf(ctx, data) + } if rf, ok := ret.Get(0).(func(context.Context, []byte) model.PublicKey); ok { r0 = rf(ctx, data) } else { @@ -51,7 +66,6 @@ func (_m *Factory) GetPublicKey(ctx context.Context, data []byte) (model.PublicK } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, []byte) error); ok { r1 = rf(ctx, data) } else { @@ -60,3 +74,17 @@ func (_m *Factory) GetPublicKey(ctx context.Context, data []byte) (model.PublicK return r0, r1 } + +// NewFactory creates a new instance of Factory. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewFactory(t interface { + mock.TestingT + Cleanup(func()) +}) *Factory { + mock := &Factory{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/secret/encrypt/age/age.go b/internal/secret/encrypt/age/age.go index ad65ea2..ab40d72 100644 --- a/internal/secret/encrypt/age/age.go +++ b/internal/secret/encrypt/age/age.go @@ -49,7 +49,7 @@ func (encrypter) Encrypt(ctx context.Context, secret model.Secret, keys []model. return nil, fmt.Errorf("age could not prepare secret encrypt: %w", err) } - _, err = io.WriteString(cryptedW, string(secret.DecryptedData)) + _, err = cryptedW.Write(secret.DecryptedData) if err != nil { return nil, fmt.Errorf("could not to encrypt secret: %w", err) } diff --git a/internal/secret/encrypt/encryptmock/encrypter.go b/internal/secret/encrypt/encryptmock/encrypter.go index edea099..db75a2b 100644 --- a/internal/secret/encrypt/encryptmock/encrypter.go +++ b/internal/secret/encrypt/encryptmock/encrypter.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.46.2. DO NOT EDIT. package encryptmock @@ -19,7 +19,15 @@ type Encrypter struct { func (_m *Encrypter) Decrypt(ctx context.Context, secret model.Secret, keys []model.PrivateKey) (*model.Secret, error) { ret := _m.Called(ctx, secret, keys) + if len(ret) == 0 { + panic("no return value specified for Decrypt") + } + var r0 *model.Secret + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, model.Secret, []model.PrivateKey) (*model.Secret, error)); ok { + return rf(ctx, secret, keys) + } if rf, ok := ret.Get(0).(func(context.Context, model.Secret, []model.PrivateKey) *model.Secret); ok { r0 = rf(ctx, secret, keys) } else { @@ -28,7 +36,6 @@ func (_m *Encrypter) Decrypt(ctx context.Context, secret model.Secret, keys []mo } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, model.Secret, []model.PrivateKey) error); ok { r1 = rf(ctx, secret, keys) } else { @@ -42,7 +49,15 @@ func (_m *Encrypter) Decrypt(ctx context.Context, secret model.Secret, keys []mo func (_m *Encrypter) Encrypt(ctx context.Context, secret model.Secret, keys []model.PublicKey) (*model.Secret, error) { ret := _m.Called(ctx, secret, keys) + if len(ret) == 0 { + panic("no return value specified for Encrypt") + } + var r0 *model.Secret + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, model.Secret, []model.PublicKey) (*model.Secret, error)); ok { + return rf(ctx, secret, keys) + } if rf, ok := ret.Get(0).(func(context.Context, model.Secret, []model.PublicKey) *model.Secret); ok { r0 = rf(ctx, secret, keys) } else { @@ -51,7 +66,6 @@ func (_m *Encrypter) Encrypt(ctx context.Context, secret model.Secret, keys []mo } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, model.Secret, []model.PublicKey) error); ok { r1 = rf(ctx, secret, keys) } else { @@ -60,3 +74,17 @@ func (_m *Encrypter) Encrypt(ctx context.Context, secret model.Secret, keys []mo return r0, r1 } + +// NewEncrypter creates a new instance of Encrypter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewEncrypter(t interface { + mock.TestingT + Cleanup(func()) +}) *Encrypter { + mock := &Encrypter{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/secret/process/processmock/id_processor.go b/internal/secret/process/processmock/id_processor.go index 3ccd683..36be424 100644 --- a/internal/secret/process/processmock/id_processor.go +++ b/internal/secret/process/processmock/id_processor.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.46.2. DO NOT EDIT. package processmock @@ -17,14 +17,21 @@ type IDProcessor struct { func (_m *IDProcessor) ProcessID(ctx context.Context, secretID string) (string, error) { ret := _m.Called(ctx, secretID) + if len(ret) == 0 { + panic("no return value specified for ProcessID") + } + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (string, error)); ok { + return rf(ctx, secretID) + } if rf, ok := ret.Get(0).(func(context.Context, string) string); ok { r0 = rf(ctx, secretID) } else { r0 = ret.Get(0).(string) } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, secretID) } else { @@ -33,3 +40,17 @@ func (_m *IDProcessor) ProcessID(ctx context.Context, secretID string) (string, return r0, r1 } + +// NewIDProcessor creates a new instance of IDProcessor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewIDProcessor(t interface { + mock.TestingT + Cleanup(func()) +}) *IDProcessor { + mock := &IDProcessor{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/storage/fs/fsmock/file_manager.go b/internal/storage/fs/fsmock/file_manager.go index db6f620..26dc6fd 100644 --- a/internal/storage/fs/fsmock/file_manager.go +++ b/internal/storage/fs/fsmock/file_manager.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.46.2. DO NOT EDIT. package fsmock @@ -8,6 +8,8 @@ import ( iofs "io/fs" mock "github.com/stretchr/testify/mock" + + os "os" ) // FileManager is an autogenerated mock type for the FileManager type @@ -19,6 +21,10 @@ type FileManager struct { func (_m *FileManager) DeleteFile(ctx context.Context, path string) error { ret := _m.Called(ctx, path) + if len(ret) == 0 { + panic("no return value specified for DeleteFile") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, path) @@ -33,7 +39,15 @@ func (_m *FileManager) DeleteFile(ctx context.Context, path string) error { func (_m *FileManager) ReadFile(ctx context.Context, path string) ([]byte, error) { ret := _m.Called(ctx, path) + if len(ret) == 0 { + panic("no return value specified for ReadFile") + } + var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) ([]byte, error)); ok { + return rf(ctx, path) + } if rf, ok := ret.Get(0).(func(context.Context, string) []byte); ok { r0 = rf(ctx, path) } else { @@ -42,7 +56,6 @@ func (_m *FileManager) ReadFile(ctx context.Context, path string) ([]byte, error } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, path) } else { @@ -53,19 +66,26 @@ func (_m *FileManager) ReadFile(ctx context.Context, path string) ([]byte, error } // StatFile provides a mock function with given fields: ctx, path -func (_m *FileManager) StatFile(ctx context.Context, path string) (iofs.FileInfo, error) { +func (_m *FileManager) StatFile(ctx context.Context, path string) (os.FileInfo, error) { ret := _m.Called(ctx, path) - var r0 iofs.FileInfo - if rf, ok := ret.Get(0).(func(context.Context, string) iofs.FileInfo); ok { + if len(ret) == 0 { + panic("no return value specified for StatFile") + } + + var r0 os.FileInfo + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (os.FileInfo, error)); ok { + return rf(ctx, path) + } + if rf, ok := ret.Get(0).(func(context.Context, string) os.FileInfo); ok { r0 = rf(ctx, path) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(iofs.FileInfo) + r0 = ret.Get(0).(os.FileInfo) } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, path) } else { @@ -79,6 +99,10 @@ func (_m *FileManager) StatFile(ctx context.Context, path string) (iofs.FileInfo func (_m *FileManager) WalkDir(ctx context.Context, root string, fn iofs.WalkDirFunc) error { ret := _m.Called(ctx, root, fn) + if len(ret) == 0 { + panic("no return value specified for WalkDir") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, iofs.WalkDirFunc) error); ok { r0 = rf(ctx, root, fn) @@ -93,6 +117,10 @@ func (_m *FileManager) WalkDir(ctx context.Context, root string, fn iofs.WalkDir func (_m *FileManager) WriteFile(ctx context.Context, path string, data []byte) error { ret := _m.Called(ctx, path, data) + if len(ret) == 0 { + panic("no return value specified for WriteFile") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, []byte) error); ok { r0 = rf(ctx, path, data) @@ -102,3 +130,17 @@ func (_m *FileManager) WriteFile(ctx context.Context, path string, data []byte) return r0 } + +// NewFileManager creates a new instance of FileManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewFileManager(t interface { + mock.TestingT + Cleanup(func()) +}) *FileManager { + mock := &FileManager{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/storage/storagemock/key_repository.go b/internal/storage/storagemock/key_repository.go index 4f2d72b..c0054e5 100644 --- a/internal/storage/storagemock/key_repository.go +++ b/internal/storage/storagemock/key_repository.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.46.2. DO NOT EDIT. package storagemock @@ -20,7 +20,15 @@ type KeyRepository struct { func (_m *KeyRepository) GetPrivateKey(ctx context.Context) (model.PrivateKey, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetPrivateKey") + } + var r0 model.PrivateKey + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (model.PrivateKey, error)); ok { + return rf(ctx) + } if rf, ok := ret.Get(0).(func(context.Context) model.PrivateKey); ok { r0 = rf(ctx) } else { @@ -29,7 +37,6 @@ func (_m *KeyRepository) GetPrivateKey(ctx context.Context) (model.PrivateKey, e } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context) error); ok { r1 = rf(ctx) } else { @@ -43,7 +50,15 @@ func (_m *KeyRepository) GetPrivateKey(ctx context.Context) (model.PrivateKey, e func (_m *KeyRepository) ListPrivateKeys(ctx context.Context) (*storage.PrivateKeyList, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ListPrivateKeys") + } + var r0 *storage.PrivateKeyList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*storage.PrivateKeyList, error)); ok { + return rf(ctx) + } if rf, ok := ret.Get(0).(func(context.Context) *storage.PrivateKeyList); ok { r0 = rf(ctx) } else { @@ -52,7 +67,6 @@ func (_m *KeyRepository) ListPrivateKeys(ctx context.Context) (*storage.PrivateK } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context) error); ok { r1 = rf(ctx) } else { @@ -66,7 +80,15 @@ func (_m *KeyRepository) ListPrivateKeys(ctx context.Context) (*storage.PrivateK func (_m *KeyRepository) ListPublicKeys(ctx context.Context) (*storage.PublicKeyList, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ListPublicKeys") + } + var r0 *storage.PublicKeyList + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*storage.PublicKeyList, error)); ok { + return rf(ctx) + } if rf, ok := ret.Get(0).(func(context.Context) *storage.PublicKeyList); ok { r0 = rf(ctx) } else { @@ -75,7 +97,6 @@ func (_m *KeyRepository) ListPublicKeys(ctx context.Context) (*storage.PublicKey } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context) error); ok { r1 = rf(ctx) } else { @@ -84,3 +105,17 @@ func (_m *KeyRepository) ListPublicKeys(ctx context.Context) (*storage.PublicKey return r0, r1 } + +// NewKeyRepository creates a new instance of KeyRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewKeyRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *KeyRepository { + mock := &KeyRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/storage/storagemock/secret_repository.go b/internal/storage/storagemock/secret_repository.go index 0d38d80..79761c6 100644 --- a/internal/storage/storagemock/secret_repository.go +++ b/internal/storage/storagemock/secret_repository.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.46.2. DO NOT EDIT. package storagemock @@ -18,6 +18,10 @@ type SecretRepository struct { func (_m *SecretRepository) DeleteDecryptedSecret(ctx context.Context, id string) error { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for DeleteDecryptedSecret") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, id) @@ -32,6 +36,10 @@ func (_m *SecretRepository) DeleteDecryptedSecret(ctx context.Context, id string func (_m *SecretRepository) DeleteEncryptedSecret(ctx context.Context, id string) error { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for DeleteEncryptedSecret") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, id) @@ -46,14 +54,21 @@ func (_m *SecretRepository) DeleteEncryptedSecret(ctx context.Context, id string func (_m *SecretRepository) ExistsDecryptedSecret(ctx context.Context, id string) (bool, error) { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for ExistsDecryptedSecret") + } + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok { + return rf(ctx, id) + } if rf, ok := ret.Get(0).(func(context.Context, string) bool); ok { r0 = rf(ctx, id) } else { r0 = ret.Get(0).(bool) } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, id) } else { @@ -67,14 +82,21 @@ func (_m *SecretRepository) ExistsDecryptedSecret(ctx context.Context, id string func (_m *SecretRepository) ExistsEncryptedSecret(ctx context.Context, id string) (bool, error) { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for ExistsEncryptedSecret") + } + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok { + return rf(ctx, id) + } if rf, ok := ret.Get(0).(func(context.Context, string) bool); ok { r0 = rf(ctx, id) } else { r0 = ret.Get(0).(bool) } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, id) } else { @@ -88,7 +110,15 @@ func (_m *SecretRepository) ExistsEncryptedSecret(ctx context.Context, id string func (_m *SecretRepository) GetDecryptedSecret(ctx context.Context, id string) (*model.Secret, error) { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for GetDecryptedSecret") + } + var r0 *model.Secret + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*model.Secret, error)); ok { + return rf(ctx, id) + } if rf, ok := ret.Get(0).(func(context.Context, string) *model.Secret); ok { r0 = rf(ctx, id) } else { @@ -97,7 +127,6 @@ func (_m *SecretRepository) GetDecryptedSecret(ctx context.Context, id string) ( } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, id) } else { @@ -111,7 +140,15 @@ func (_m *SecretRepository) GetDecryptedSecret(ctx context.Context, id string) ( func (_m *SecretRepository) GetEncryptedSecret(ctx context.Context, id string) (*model.Secret, error) { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for GetEncryptedSecret") + } + var r0 *model.Secret + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*model.Secret, error)); ok { + return rf(ctx, id) + } if rf, ok := ret.Get(0).(func(context.Context, string) *model.Secret); ok { r0 = rf(ctx, id) } else { @@ -120,7 +157,6 @@ func (_m *SecretRepository) GetEncryptedSecret(ctx context.Context, id string) ( } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = rf(ctx, id) } else { @@ -134,6 +170,10 @@ func (_m *SecretRepository) GetEncryptedSecret(ctx context.Context, id string) ( func (_m *SecretRepository) SaveDecryptedSecret(ctx context.Context, secret model.Secret) error { ret := _m.Called(ctx, secret) + if len(ret) == 0 { + panic("no return value specified for SaveDecryptedSecret") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, model.Secret) error); ok { r0 = rf(ctx, secret) @@ -148,6 +188,10 @@ func (_m *SecretRepository) SaveDecryptedSecret(ctx context.Context, secret mode func (_m *SecretRepository) SaveEncryptedSecret(ctx context.Context, secret model.Secret) error { ret := _m.Called(ctx, secret) + if len(ret) == 0 { + panic("no return value specified for SaveEncryptedSecret") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, model.Secret) error); ok { r0 = rf(ctx, secret) @@ -157,3 +201,17 @@ func (_m *SecretRepository) SaveEncryptedSecret(ctx context.Context, secret mode return r0 } + +// NewSecretRepository creates a new instance of SecretRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSecretRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *SecretRepository { + mock := &SecretRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/internal/storage/storagemock/track_repository.go b/internal/storage/storagemock/track_repository.go index 05cbf0a..0c773be 100644 --- a/internal/storage/storagemock/track_repository.go +++ b/internal/storage/storagemock/track_repository.go @@ -1,4 +1,4 @@ -// Code generated by mockery (devel). DO NOT EDIT. +// Code generated by mockery v2.46.2. DO NOT EDIT. package storagemock @@ -18,7 +18,15 @@ type TrackRepository struct { func (_m *TrackRepository) GetSecretRegistry(ctx context.Context) (*model.SecretRegistry, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetSecretRegistry") + } + var r0 *model.SecretRegistry + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*model.SecretRegistry, error)); ok { + return rf(ctx) + } if rf, ok := ret.Get(0).(func(context.Context) *model.SecretRegistry); ok { r0 = rf(ctx) } else { @@ -27,7 +35,6 @@ func (_m *TrackRepository) GetSecretRegistry(ctx context.Context) (*model.Secret } } - var r1 error if rf, ok := ret.Get(1).(func(context.Context) error); ok { r1 = rf(ctx) } else { @@ -41,6 +48,10 @@ func (_m *TrackRepository) GetSecretRegistry(ctx context.Context) (*model.Secret func (_m *TrackRepository) SaveSecretRegistry(ctx context.Context, reg model.SecretRegistry) error { ret := _m.Called(ctx, reg) + if len(ret) == 0 { + panic("no return value specified for SaveSecretRegistry") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, model.SecretRegistry) error); ok { r0 = rf(ctx, reg) @@ -50,3 +61,17 @@ func (_m *TrackRepository) SaveSecretRegistry(ctx context.Context, reg model.Sec return r0 } + +// NewTrackRepository creates a new instance of TrackRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewTrackRepository(t interface { + mock.TestingT + Cleanup(func()) +}) *TrackRepository { + mock := &TrackRepository{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}