diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 88ac1179..04307a19 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 with: show-progress: false - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version-file: go.work cache-dependency-path: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b462894f..65e25260 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: with: show-progress: false - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version-file: go.work cache-dependency-path: | diff --git a/.golangci.yaml b/.golangci.yaml index 6456a4a3..fbf2d015 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,24 +1,46 @@ +issues: + exclude-rules: + # Test functions tend to be quite long due to the large amount of fixtures & test data etc. + - linters: + - funlen + path: _test\.go + text: "is too long" + # There's no need to wrap errors in a test. + - linters: + - wrapcheck + path: _test\.go + text: "error returned from external package is unwrapped" + linters: enable-all: true disable: - - deadcode # deprecated + # tmpfix - currently breaking things + - musttag + - depguard - exhaustruct - - exhaustivestruct # deprecated - forcetypeassert - - golint # deprecated - - gomodguard + - godox - gomoddirectives - - ifshort # deprecated - - interfacer # deprecated - - maligned # deprecated - - nosnakecase # deprecated - - rowserrcheck # disabled because of generics - - scopelint # deprecated - - structcheck # deprecated - - testableexamples # deprecated + - gomodguard + - ireturn - varcheck - - wastedassign # disabled because of generics + + # deprecated + - deadcode + - exhaustivestruct + - golint + - ifshort + - interfacer + - maligned + - nosnakecase + - scopelint + - structcheck + - testableexamples + + # disabled because of generics + - rowserrcheck + - wastedassign linters-settings: gomoddirectives: @@ -34,9 +56,15 @@ linters-settings: skip-generated: true custom-order: true - varnamelen: - ignore-names: - - ID + revive: + confidence: 0.1 + severity: warning + rules: + - name: exported + severity: error + disabled: false + arguments: + - checkPrivateReceivers run: - timeout: 30m + timeout: "5m" diff --git a/.taskfiles/tools/golangci-lint.yml b/.taskfiles/tools/golangci-lint.yml index 165c46fc..a8cf8117 100644 --- a/.taskfiles/tools/golangci-lint.yml +++ b/.taskfiles/tools/golangci-lint.yml @@ -40,4 +40,4 @@ tasks: - ./**/*.go cmds: - task: golangci-lint - vars: { ARGS: '--fix --timeout=10m' } + vars: { ARGS: '--fix' } diff --git a/adapters/azuread/go.mod b/adapters/azuread/go.mod index a3b9ce02..016b9191 100644 --- a/adapters/azuread/go.mod +++ b/adapters/azuread/go.mod @@ -3,41 +3,43 @@ module github.com/ovotech/go-sync/adapters/azuread go 1.21 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 - github.com/microsoft/kiota-abstractions-go v1.2.1 - github.com/microsoftgraph/msgraph-sdk-go v1.19.0 - github.com/microsoftgraph/msgraph-sdk-go-core v1.0.0 - github.com/ovotech/go-sync v0.13.2 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 + github.com/microsoft/kiota-abstractions-go v1.5.3 + github.com/microsoftgraph/msgraph-sdk-go v1.27.0 + github.com/microsoftgraph/msgraph-sdk-go-core v1.0.1 + github.com/ovotech/go-sync v0.14.0 github.com/stretchr/testify v1.8.4 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0 // indirect github.com/cjlapao/common-go v0.0.39 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang-jwt/jwt/v5 v5.0.0 // indirect - github.com/google/uuid v1.3.1 // indirect + github.com/google/uuid v1.4.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect - github.com/microsoft/kiota-authentication-azure-go v1.0.0 // indirect - github.com/microsoft/kiota-http-go v1.1.0 // indirect + github.com/microsoft/kiota-authentication-azure-go v1.0.1 // indirect + github.com/microsoft/kiota-http-go v1.1.1 // indirect github.com/microsoft/kiota-serialization-form-go v1.0.0 // indirect github.com/microsoft/kiota-serialization-json-go v1.0.4 // indirect github.com/microsoft/kiota-serialization-multipart-go v1.0.0 // indirect github.com/microsoft/kiota-serialization-text-go v1.0.0 // indirect + github.com/ovotech/go-sync/adapters/github v0.13.2 // indirect + github.com/ovotech/go-sync/adapters/slack v0.13.2 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/std-uritemplate/std-uritemplate/go v0.0.47 // indirect github.com/stretchr/objx v0.5.1 // indirect - github.com/yosida95/uritemplate/v3 v3.0.2 // indirect - go.opentelemetry.io/otel v1.17.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect + golang.org/x/crypto v0.16.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/adapters/azuread/go.sum b/adapters/azuread/go.sum index f9a1a0d0..2eb53bb1 100644 --- a/adapters/azuread/go.sum +++ b/adapters/azuread/go.sum @@ -1,9 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2 h1:t5+QXLCK9SVi0PPdaY0PrFvYUo24KwA0QwxnaHRSVd4= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 h1:lGlwhPtrX6EVml1hO0ivjkUxsSyl4dsiw9qcA1k/3IQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1/go.mod h1:RKUqNu35KJYcVG/fqTRqmuXJZYNhYkBrnC/hX7yGbTA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 h1:6oNBlSdi1QqM1PNW7FPA6xOGA5UNsXnkaYZz9vdPGhA= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0 h1:hVeq+yCyUi+MsoO/CU95yqCIcdzra5ovzk8Q2BBpV2M= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/cjlapao/common-go v0.0.39 h1:bAAUrj2B9v0kMzbAOhzjSmiyDy+rd56r2sy7oEiQLlA= @@ -14,28 +14,36 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-github/v47 v47.1.0 h1:Cacm/WxQBOa9lF0FT0EMjZ2BWMetQ1TQfyurn4yF1z8= +github.com/google/go-github/v47 v47.1.0/go.mod h1:VPZBXNbFSJGjyjFRUKo9vZGawTajnWzC/YjGw/oFKi0= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 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/microsoft/kiota-abstractions-go v1.2.1 h1:TnLF7rjy1GfhuGK2ra/a3Vuz6piFXTR1OfdNoqesagA= -github.com/microsoft/kiota-abstractions-go v1.2.1/go.mod h1:rEeeaytcnal/If3f1tz6/spFz4V+Hiqvz3rxF+oWQFA= -github.com/microsoft/kiota-authentication-azure-go v1.0.0 h1:29FNZZ/4nnCOwFcGWlB/sxPvWz487HA2bXH8jR5k2Rk= -github.com/microsoft/kiota-authentication-azure-go v1.0.0/go.mod h1:rnx3PRlkGdXDcA/0lZQTbBwyYGmc+3POt7HpE/e4jGw= -github.com/microsoft/kiota-http-go v1.1.0 h1:L5I93EiNtlP/X6YzeTlhjWt7Q1DxzC9CmWSVtX3b0tE= -github.com/microsoft/kiota-http-go v1.1.0/go.mod h1:zESUM6ovki9LEupqziCbxJ+FAYoF0dFDYZVpOkAfSLc= +github.com/microsoft/kiota-abstractions-go v1.5.3 h1:qUTwuXCbMi99EkHaTh5NGMK5MOKxJn7u/M2FbYcesLY= +github.com/microsoft/kiota-abstractions-go v1.5.3/go.mod h1:xyBzTVCYrp7QBW4/p+RFi44PHwp/IPn2dZepuV4nF80= +github.com/microsoft/kiota-authentication-azure-go v1.0.1 h1:F4HH+2QQHSecQg50gVEZaUcxA8/XxCaC2oOMYv2gTIM= +github.com/microsoft/kiota-authentication-azure-go v1.0.1/go.mod h1:IbifJeoi+sULI0vjnsWYSmDu5atFo/4FZ6WCoAkPjsc= +github.com/microsoft/kiota-http-go v1.1.1 h1:W4Olo7Z/MwNZCfkcvH/5eLhnn7koRBMMRhLEnf5MPKo= +github.com/microsoft/kiota-http-go v1.1.1/go.mod h1:QzhhfW5xkoUuT+/ohflpHJvumWeXIxa/Xl0GmQ2M6mY= github.com/microsoft/kiota-serialization-form-go v1.0.0 h1:UNdrkMnLFqUCccQZerKjblsyVgifS11b3WCx+eFEsAI= github.com/microsoft/kiota-serialization-form-go v1.0.0/go.mod h1:h4mQOO6KVTNciMF6azi1J9QB19ujSw3ULKcSNyXXOMA= github.com/microsoft/kiota-serialization-json-go v1.0.4 h1:5TaISWwd2Me8clrK7SqNATo0tv9seOq59y4I5953egQ= @@ -44,16 +52,28 @@ github.com/microsoft/kiota-serialization-multipart-go v1.0.0 h1:3O5sb5Zj+moLBiJy github.com/microsoft/kiota-serialization-multipart-go v1.0.0/go.mod h1:yauLeBTpANk4L03XD985akNysG24SnRJGaveZf+p4so= github.com/microsoft/kiota-serialization-text-go v1.0.0 h1:XOaRhAXy+g8ZVpcq7x7a0jlETWnWrEum0RhmbYrTFnA= github.com/microsoft/kiota-serialization-text-go v1.0.0/go.mod h1:sM1/C6ecnQ7IquQOGUrUldaO5wj+9+v7G2W3sQ3fy6M= -github.com/microsoftgraph/msgraph-sdk-go v1.19.0 h1:hx+SvDTm5ENYZFqmMIskF7tOn48zzT2Xv3OVFrxl2dc= -github.com/microsoftgraph/msgraph-sdk-go v1.19.0/go.mod h1:3DArbqPS7riix0VsJhdtYsgPaAFAH9Jer64psW55riI= -github.com/microsoftgraph/msgraph-sdk-go-core v1.0.0 h1:7NWTfyXvOjoizW7PmxNp3+8wCKPgpODs/D1cUZ3fkAY= -github.com/microsoftgraph/msgraph-sdk-go-core v1.0.0/go.mod h1:tQb4q3YMIj2dWhhXhQSJ4ELpol931ANKzHSYK5kX1qE= -github.com/ovotech/go-sync v0.13.2 h1:glAwZ3gKSVdgtZHWHYp+SuWabXCEzeqti4yMryA4lM4= -github.com/ovotech/go-sync v0.13.2/go.mod h1:mzYty1nlJJQzuT+Gv72YckTJZpUYg3WD8YlgjoRPQ7Y= +github.com/microsoftgraph/msgraph-sdk-go v1.27.0 h1:NweNttDzDCnxx0/4SUJAIoCEF5PXJ0z6GawzINCqo1w= +github.com/microsoftgraph/msgraph-sdk-go v1.27.0/go.mod h1:X1YSI/eL/Uc2/5dWf1tgOiINpnV242AbCYbzN42AXxw= +github.com/microsoftgraph/msgraph-sdk-go-core v1.0.1 h1:uq4qZD8VXLiNZY0t4NoRpLDoEiNYJvAQK3hc0ZMmdxs= +github.com/microsoftgraph/msgraph-sdk-go-core v1.0.1/go.mod h1:HUITyuFN556+0QZ/IVfH5K4FyJM7kllV6ExKi2ImKhE= +github.com/ovotech/go-sync v0.14.0 h1:u3HMaBDyJv/hHjkZtT9HteCp8B/RxIA1c1jo9szu7Vc= +github.com/ovotech/go-sync v0.14.0/go.mod h1:XPOzxy51H6Vs+1yIOKlZqjijGl4xxzqTMi96qMZWg6k= +github.com/ovotech/go-sync/adapters/github v0.13.2 h1:AoIF6z0azDznCGV2ATGO4Oz/MykgvosbYpM7JP4j6qQ= +github.com/ovotech/go-sync/adapters/github v0.13.2/go.mod h1:XIpPUilPyMWf9BFtG6Fmvl+z3SlxTiBAMEbT2KdOQYI= +github.com/ovotech/go-sync/adapters/slack v0.13.2 h1:DZkms9RiiD0Gvbn/2/XmLwUKHVrsuy/N2SBH8etwHY0= +github.com/ovotech/go-sync/adapters/slack v0.13.2/go.mod h1:w/2rcd159t65Q4LJVUfF3H+KlJkFw8Vo1DdqOg/sjLg= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 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/shurcooL/githubv4 v0.0.0-20220520033151-0b4e3294ff00 h1:fiFvD4lT0aWjuuAb64LlZ/67v87m+Kc9Qsu5cMFNK0w= +github.com/shurcooL/githubv4 v0.0.0-20220520033151-0b4e3294ff00/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= +github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 h1:B1PEwpArrNp4dkQrfxh/abbBAOZBVp0ds+fBEOUOqOc= +github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29/go.mod h1:AuYgA5Kyo4c7HfUmvRGs/6rGlMMV/6B1bVnB9JxJEEg= +github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= +github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= +github.com/std-uritemplate/std-uritemplate/go v0.0.47 h1:erzz/DR4sOzWr0ca2MgSTkMckpLEsDySaTZwVFQq9zw= +github.com/std-uritemplate/std-uritemplate/go v0.0.47/go.mod h1:Qov4Ay4U83j37XjgxMYevGJFLbnZ2o9cEOhGufBKgKY= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 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= @@ -64,23 +84,27 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= -github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= -go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= -go.opentelemetry.io/otel v1.17.0/go.mod h1:I2vmBGtFaODIVMBSTPVDlJSzBDNf93k60E6Ft0nyjo0= -go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= -go.opentelemetry.io/otel/metric v1.17.0/go.mod h1:h4skoxdZI17AxwITdmdZjjYJQH5nzijUUjm+wtPph5o= -go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= -go.opentelemetry.io/otel/trace v1.17.0/go.mod h1:I/4vKTgFclIsXRVucpH25X0mpFSczM7aHeaz0ZBLWjY= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= +golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/adapters/azuread/groupmembership/groupmembership.go b/adapters/azuread/groupmembership/groupmembership.go index 316f3eaf..0e879d22 100644 --- a/adapters/azuread/groupmembership/groupmembership.go +++ b/adapters/azuread/groupmembership/groupmembership.go @@ -45,14 +45,20 @@ type iClient interface { var _ iClient = &msgraphsdkgo.GraphServiceClient{} type iGroupClient interface { - Get(context.Context, *groups.GroupsRequestBuilderGetRequestConfiguration) (models.GroupCollectionResponseable, error) - ByGroupId(string) *groups.GroupItemRequestBuilder + Get( + ctx context.Context, + config *groups.GroupsRequestBuilderGetRequestConfiguration, + ) (models.GroupCollectionResponseable, error) + ByGroupId(id string) *groups.GroupItemRequestBuilder } var _ iGroupClient = &groups.GroupsRequestBuilder{} type iUserClient interface { - Get(context.Context, *users.UsersRequestBuilderGetRequestConfiguration) (models.UserCollectionResponseable, error) + Get( + ctx context.Context, + config *users.UsersRequestBuilderGetRequestConfiguration, + ) (models.UserCollectionResponseable, error) } var _ iUserClient = &users.UsersRequestBuilder{} diff --git a/adapters/azuread/groupmembership/groupmembership_integration_test.go b/adapters/azuread/groupmembership/groupmembership_integration_test.go index a6a2d34e..33b58a73 100644 --- a/adapters/azuread/groupmembership/groupmembership_integration_test.go +++ b/adapters/azuread/groupmembership/groupmembership_integration_test.go @@ -29,23 +29,23 @@ func TestIntegration(t *testing.T) { adapter, err := Init(ctx, map[gosync.ConfigKey]string{ GroupName: *group, }) - assert.NoError(t, err) + require.NoError(t, err) emails, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.NotContainsf(t, emails, *email, "Email %s already exists in the group %s", *email, *group) err = adapter.Add(ctx, []string{*email}) - assert.NoError(t, err) + require.NoError(t, err) emails, err = adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.Containsf(t, emails, *email, "Email %s not found after adding it to the group", *email) err = adapter.Remove(ctx, []string{*email}) - assert.NoError(t, err) + require.NoError(t, err) emails, err = adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.NotContainsf(t, emails, *email, "Email %s still exists after removing it from the group %s", *email, *group) } diff --git a/adapters/azuread/groupmembership/groupmembership_internal_test.go b/adapters/azuread/groupmembership/groupmembership_internal_test.go index f23c639e..3c64098c 100644 --- a/adapters/azuread/groupmembership/groupmembership_internal_test.go +++ b/adapters/azuread/groupmembership/groupmembership_internal_test.go @@ -16,6 +16,7 @@ import ( "github.com/microsoftgraph/msgraph-sdk-go/users" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -32,7 +33,7 @@ func TestInit(t *testing.T) { GroupName: "example", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &GroupMembership{}, adapter) assert.Equal(t, "example", adapter.group) }) @@ -45,7 +46,7 @@ func TestInit(t *testing.T) { _, err := Init(ctx, map[gosync.ConfigKey]string{}) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorIs(t, err, gosync.ErrMissingConfig) }) }) } @@ -87,7 +88,7 @@ func Test_resolveGroupID(t *testing.T) { gid, err := resolveGroupID(ctx, client, group) assert.Empty(t, gid) - assert.ErrorIs(t, err, ErrNoResults) + require.ErrorIs(t, err, ErrNoResults) }) t.Run("one found", func(t *testing.T) { @@ -97,7 +98,7 @@ func Test_resolveGroupID(t *testing.T) { gid, err := resolveGroupID(ctx, client, group) assert.Contains(t, gid, "00000001-0000-0000-0000-000123456789") - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("multiple found", func(t *testing.T) { @@ -110,7 +111,7 @@ func Test_resolveGroupID(t *testing.T) { gid, err := resolveGroupID(ctx, client, group) assert.Empty(t, gid) - assert.ErrorIs(t, err, ErrTooManyResults) + require.ErrorIs(t, err, ErrTooManyResults) }) } @@ -151,7 +152,7 @@ func Test_resolveUserID(t *testing.T) { gid, err := resolveUserID(ctx, client, email) assert.Empty(t, gid) - assert.ErrorIs(t, err, ErrNoResults) + require.ErrorIs(t, err, ErrNoResults) }) t.Run("one found", func(t *testing.T) { @@ -161,7 +162,7 @@ func Test_resolveUserID(t *testing.T) { gid, err := resolveUserID(ctx, client, email) assert.Contains(t, gid, "00000001-1000-0000-0000-000123456789") - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("multiple found", func(t *testing.T) { @@ -171,7 +172,7 @@ func Test_resolveUserID(t *testing.T) { gid, err := resolveUserID(ctx, client, email) assert.Empty(t, gid) - assert.ErrorIs(t, err, ErrTooManyResults) + require.ErrorIs(t, err, ErrTooManyResults) }) } @@ -229,11 +230,10 @@ func TestGroupMembership_Get(t *testing.T) { } out, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, out, expected) } -//nolint:funlen func TestGroupMembership_Add(t *testing.T) { t.Parallel() @@ -312,10 +312,9 @@ func TestGroupMembership_Add(t *testing.T) { expected := []string{userMail1, userMail2} err := adapter.Add(ctx, expected) - assert.NoError(t, err) + require.NoError(t, err) } -//nolint:funlen func TestGroupMembership_Remove(t *testing.T) { t.Parallel() @@ -384,7 +383,7 @@ func TestGroupMembership_Remove(t *testing.T) { } err := adapter.Remove(ctx, []string{userMail1, userMail2}) - assert.NoError(t, err) + require.NoError(t, err) } type MockRequestAdapter struct { @@ -467,11 +466,11 @@ func (r *MockRequestAdapter) GetSerializationWriterFactory() serialization.Seria func (r *MockRequestAdapter) EnableBackingStore(_ store.BackingStoreFactory) { } -//nolint:revive,stylecheck +//nolint:stylecheck func (r *MockRequestAdapter) SetBaseUrl(_ string) { } -//nolint:revive,stylecheck +//nolint:stylecheck func (r *MockRequestAdapter) GetBaseUrl() string { return "" } diff --git a/adapters/azuread/groupmembership/mock_iClient_test.go b/adapters/azuread/groupmembership/mock_iClient_test.go index 8bd3cb3b..6eb5a368 100644 --- a/adapters/azuread/groupmembership/mock_iClient_test.go +++ b/adapters/azuread/groupmembership/mock_iClient_test.go @@ -24,6 +24,10 @@ func (_m *mockIClient) EXPECT() *mockIClient_Expecter { func (_m *mockIClient) GetAdapter() abstractions.RequestAdapter { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetAdapter") + } + var r0 abstractions.RequestAdapter if rf, ok := ret.Get(0).(func() abstractions.RequestAdapter); ok { r0 = rf() diff --git a/adapters/azuread/groupmembership/mock_iGroupClient_test.go b/adapters/azuread/groupmembership/mock_iGroupClient_test.go index a39e8f14..350c3bd6 100644 --- a/adapters/azuread/groupmembership/mock_iGroupClient_test.go +++ b/adapters/azuread/groupmembership/mock_iGroupClient_test.go @@ -23,13 +23,17 @@ func (_m *mockIGroupClient) EXPECT() *mockIGroupClient_Expecter { return &mockIGroupClient_Expecter{mock: &_m.Mock} } -// ByGroupId provides a mock function with given fields: _a0 -func (_m *mockIGroupClient) ByGroupId(_a0 string) *groups.GroupItemRequestBuilder { - ret := _m.Called(_a0) +// ByGroupId provides a mock function with given fields: id +func (_m *mockIGroupClient) ByGroupId(id string) *groups.GroupItemRequestBuilder { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for ByGroupId") + } var r0 *groups.GroupItemRequestBuilder if rf, ok := ret.Get(0).(func(string) *groups.GroupItemRequestBuilder); ok { - r0 = rf(_a0) + r0 = rf(id) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*groups.GroupItemRequestBuilder) @@ -45,12 +49,12 @@ type mockIGroupClient_ByGroupId_Call struct { } // ByGroupId is a helper method to define mock.On call -// - _a0 string -func (_e *mockIGroupClient_Expecter) ByGroupId(_a0 interface{}) *mockIGroupClient_ByGroupId_Call { - return &mockIGroupClient_ByGroupId_Call{Call: _e.mock.On("ByGroupId", _a0)} +// - id string +func (_e *mockIGroupClient_Expecter) ByGroupId(id interface{}) *mockIGroupClient_ByGroupId_Call { + return &mockIGroupClient_ByGroupId_Call{Call: _e.mock.On("ByGroupId", id)} } -func (_c *mockIGroupClient_ByGroupId_Call) Run(run func(_a0 string)) *mockIGroupClient_ByGroupId_Call { +func (_c *mockIGroupClient_ByGroupId_Call) Run(run func(id string)) *mockIGroupClient_ByGroupId_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(string)) }) @@ -67,17 +71,21 @@ func (_c *mockIGroupClient_ByGroupId_Call) RunAndReturn(run func(string) *groups return _c } -// Get provides a mock function with given fields: _a0, _a1 -func (_m *mockIGroupClient) Get(_a0 context.Context, _a1 *groups.GroupsRequestBuilderGetRequestConfiguration) (models.GroupCollectionResponseable, error) { - ret := _m.Called(_a0, _a1) +// Get provides a mock function with given fields: ctx, config +func (_m *mockIGroupClient) Get(ctx context.Context, config *groups.GroupsRequestBuilderGetRequestConfiguration) (models.GroupCollectionResponseable, error) { + ret := _m.Called(ctx, config) + + if len(ret) == 0 { + panic("no return value specified for Get") + } var r0 models.GroupCollectionResponseable var r1 error if rf, ok := ret.Get(0).(func(context.Context, *groups.GroupsRequestBuilderGetRequestConfiguration) (models.GroupCollectionResponseable, error)); ok { - return rf(_a0, _a1) + return rf(ctx, config) } if rf, ok := ret.Get(0).(func(context.Context, *groups.GroupsRequestBuilderGetRequestConfiguration) models.GroupCollectionResponseable); ok { - r0 = rf(_a0, _a1) + r0 = rf(ctx, config) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(models.GroupCollectionResponseable) @@ -85,7 +93,7 @@ func (_m *mockIGroupClient) Get(_a0 context.Context, _a1 *groups.GroupsRequestBu } if rf, ok := ret.Get(1).(func(context.Context, *groups.GroupsRequestBuilderGetRequestConfiguration) error); ok { - r1 = rf(_a0, _a1) + r1 = rf(ctx, config) } else { r1 = ret.Error(1) } @@ -99,13 +107,13 @@ type mockIGroupClient_Get_Call struct { } // Get is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *groups.GroupsRequestBuilderGetRequestConfiguration -func (_e *mockIGroupClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *mockIGroupClient_Get_Call { - return &mockIGroupClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +// - ctx context.Context +// - config *groups.GroupsRequestBuilderGetRequestConfiguration +func (_e *mockIGroupClient_Expecter) Get(ctx interface{}, config interface{}) *mockIGroupClient_Get_Call { + return &mockIGroupClient_Get_Call{Call: _e.mock.On("Get", ctx, config)} } -func (_c *mockIGroupClient_Get_Call) Run(run func(_a0 context.Context, _a1 *groups.GroupsRequestBuilderGetRequestConfiguration)) *mockIGroupClient_Get_Call { +func (_c *mockIGroupClient_Get_Call) Run(run func(ctx context.Context, config *groups.GroupsRequestBuilderGetRequestConfiguration)) *mockIGroupClient_Get_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(*groups.GroupsRequestBuilderGetRequestConfiguration)) }) diff --git a/adapters/azuread/groupmembership/mock_iUserClient_test.go b/adapters/azuread/groupmembership/mock_iUserClient_test.go index d20f7ea3..f4e24b84 100644 --- a/adapters/azuread/groupmembership/mock_iUserClient_test.go +++ b/adapters/azuread/groupmembership/mock_iUserClient_test.go @@ -23,17 +23,21 @@ func (_m *mockIUserClient) EXPECT() *mockIUserClient_Expecter { return &mockIUserClient_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: _a0, _a1 -func (_m *mockIUserClient) Get(_a0 context.Context, _a1 *users.UsersRequestBuilderGetRequestConfiguration) (models.UserCollectionResponseable, error) { - ret := _m.Called(_a0, _a1) +// Get provides a mock function with given fields: ctx, config +func (_m *mockIUserClient) Get(ctx context.Context, config *users.UsersRequestBuilderGetRequestConfiguration) (models.UserCollectionResponseable, error) { + ret := _m.Called(ctx, config) + + if len(ret) == 0 { + panic("no return value specified for Get") + } var r0 models.UserCollectionResponseable var r1 error if rf, ok := ret.Get(0).(func(context.Context, *users.UsersRequestBuilderGetRequestConfiguration) (models.UserCollectionResponseable, error)); ok { - return rf(_a0, _a1) + return rf(ctx, config) } if rf, ok := ret.Get(0).(func(context.Context, *users.UsersRequestBuilderGetRequestConfiguration) models.UserCollectionResponseable); ok { - r0 = rf(_a0, _a1) + r0 = rf(ctx, config) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(models.UserCollectionResponseable) @@ -41,7 +45,7 @@ func (_m *mockIUserClient) Get(_a0 context.Context, _a1 *users.UsersRequestBuild } if rf, ok := ret.Get(1).(func(context.Context, *users.UsersRequestBuilderGetRequestConfiguration) error); ok { - r1 = rf(_a0, _a1) + r1 = rf(ctx, config) } else { r1 = ret.Error(1) } @@ -55,13 +59,13 @@ type mockIUserClient_Get_Call struct { } // Get is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *users.UsersRequestBuilderGetRequestConfiguration -func (_e *mockIUserClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *mockIUserClient_Get_Call { - return &mockIUserClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +// - ctx context.Context +// - config *users.UsersRequestBuilderGetRequestConfiguration +func (_e *mockIUserClient_Expecter) Get(ctx interface{}, config interface{}) *mockIUserClient_Get_Call { + return &mockIUserClient_Get_Call{Call: _e.mock.On("Get", ctx, config)} } -func (_c *mockIUserClient_Get_Call) Run(run func(_a0 context.Context, _a1 *users.UsersRequestBuilderGetRequestConfiguration)) *mockIUserClient_Get_Call { +func (_c *mockIUserClient_Get_Call) Run(run func(ctx context.Context, config *users.UsersRequestBuilderGetRequestConfiguration)) *mockIUserClient_Get_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(*users.UsersRequestBuilderGetRequestConfiguration)) }) diff --git a/adapters/azuread/user/mock_iClient_test.go b/adapters/azuread/user/mock_iClient_test.go index 99451748..5cbef357 100644 --- a/adapters/azuread/user/mock_iClient_test.go +++ b/adapters/azuread/user/mock_iClient_test.go @@ -25,6 +25,10 @@ func (_m *mockIClient) EXPECT() *mockIClient_Expecter { func (_m *mockIClient) GetAdapter() abstractions.RequestAdapter { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetAdapter") + } + var r0 abstractions.RequestAdapter if rf, ok := ret.Get(0).(func() abstractions.RequestAdapter); ok { r0 = rf() @@ -68,6 +72,10 @@ func (_c *mockIClient_GetAdapter_Call) RunAndReturn(run func() abstractions.Requ func (_m *mockIClient) Users() *users.UsersRequestBuilder { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Users") + } + var r0 *users.UsersRequestBuilder if rf, ok := ret.Get(0).(func() *users.UsersRequestBuilder); ok { r0 = rf() diff --git a/adapters/azuread/user/mock_iUser_test.go b/adapters/azuread/user/mock_iUser_test.go index 8677d922..fd079bff 100644 --- a/adapters/azuread/user/mock_iUser_test.go +++ b/adapters/azuread/user/mock_iUser_test.go @@ -23,17 +23,21 @@ func (_m *mockIUser) EXPECT() *mockIUser_Expecter { return &mockIUser_Expecter{mock: &_m.Mock} } -// Get provides a mock function with given fields: _a0, _a1 -func (_m *mockIUser) Get(_a0 context.Context, _a1 *users.UsersRequestBuilderGetRequestConfiguration) (models.UserCollectionResponseable, error) { - ret := _m.Called(_a0, _a1) +// Get provides a mock function with given fields: ctx, config +func (_m *mockIUser) Get(ctx context.Context, config *users.UsersRequestBuilderGetRequestConfiguration) (models.UserCollectionResponseable, error) { + ret := _m.Called(ctx, config) + + if len(ret) == 0 { + panic("no return value specified for Get") + } var r0 models.UserCollectionResponseable var r1 error if rf, ok := ret.Get(0).(func(context.Context, *users.UsersRequestBuilderGetRequestConfiguration) (models.UserCollectionResponseable, error)); ok { - return rf(_a0, _a1) + return rf(ctx, config) } if rf, ok := ret.Get(0).(func(context.Context, *users.UsersRequestBuilderGetRequestConfiguration) models.UserCollectionResponseable); ok { - r0 = rf(_a0, _a1) + r0 = rf(ctx, config) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(models.UserCollectionResponseable) @@ -41,7 +45,7 @@ func (_m *mockIUser) Get(_a0 context.Context, _a1 *users.UsersRequestBuilderGetR } if rf, ok := ret.Get(1).(func(context.Context, *users.UsersRequestBuilderGetRequestConfiguration) error); ok { - r1 = rf(_a0, _a1) + r1 = rf(ctx, config) } else { r1 = ret.Error(1) } @@ -55,13 +59,13 @@ type mockIUser_Get_Call struct { } // Get is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 *users.UsersRequestBuilderGetRequestConfiguration -func (_e *mockIUser_Expecter) Get(_a0 interface{}, _a1 interface{}) *mockIUser_Get_Call { - return &mockIUser_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +// - ctx context.Context +// - config *users.UsersRequestBuilderGetRequestConfiguration +func (_e *mockIUser_Expecter) Get(ctx interface{}, config interface{}) *mockIUser_Get_Call { + return &mockIUser_Get_Call{Call: _e.mock.On("Get", ctx, config)} } -func (_c *mockIUser_Get_Call) Run(run func(_a0 context.Context, _a1 *users.UsersRequestBuilderGetRequestConfiguration)) *mockIUser_Get_Call { +func (_c *mockIUser_Get_Call) Run(run func(ctx context.Context, config *users.UsersRequestBuilderGetRequestConfiguration)) *mockIUser_Get_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(*users.UsersRequestBuilderGetRequestConfiguration)) }) diff --git a/adapters/azuread/user/user.go b/adapters/azuread/user/user.go index 8c7440fb..4d213f5c 100644 --- a/adapters/azuread/user/user.go +++ b/adapters/azuread/user/user.go @@ -42,7 +42,10 @@ See the [reference] for more information on filter queries. const Filter gosync.ConfigKey = "filter" type iUser interface { - Get(context.Context, *users.UsersRequestBuilderGetRequestConfiguration) (models.UserCollectionResponseable, error) + Get( + ctx context.Context, + config *users.UsersRequestBuilderGetRequestConfiguration, + ) (models.UserCollectionResponseable, error) } type iClient interface { diff --git a/adapters/azuread/user/user_integration_test.go b/adapters/azuread/user/user_integration_test.go index d49a09c8..e9f3225b 100644 --- a/adapters/azuread/user/user_integration_test.go +++ b/adapters/azuread/user/user_integration_test.go @@ -20,9 +20,9 @@ func TestIntegration(t *testing.T) { adapter, err := Init(ctx, map[gosync.ConfigKey]string{ Filter: fmt.Sprintf("mail eq '%s'", *email), }) - assert.NoError(t, err) + require.NoError(t, err) emails, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, emails, []string{*email}) } diff --git a/adapters/azuread/user/user_internal_test.go b/adapters/azuread/user/user_internal_test.go index ecf7f97f..b1195cf2 100644 --- a/adapters/azuread/user/user_internal_test.go +++ b/adapters/azuread/user/user_internal_test.go @@ -11,6 +11,7 @@ import ( "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -95,11 +96,11 @@ func (r *MockRequestAdapter) GetSerializationWriterFactory() serialization.Seria func (r *MockRequestAdapter) EnableBackingStore(_ store.BackingStoreFactory) { } -//nolint:revive,stylecheck +//nolint:stylecheck func (r *MockRequestAdapter) SetBaseUrl(_ string) { } -//nolint:revive,stylecheck +//nolint:stylecheck func (r *MockRequestAdapter) GetBaseUrl() string { return "" } @@ -115,7 +116,7 @@ func TestTeam_Get(t *testing.T) { mockClient.EXPECT().GetAdapter().Return(&MockRequestAdapter{}) adapter, err := Init(context.TODO(), nil, WithClient(mockClient)) - assert.NoError(t, err) + require.NoError(t, err) adapter.users = mockUser @@ -149,11 +150,11 @@ func TestTeam_Add(t *testing.T) { mockClient := newMockIClient(t) adapter, err := Init(context.TODO(), nil, WithClient(mockClient)) - assert.NoError(t, err) + require.NoError(t, err) err = adapter.Add(context.TODO(), []string{"foo@email", "bar@email"}) - assert.ErrorIs(t, err, gosync.ErrReadOnly) + require.ErrorIs(t, err, gosync.ErrReadOnly) } func TestTeam_Remove(t *testing.T) { @@ -162,11 +163,11 @@ func TestTeam_Remove(t *testing.T) { mockClient := newMockIClient(t) adapter, err := Init(context.TODO(), nil, WithClient(mockClient)) - assert.NoError(t, err) + require.NoError(t, err) err = adapter.Remove(context.TODO(), []string{"foo@email", "bar@email"}) - assert.ErrorIs(t, err, gosync.ErrReadOnly) + require.ErrorIs(t, err, gosync.ErrReadOnly) } func Test_isAdvancedQuery(t *testing.T) { @@ -220,7 +221,7 @@ func TestInit(t *testing.T) { Filter: "filter", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &User{}, adapter) assert.Equal(t, "filter", adapter.filter) }) @@ -233,7 +234,7 @@ func TestInit(t *testing.T) { adapter, err := Init(ctx, map[gosync.ConfigKey]string{}) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, "", adapter.filter) }) }) diff --git a/adapters/github/discovery/discovery.go b/adapters/github/discovery/discovery.go index 11082d0a..3e511bb1 100644 --- a/adapters/github/discovery/discovery.go +++ b/adapters/github/discovery/discovery.go @@ -5,6 +5,6 @@ import "context" // GitHubDiscovery is required because there are multiple ways to convert a GitHub email into a username. // At OVO we use SAML, but other organisations may use public emails or another mechanism. type GitHubDiscovery interface { - GetUsernameFromEmail(context.Context, []string) ([]string, error) - GetEmailFromUsername(context.Context, []string) ([]string, error) + GetUsernameFromEmail(ctx context.Context, emails []string) ([]string, error) + GetEmailFromUsername(ctx context.Context, usernames []string) ([]string, error) } diff --git a/adapters/github/discovery/mock_GitHubDiscovery_test.go b/adapters/github/discovery/mock_GitHubDiscovery_test.go index f94a93a3..e1efe658 100644 --- a/adapters/github/discovery/mock_GitHubDiscovery_test.go +++ b/adapters/github/discovery/mock_GitHubDiscovery_test.go @@ -21,17 +21,21 @@ func (_m *MockGitHubDiscovery) EXPECT() *MockGitHubDiscovery_Expecter { return &MockGitHubDiscovery_Expecter{mock: &_m.Mock} } -// GetEmailFromUsername provides a mock function with given fields: _a0, _a1 -func (_m *MockGitHubDiscovery) GetEmailFromUsername(_a0 context.Context, _a1 []string) ([]string, error) { - ret := _m.Called(_a0, _a1) +// GetEmailFromUsername provides a mock function with given fields: ctx, usernames +func (_m *MockGitHubDiscovery) GetEmailFromUsername(ctx context.Context, usernames []string) ([]string, error) { + ret := _m.Called(ctx, usernames) + + if len(ret) == 0 { + panic("no return value specified for GetEmailFromUsername") + } var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, []string) ([]string, error)); ok { - return rf(_a0, _a1) + return rf(ctx, usernames) } if rf, ok := ret.Get(0).(func(context.Context, []string) []string); ok { - r0 = rf(_a0, _a1) + r0 = rf(ctx, usernames) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -39,7 +43,7 @@ func (_m *MockGitHubDiscovery) GetEmailFromUsername(_a0 context.Context, _a1 []s } if rf, ok := ret.Get(1).(func(context.Context, []string) error); ok { - r1 = rf(_a0, _a1) + r1 = rf(ctx, usernames) } else { r1 = ret.Error(1) } @@ -53,13 +57,13 @@ type MockGitHubDiscovery_GetEmailFromUsername_Call struct { } // GetEmailFromUsername is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 []string -func (_e *MockGitHubDiscovery_Expecter) GetEmailFromUsername(_a0 interface{}, _a1 interface{}) *MockGitHubDiscovery_GetEmailFromUsername_Call { - return &MockGitHubDiscovery_GetEmailFromUsername_Call{Call: _e.mock.On("GetEmailFromUsername", _a0, _a1)} +// - ctx context.Context +// - usernames []string +func (_e *MockGitHubDiscovery_Expecter) GetEmailFromUsername(ctx interface{}, usernames interface{}) *MockGitHubDiscovery_GetEmailFromUsername_Call { + return &MockGitHubDiscovery_GetEmailFromUsername_Call{Call: _e.mock.On("GetEmailFromUsername", ctx, usernames)} } -func (_c *MockGitHubDiscovery_GetEmailFromUsername_Call) Run(run func(_a0 context.Context, _a1 []string)) *MockGitHubDiscovery_GetEmailFromUsername_Call { +func (_c *MockGitHubDiscovery_GetEmailFromUsername_Call) Run(run func(ctx context.Context, usernames []string)) *MockGitHubDiscovery_GetEmailFromUsername_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].([]string)) }) @@ -76,17 +80,21 @@ func (_c *MockGitHubDiscovery_GetEmailFromUsername_Call) RunAndReturn(run func(c return _c } -// GetUsernameFromEmail provides a mock function with given fields: _a0, _a1 -func (_m *MockGitHubDiscovery) GetUsernameFromEmail(_a0 context.Context, _a1 []string) ([]string, error) { - ret := _m.Called(_a0, _a1) +// GetUsernameFromEmail provides a mock function with given fields: ctx, emails +func (_m *MockGitHubDiscovery) GetUsernameFromEmail(ctx context.Context, emails []string) ([]string, error) { + ret := _m.Called(ctx, emails) + + if len(ret) == 0 { + panic("no return value specified for GetUsernameFromEmail") + } var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, []string) ([]string, error)); ok { - return rf(_a0, _a1) + return rf(ctx, emails) } if rf, ok := ret.Get(0).(func(context.Context, []string) []string); ok { - r0 = rf(_a0, _a1) + r0 = rf(ctx, emails) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -94,7 +102,7 @@ func (_m *MockGitHubDiscovery) GetUsernameFromEmail(_a0 context.Context, _a1 []s } if rf, ok := ret.Get(1).(func(context.Context, []string) error); ok { - r1 = rf(_a0, _a1) + r1 = rf(ctx, emails) } else { r1 = ret.Error(1) } @@ -108,13 +116,13 @@ type MockGitHubDiscovery_GetUsernameFromEmail_Call struct { } // GetUsernameFromEmail is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 []string -func (_e *MockGitHubDiscovery_Expecter) GetUsernameFromEmail(_a0 interface{}, _a1 interface{}) *MockGitHubDiscovery_GetUsernameFromEmail_Call { - return &MockGitHubDiscovery_GetUsernameFromEmail_Call{Call: _e.mock.On("GetUsernameFromEmail", _a0, _a1)} +// - ctx context.Context +// - emails []string +func (_e *MockGitHubDiscovery_Expecter) GetUsernameFromEmail(ctx interface{}, emails interface{}) *MockGitHubDiscovery_GetUsernameFromEmail_Call { + return &MockGitHubDiscovery_GetUsernameFromEmail_Call{Call: _e.mock.On("GetUsernameFromEmail", ctx, emails)} } -func (_c *MockGitHubDiscovery_GetUsernameFromEmail_Call) Run(run func(_a0 context.Context, _a1 []string)) *MockGitHubDiscovery_GetUsernameFromEmail_Call { +func (_c *MockGitHubDiscovery_GetUsernameFromEmail_Call) Run(run func(ctx context.Context, emails []string)) *MockGitHubDiscovery_GetUsernameFromEmail_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].([]string)) }) diff --git a/adapters/github/discovery/saml/mock_iGitHubV4Saml_test.go b/adapters/github/discovery/saml/mock_iGitHubV4Saml_test.go index d44e7a4e..84a29542 100644 --- a/adapters/github/discovery/saml/mock_iGitHubV4Saml_test.go +++ b/adapters/github/discovery/saml/mock_iGitHubV4Saml_test.go @@ -25,6 +25,10 @@ func (_m *mockIGitHubV4Saml) EXPECT() *mockIGitHubV4Saml_Expecter { func (_m *mockIGitHubV4Saml) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error { ret := _m.Called(ctx, q, variables) + if len(ret) == 0 { + panic("no return value specified for Query") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, interface{}, map[string]interface{}) error); ok { r0 = rf(ctx, q, variables) diff --git a/adapters/github/discovery/saml/saml_internal_test.go b/adapters/github/discovery/saml/saml_internal_test.go index 62c4c462..7fae72fd 100644 --- a/adapters/github/discovery/saml/saml_internal_test.go +++ b/adapters/github/discovery/saml/saml_internal_test.go @@ -7,6 +7,7 @@ import ( "github.com/shurcooL/githubv4" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" ) func emailQueryFunc(names ...string) func(ctx context.Context, q interface{}, variables map[string]interface{}) { @@ -50,7 +51,6 @@ func TestNew(t *testing.T) { assert.Zero(t, gitHubClient.Calls) } -//nolint:funlen func TestSaml_GetUsernameFromEmail(t *testing.T) { t.Parallel() @@ -76,7 +76,7 @@ func TestSaml_GetUsernameFromEmail(t *testing.T) { usernames, err := discovery.GetUsernameFromEmail(ctx, []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, usernames, []string{"foo", "bar"}) }) @@ -100,7 +100,7 @@ func TestSaml_GetUsernameFromEmail(t *testing.T) { _, err := discovery.GetUsernameFromEmail(ctx, []string{"foo@email", "bar@email"}) - assert.ErrorIs(t, err, ErrUserNotFound) + require.ErrorIs(t, err, ErrUserNotFound) }) t.Run("MuteUserNotFoundErr true returns all non-failing results", func(t *testing.T) { //nolint: dupl @@ -123,12 +123,12 @@ func TestSaml_GetUsernameFromEmail(t *testing.T) { usernames, err := discovery.GetUsernameFromEmail(ctx, []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, usernames, []string{"foo"}) }) } -func TestSaml_GetEmailFromUsername(t *testing.T) { //nolint: funlen +func TestSaml_GetEmailFromUsername(t *testing.T) { t.Parallel() ctx := context.TODO() @@ -152,7 +152,7 @@ func TestSaml_GetEmailFromUsername(t *testing.T) { //nolint: funlen usernames, err := discovery.GetEmailFromUsername(ctx, []string{"foo", "bar"}) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, usernames, []string{"foo@email", "bar@email"}) }) @@ -176,7 +176,7 @@ func TestSaml_GetEmailFromUsername(t *testing.T) { //nolint: funlen _, err := discovery.GetEmailFromUsername(ctx, []string{"foo", "bar"}) - assert.ErrorIs(t, err, ErrUserNotFound) + require.ErrorIs(t, err, ErrUserNotFound) }) t.Run("MuteUserNotFoundErr true returns all non-failing results", func(t *testing.T) { //nolint: dupl @@ -199,7 +199,7 @@ func TestSaml_GetEmailFromUsername(t *testing.T) { //nolint: funlen usernames, err := discovery.GetEmailFromUsername(ctx, []string{"foo", "bar"}) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, usernames, []string{"foo@email"}) }) } diff --git a/adapters/github/go.mod b/adapters/github/go.mod index ca076168..75085cb6 100644 --- a/adapters/github/go.mod +++ b/adapters/github/go.mod @@ -4,16 +4,17 @@ go 1.21 require ( github.com/google/go-github/v47 v47.1.0 - github.com/ovotech/go-sync v0.13.2 + github.com/ovotech/go-sync v0.14.0 github.com/shurcooL/githubv4 v0.0.0-20230704064427-599ae7bbf278 github.com/stretchr/testify v1.8.4 - golang.org/x/oauth2 v0.12.0 + golang.org/x/oauth2 v0.15.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-querystring v1.1.0 // indirect + github.com/ovotech/go-sync/adapters/slack v0.13.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 // indirect github.com/stretchr/objx v0.5.1 // indirect diff --git a/adapters/github/go.sum b/adapters/github/go.sum index bb11ef9a..88e90bb2 100644 --- a/adapters/github/go.sum +++ b/adapters/github/go.sum @@ -13,18 +13,24 @@ github.com/google/go-github/v47 v47.1.0 h1:Cacm/WxQBOa9lF0FT0EMjZ2BWMetQ1TQfyurn github.com/google/go-github/v47 v47.1.0/go.mod h1:VPZBXNbFSJGjyjFRUKo9vZGawTajnWzC/YjGw/oFKi0= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/ovotech/go-sync v0.13.2 h1:glAwZ3gKSVdgtZHWHYp+SuWabXCEzeqti4yMryA4lM4= -github.com/ovotech/go-sync v0.13.2/go.mod h1:mzYty1nlJJQzuT+Gv72YckTJZpUYg3WD8YlgjoRPQ7Y= +github.com/ovotech/go-sync v0.14.0 h1:u3HMaBDyJv/hHjkZtT9HteCp8B/RxIA1c1jo9szu7Vc= +github.com/ovotech/go-sync v0.14.0/go.mod h1:XPOzxy51H6Vs+1yIOKlZqjijGl4xxzqTMi96qMZWg6k= +github.com/ovotech/go-sync/adapters/slack v0.13.2 h1:DZkms9RiiD0Gvbn/2/XmLwUKHVrsuy/N2SBH8etwHY0= +github.com/ovotech/go-sync/adapters/slack v0.13.2/go.mod h1:w/2rcd159t65Q4LJVUfF3H+KlJkFw8Vo1DdqOg/sjLg= 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/shurcooL/githubv4 v0.0.0-20230704064427-599ae7bbf278 h1:kdEGVAV4sO46DPtb8k793jiecUEhaX9ixoIBt41HEGU= github.com/shurcooL/githubv4 v0.0.0-20230704064427-599ae7bbf278/go.mod h1:zqMwyHmnN/eDOZOdiTohqIUKUrTFX62PNlu7IJdu0q8= github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 h1:17JxqqJY66GmZVHkmAsGEkcIu0oCe3AM420QDgGwZx0= github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466/go.mod h1:9dIRpgIY7hVhoqfe0/FcYp0bpInZaT7dc3BYOprrIUE= +github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= +github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 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= @@ -44,8 +50,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= -golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= +golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= +golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/adapters/github/team/mock_iGitHubTeam_test.go b/adapters/github/team/mock_iGitHubTeam_test.go index 72430727..c88ef976 100644 --- a/adapters/github/team/mock_iGitHubTeam_test.go +++ b/adapters/github/team/mock_iGitHubTeam_test.go @@ -26,6 +26,10 @@ func (_m *mockIGitHubTeam) EXPECT() *mockIGitHubTeam_Expecter { func (_m *mockIGitHubTeam) AddTeamMembershipBySlug(ctx context.Context, org string, slug string, user string, opts *github.TeamAddTeamMembershipOptions) (*github.Membership, *github.Response, error) { ret := _m.Called(ctx, org, slug, user, opts) + if len(ret) == 0 { + panic("no return value specified for AddTeamMembershipBySlug") + } + var r0 *github.Membership var r1 *github.Response var r2 error @@ -93,6 +97,10 @@ func (_c *mockIGitHubTeam_AddTeamMembershipBySlug_Call) RunAndReturn(run func(co func (_m *mockIGitHubTeam) ListTeamMembersBySlug(ctx context.Context, org string, slug string, opts *github.TeamListTeamMembersOptions) ([]*github.User, *github.Response, error) { ret := _m.Called(ctx, org, slug, opts) + if len(ret) == 0 { + panic("no return value specified for ListTeamMembersBySlug") + } + var r0 []*github.User var r1 *github.Response var r2 error @@ -159,6 +167,10 @@ func (_c *mockIGitHubTeam_ListTeamMembersBySlug_Call) RunAndReturn(run func(cont func (_m *mockIGitHubTeam) RemoveTeamMembershipBySlug(ctx context.Context, org string, slug string, user string) (*github.Response, error) { ret := _m.Called(ctx, org, slug, user) + if len(ret) == 0 { + panic("no return value specified for RemoveTeamMembershipBySlug") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, string) (*github.Response, error)); ok { diff --git a/adapters/github/team/team_internal_test.go b/adapters/github/team/team_internal_test.go index 951d0bc4..e64cc573 100644 --- a/adapters/github/team/team_internal_test.go +++ b/adapters/github/team/team_internal_test.go @@ -9,6 +9,7 @@ import ( "github.com/google/go-github/v47/github" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" "golang.org/x/oauth2" gosync "github.com/ovotech/go-sync" @@ -50,7 +51,7 @@ func TestTeam_Get(t *testing.T) { users, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, users, []string{"foo@email", "bar@email"}) assert.Equal(t, map[string]string{"foo@email": "foo", "bar@email": "bar"}, adapter.cache) } @@ -80,7 +81,7 @@ func TestTeam_Add(t *testing.T) { err := adapter.Add(ctx, []string{"fizz@email", "buzz@email"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestTeam_Remove(t *testing.T) { @@ -105,10 +106,9 @@ func TestTeam_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) } -//nolint:funlen func TestInit(t *testing.T) { t.Parallel() @@ -124,7 +124,7 @@ func TestInit(t *testing.T) { DiscoveryMechanism: "saml", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &Team{}, adapter) assert.Equal(t, "org", adapter.org) assert.Equal(t, "slug", adapter.slug) @@ -143,8 +143,8 @@ func TestInit(t *testing.T) { DiscoveryMechanism: "saml", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, GitHubToken) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, GitHubToken) }) t.Run("missing org", func(t *testing.T) { @@ -156,8 +156,8 @@ func TestInit(t *testing.T) { DiscoveryMechanism: "saml", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, GitHubOrg) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, GitHubOrg) }) t.Run("missing slug", func(t *testing.T) { @@ -169,8 +169,8 @@ func TestInit(t *testing.T) { DiscoveryMechanism: "saml", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, TeamSlug) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, TeamSlug) }) }) @@ -184,7 +184,7 @@ func TestInit(t *testing.T) { DiscoveryMechanism: "foo", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorIs(t, err, gosync.ErrMissingConfig) }) t.Run("with logger", func(t *testing.T) { @@ -199,7 +199,7 @@ func TestInit(t *testing.T) { DiscoveryMechanism: "saml", }, WithLogger(logger)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, logger, adapter.Logger) }) @@ -217,7 +217,7 @@ func TestInit(t *testing.T) { DiscoveryMechanism: "saml", }, WithClient(client)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, client.Teams, adapter.teams) }) @@ -232,7 +232,7 @@ func TestInit(t *testing.T) { TeamSlug: "slug", }, WithDiscoveryService(mockDiscovery)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, mockDiscovery, adapter.discovery) }) } diff --git a/adapters/google/go.mod b/adapters/google/go.mod index 99791ec4..98d1c1ee 100644 --- a/adapters/google/go.mod +++ b/adapters/google/go.mod @@ -3,32 +3,41 @@ module github.com/ovotech/go-sync/adapters/google go 1.21 require ( - github.com/ovotech/go-sync v0.13.2 + github.com/ovotech/go-sync v0.14.0 github.com/stretchr/testify v1.8.4 - google.golang.org/api v0.142.0 + google.golang.org/api v0.154.0 ) require ( - cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/s2a-go v0.1.7 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect + github.com/google/uuid v1.4.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/ovotech/go-sync/adapters/github v0.13.2 // indirect + github.com/ovotech/go-sync/adapters/slack v0.13.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.1 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.13.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/oauth2 v0.12.0 // indirect - golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.13.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect + golang.org/x/crypto v0.16.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/oauth2 v0.15.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/grpc v1.58.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/adapters/google/go.sum b/adapters/google/go.sum index 3b8163f1..d429892f 100644 --- a/adapters/google/go.sum +++ b/adapters/google/go.sum @@ -1,6 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -14,6 +14,13 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -39,26 +46,42 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-github/v47 v47.1.0 h1:Cacm/WxQBOa9lF0FT0EMjZ2BWMetQ1TQfyurn4yF1z8= +github.com/google/go-github/v47 v47.1.0/go.mod h1:VPZBXNbFSJGjyjFRUKo9vZGawTajnWzC/YjGw/oFKi0= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM= -github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/ovotech/go-sync v0.13.2 h1:glAwZ3gKSVdgtZHWHYp+SuWabXCEzeqti4yMryA4lM4= -github.com/ovotech/go-sync v0.13.2/go.mod h1:mzYty1nlJJQzuT+Gv72YckTJZpUYg3WD8YlgjoRPQ7Y= +github.com/ovotech/go-sync v0.14.0 h1:u3HMaBDyJv/hHjkZtT9HteCp8B/RxIA1c1jo9szu7Vc= +github.com/ovotech/go-sync v0.14.0/go.mod h1:XPOzxy51H6Vs+1yIOKlZqjijGl4xxzqTMi96qMZWg6k= +github.com/ovotech/go-sync/adapters/github v0.13.2 h1:AoIF6z0azDznCGV2ATGO4Oz/MykgvosbYpM7JP4j6qQ= +github.com/ovotech/go-sync/adapters/github v0.13.2/go.mod h1:XIpPUilPyMWf9BFtG6Fmvl+z3SlxTiBAMEbT2KdOQYI= +github.com/ovotech/go-sync/adapters/slack v0.13.2 h1:DZkms9RiiD0Gvbn/2/XmLwUKHVrsuy/N2SBH8etwHY0= +github.com/ovotech/go-sync/adapters/slack v0.13.2/go.mod h1:w/2rcd159t65Q4LJVUfF3H+KlJkFw8Vo1DdqOg/sjLg= 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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/shurcooL/githubv4 v0.0.0-20220520033151-0b4e3294ff00 h1:fiFvD4lT0aWjuuAb64LlZ/67v87m+Kc9Qsu5cMFNK0w= +github.com/shurcooL/githubv4 v0.0.0-20220520033151-0b4e3294ff00/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= +github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 h1:B1PEwpArrNp4dkQrfxh/abbBAOZBVp0ds+fBEOUOqOc= +github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29/go.mod h1:AuYgA5Kyo4c7HfUmvRGs/6rGlMMV/6B1bVnB9JxJEEg= +github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= +github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 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= @@ -73,11 +96,19 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -92,17 +123,17 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= -golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= +golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= +golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= 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-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -111,16 +142,16 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 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.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 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= @@ -130,8 +161,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.142.0 h1:mf+7EJ94fi5ZcnpPy+m0Yv2dkz8bKm+UL0snTCuwXlY= -google.golang.org/api v0.142.0/go.mod h1:zJAN5o6HRqR7O+9qJUFOWrZkYE66RH+efPBdTLA4xBA= +google.golang.org/api v0.154.0 h1:X7QkVKZBskztmpPKWQXgjJRPA2dJYrL6r+sYPRLj050= +google.golang.org/api v0.154.0/go.mod h1:qhSMkM85hgqiokIYsrRyKxrjfBeIhgl4Z2JmeRkYylc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= @@ -139,19 +170,19 @@ google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb h1:Isk1sSH7bovx8Rti2wZK0UZF6oraBDK74uoyLEEVFN0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= +google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= +google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f h1:2yNACc1O40tTnrsbk9Cv6oxiW8pxI/pXj0wRtdlYmgY= +google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f/go.mod h1:Uy9bTZJqmfrw2rIBxgGLnamc78euZULUBrLZ9XTITKI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 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= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= -google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/adapters/google/group/group_internal_test.go b/adapters/google/group/group_internal_test.go index 1753f138..003eb702 100644 --- a/adapters/google/group/group_internal_test.go +++ b/adapters/google/group/group_internal_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" admin "google.golang.org/api/admin/directory/v1" "google.golang.org/api/option" @@ -22,7 +23,7 @@ func withMockAdminService(ctx context.Context, t *testing.T) gosync.ConfigFn[*Gr option.WithScopes(admin.AdminDirectoryGroupMemberScope), option.WithAPIKey("_testing_"), ) - assert.NoError(t, err) + require.NoError(t, err) return func(g *Group) { g.membersService = client.Members @@ -40,19 +41,19 @@ func (m *mockCalls) callList( ) (*admin.Members, error) { args := m.Called(ctx, call, pageToken) - return args.Get(0).(*admin.Members), args.Error(1) //nolint:wrapcheck + return args.Get(0).(*admin.Members), args.Error(1) } func (m *mockCalls) callInsert(ctx context.Context, call *admin.MembersInsertCall) (*admin.Member, error) { args := m.Called(ctx, call) - return args.Get(0).(*admin.Member), args.Error(1) //nolint:wrapcheck + return args.Get(0).(*admin.Member), args.Error(1) } func (m *mockCalls) callDelete(ctx context.Context, call *admin.MembersDeleteCall) error { args := m.Called(ctx, call) - return args.Error(0) //nolint:wrapcheck + return args.Error(0) } func TestGroups_Get(t *testing.T) { @@ -87,7 +88,7 @@ func TestGroups_Get(t *testing.T) { emails, err := group.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, []string{"foo@email", "bar@email"}, emails) } @@ -114,7 +115,7 @@ func TestGroups_Add(t *testing.T) { err := group.Add(ctx, []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestGroups_Remove(t *testing.T) { @@ -140,7 +141,7 @@ func TestGroups_Remove(t *testing.T) { err := group.Remove(ctx, []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestRole(t *testing.T) { @@ -169,7 +170,7 @@ func TestRole(t *testing.T) { err := group.Add(ctx, []string{"foo@email"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestDeliverySettings(t *testing.T) { @@ -198,10 +199,9 @@ func TestDeliverySettings(t *testing.T) { err := group.Add(ctx, []string{"foo@email"}) - assert.NoError(t, err) + require.NoError(t, err) } -//nolint:funlen func TestInit(t *testing.T) { t.Parallel() @@ -214,7 +214,7 @@ func TestInit(t *testing.T) { Name: "name", }, withMockAdminService(ctx, t)) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &Group{}, adapter) assert.Equal(t, "name", adapter.name) assert.Equal(t, "", adapter.DeliverySettings) @@ -229,8 +229,8 @@ func TestInit(t *testing.T) { _, err := Init(ctx, map[gosync.ConfigKey]string{}, withMockAdminService(ctx, t)) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, Name) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, Name) }) }) @@ -242,7 +242,7 @@ func TestInit(t *testing.T) { Role: "role", }, withMockAdminService(ctx, t)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, "role", adapter.Role) }) @@ -254,7 +254,7 @@ func TestInit(t *testing.T) { DeliverySettings: "delivery", }, withMockAdminService(ctx, t)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, "delivery", adapter.DeliverySettings) }) @@ -267,7 +267,7 @@ func TestInit(t *testing.T) { Name: "name", }, withMockAdminService(ctx, t), WithLogger(logger)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, logger, adapter.Logger) }) @@ -278,7 +278,7 @@ func TestInit(t *testing.T) { Name: "name", }, withMockAdminService(ctx, t)) - assert.NoError(t, err) + require.NoError(t, err) assert.NotNil(t, adapter.membersService) }) } diff --git a/adapters/google/group/mock_iMembersService_test.go b/adapters/google/group/mock_iMembersService_test.go index ed8ed814..86db5125 100644 --- a/adapters/google/group/mock_iMembersService_test.go +++ b/adapters/google/group/mock_iMembersService_test.go @@ -24,6 +24,10 @@ func (_m *mockIMembersService) EXPECT() *mockIMembersService_Expecter { func (_m *mockIMembersService) Delete(groupKey string, memberKey string) *admin.MembersDeleteCall { ret := _m.Called(groupKey, memberKey) + if len(ret) == 0 { + panic("no return value specified for Delete") + } + var r0 *admin.MembersDeleteCall if rf, ok := ret.Get(0).(func(string, string) *admin.MembersDeleteCall); ok { r0 = rf(groupKey, memberKey) @@ -69,6 +73,10 @@ func (_c *mockIMembersService_Delete_Call) RunAndReturn(run func(string, string) func (_m *mockIMembersService) Insert(groupKey string, member *admin.Member) *admin.MembersInsertCall { ret := _m.Called(groupKey, member) + if len(ret) == 0 { + panic("no return value specified for Insert") + } + var r0 *admin.MembersInsertCall if rf, ok := ret.Get(0).(func(string, *admin.Member) *admin.MembersInsertCall); ok { r0 = rf(groupKey, member) @@ -114,6 +122,10 @@ func (_c *mockIMembersService_Insert_Call) RunAndReturn(run func(string, *admin. func (_m *mockIMembersService) List(groupKey string) *admin.MembersListCall { ret := _m.Called(groupKey) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 *admin.MembersListCall if rf, ok := ret.Get(0).(func(string) *admin.MembersListCall); ok { r0 = rf(groupKey) diff --git a/adapters/opsgenie/go.mod b/adapters/opsgenie/go.mod index b8b44326..4abc7567 100644 --- a/adapters/opsgenie/go.mod +++ b/adapters/opsgenie/go.mod @@ -3,7 +3,7 @@ module github.com/ovotech/go-sync/adapters/opsgenie go 1.21 require ( - github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.20 + github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22 github.com/ovotech/go-sync v0.14.0 github.com/stretchr/testify v1.8.4 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 diff --git a/adapters/opsgenie/go.sum b/adapters/opsgenie/go.sum index b219b11c..e63421b1 100644 --- a/adapters/opsgenie/go.sum +++ b/adapters/opsgenie/go.sum @@ -22,8 +22,8 @@ github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.20 h1:twA4Kiaw+Vi4x5Ei3qDO1TtQf7oSuJQ+CqJB9j9lEmQ= -github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.20/go.mod h1:4OjcxgwdXzezqytxN534MooNmrxRD50geWZxTD7845s= +github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22 h1:0h+YoXSyipf6XQGyIaDg6z5jwRik1JSm+sQetnD7vGY= +github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.22/go.mod h1:4OjcxgwdXzezqytxN534MooNmrxRD50geWZxTD7845s= github.com/ovotech/go-sync v0.14.0 h1:u3HMaBDyJv/hHjkZtT9HteCp8B/RxIA1c1jo9szu7Vc= github.com/ovotech/go-sync v0.14.0/go.mod h1:XPOzxy51H6Vs+1yIOKlZqjijGl4xxzqTMi96qMZWg6k= github.com/ovotech/go-sync/adapters/github v0.13.2 h1:AoIF6z0azDznCGV2ATGO4Oz/MykgvosbYpM7JP4j6qQ= diff --git a/adapters/opsgenie/oncall/mock_iOpsgenieSchedule_test.go b/adapters/opsgenie/oncall/mock_iOpsgenieSchedule_test.go index 7fbe66c8..ddc51cf2 100644 --- a/adapters/opsgenie/oncall/mock_iOpsgenieSchedule_test.go +++ b/adapters/opsgenie/oncall/mock_iOpsgenieSchedule_test.go @@ -26,6 +26,10 @@ func (_m *mockIOpsgenieSchedule) EXPECT() *mockIOpsgenieSchedule_Expecter { func (_m *mockIOpsgenieSchedule) GetOnCalls(_a0 context.Context, request *schedule.GetOnCallsRequest) (*schedule.GetOnCallsResult, error) { ret := _m.Called(_a0, request) + if len(ret) == 0 { + panic("no return value specified for GetOnCalls") + } + var r0 *schedule.GetOnCallsResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, *schedule.GetOnCallsRequest) (*schedule.GetOnCallsResult, error)); ok { diff --git a/adapters/opsgenie/oncall/oncall_internal_test.go b/adapters/opsgenie/oncall/oncall_internal_test.go index fad7befd..0c417a40 100644 --- a/adapters/opsgenie/oncall/oncall_internal_test.go +++ b/adapters/opsgenie/oncall/oncall_internal_test.go @@ -11,6 +11,7 @@ import ( "github.com/opsgenie/opsgenie-go-sdk-v2/client" "github.com/opsgenie/opsgenie-go-sdk-v2/schedule" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -26,7 +27,7 @@ func createMockedAdapter(ctx context.Context, t *testing.T, mockedTime time.Time OpsgenieAPIKey: "test", ScheduleID: "test", }) - assert.NoError(t, err) + require.NoError(t, err) adapter.client = scheduleClient adapter.getTime = func() time.Time { @@ -59,7 +60,7 @@ func TestOnCall_Get(t *testing.T) { emails, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, []string{"foo@email.com", "bar@email.com"}, emails) }) @@ -78,7 +79,7 @@ func TestOnCall_Get(t *testing.T) { emails, err := adapter.Get(ctx) assert.Nil(t, emails) - assert.ErrorContains(t, err, "an example error") + require.ErrorContains(t, err, "an example error") }) } @@ -90,7 +91,7 @@ func TestOnCall_Add(t *testing.T) { err := adapter.Add(ctx, []string{"example@bar.com"}) - assert.ErrorIs(t, err, gosync.ErrReadOnly) + require.ErrorIs(t, err, gosync.ErrReadOnly) assert.Zero(t, scheduleClient.Calls) } @@ -102,11 +103,10 @@ func TestOnCall_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"example@bar.com"}) - assert.ErrorIs(t, err, gosync.ErrReadOnly) + require.ErrorIs(t, err, gosync.ErrReadOnly) assert.Zero(t, scheduleClient.Calls) } -//nolint:funlen func TestInit(t *testing.T) { t.Parallel() @@ -120,7 +120,7 @@ func TestInit(t *testing.T) { ScheduleID: "schedule", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &OnCall{}, adapter) assert.Equal(t, "schedule", adapter.scheduleID) }) @@ -135,8 +135,8 @@ func TestInit(t *testing.T) { ScheduleID: "schedule", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, OpsgenieAPIKey) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, OpsgenieAPIKey) }) t.Run("missing schedule ID", func(t *testing.T) { @@ -146,8 +146,8 @@ func TestInit(t *testing.T) { OpsgenieAPIKey: "test", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, ScheduleID) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, ScheduleID) }) }) @@ -161,7 +161,7 @@ func TestInit(t *testing.T) { ScheduleID: "schedule", }, WithLogger(logger)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, logger, adapter.Logger) }) @@ -171,13 +171,13 @@ func TestInit(t *testing.T) { scheduleClient, err := schedule.NewClient(&client.Config{ ApiKey: "test", }) - assert.NoError(t, err) + require.NoError(t, err) adapter, err := Init(ctx, map[gosync.ConfigKey]string{ ScheduleID: "schedule", }, WithClient(scheduleClient)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, scheduleClient, adapter.client) }) } diff --git a/adapters/opsgenie/schedule/mock_iOpsgenieSchedule_test.go b/adapters/opsgenie/schedule/mock_iOpsgenieSchedule_test.go index 20f89890..8249373b 100644 --- a/adapters/opsgenie/schedule/mock_iOpsgenieSchedule_test.go +++ b/adapters/opsgenie/schedule/mock_iOpsgenieSchedule_test.go @@ -26,6 +26,10 @@ func (_m *mockIOpsgenieSchedule) EXPECT() *mockIOpsgenieSchedule_Expecter { func (_m *mockIOpsgenieSchedule) Get(ctx context.Context, request *opsgenie_go_sdk_v2schedule.GetRequest) (*opsgenie_go_sdk_v2schedule.GetResult, error) { ret := _m.Called(ctx, request) + if len(ret) == 0 { + panic("no return value specified for Get") + } + var r0 *opsgenie_go_sdk_v2schedule.GetResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, *opsgenie_go_sdk_v2schedule.GetRequest) (*opsgenie_go_sdk_v2schedule.GetResult, error)); ok { @@ -81,6 +85,10 @@ func (_c *mockIOpsgenieSchedule_Get_Call) RunAndReturn(run func(context.Context, func (_m *mockIOpsgenieSchedule) UpdateRotation(ctx context.Context, request *opsgenie_go_sdk_v2schedule.UpdateRotationRequest) (*opsgenie_go_sdk_v2schedule.UpdateRotationResult, error) { ret := _m.Called(ctx, request) + if len(ret) == 0 { + panic("no return value specified for UpdateRotation") + } + var r0 *opsgenie_go_sdk_v2schedule.UpdateRotationResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, *opsgenie_go_sdk_v2schedule.UpdateRotationRequest) (*opsgenie_go_sdk_v2schedule.UpdateRotationResult, error)); ok { diff --git a/adapters/opsgenie/schedule/schedule_internal_test.go b/adapters/opsgenie/schedule/schedule_internal_test.go index 6669dad4..687d4dc6 100644 --- a/adapters/opsgenie/schedule/schedule_internal_test.go +++ b/adapters/opsgenie/schedule/schedule_internal_test.go @@ -13,6 +13,7 @@ import ( "github.com/opsgenie/opsgenie-go-sdk-v2/schedule" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -28,7 +29,7 @@ func createMockedAdapter(ctx context.Context, t *testing.T) (*Schedule, *mockIOp OpsgenieAPIKey: "test", ScheduleID: "test", }) - assert.NoError(t, err) + require.NoError(t, err) adapter.client = scheduleClient @@ -105,7 +106,7 @@ func testBuildScheduleGetResult(numRotations int, emails ...string) *schedule.Ge } } -func TestSchedule_Get(t *testing.T) { //nolint:funlen +func TestSchedule_Get(t *testing.T) { t.Parallel() ctx := context.Background() @@ -123,7 +124,7 @@ func TestSchedule_Get(t *testing.T) { //nolint:funlen emails, err := adapter.Get(ctx) assert.Nil(t, emails) - assert.ErrorContains(t, err, "an example error") + require.ErrorContains(t, err, "an example error") }) t.Run("successful response", func(t *testing.T) { @@ -138,8 +139,8 @@ func TestSchedule_Get(t *testing.T) { //nolint:funlen emails, err := adapter.Get(ctx) - assert.Nil(t, err) - assert.Equal(t, emails, []string{"example1@example.com", "example2@example.com", "example3@example.com"}) + require.NoError(t, err) + assert.Equal(t, []string{"example1@example.com", "example2@example.com", "example3@example.com"}, emails) }) t.Run("should handle multiple rotations", func(t *testing.T) { @@ -154,8 +155,8 @@ func TestSchedule_Get(t *testing.T) { //nolint:funlen emails, err := adapter.Get(ctx) - assert.Nil(t, err) - assert.Equal(t, emails, []string{"example1@example.com", "example2@example.com", "example3@example.com"}) + require.NoError(t, err) + assert.Equal(t, []string{"example1@example.com", "example2@example.com", "example3@example.com"}, emails) }) t.Run("should not duplicate participants across multiple rotations", func(t *testing.T) { @@ -170,12 +171,12 @@ func TestSchedule_Get(t *testing.T) { //nolint:funlen emails, err := adapter.Get(ctx) - assert.Nil(t, err) - assert.Equal(t, emails, []string{"example1@example.com", "example2@example.com", "example3@example.com"}) + require.NoError(t, err) + assert.Equal(t, []string{"example1@example.com", "example2@example.com", "example3@example.com"}, emails) }) } -func TestSchedule_Add(t *testing.T) { //nolint:funlen +func TestSchedule_Add(t *testing.T) { t.Parallel() ctx := context.Background() @@ -190,7 +191,7 @@ func TestSchedule_Add(t *testing.T) { //nolint:funlen err := adapter.Add(ctx, []string{"example2@example.com"}) - assert.ErrorContains(t, err, "an example error") + require.ErrorContains(t, err, "an example error") }) t.Run("an error should be returned if no rotations exist", func(t *testing.T) { @@ -202,7 +203,7 @@ func TestSchedule_Add(t *testing.T) { //nolint:funlen err := adapter.Add(ctx, []string{"example2@example.com"}) - assert.ErrorContains(t, err, "gosync cannot create rotations") + require.ErrorContains(t, err, "gosync cannot create rotations") }) t.Run("an error should be returned if the schedule has more than 1 rotation", func(t *testing.T) { @@ -217,7 +218,7 @@ func TestSchedule_Add(t *testing.T) { //nolint:funlen err := adapter.Add(ctx, []string{"example2@example.com"}) - assert.ErrorContains(t, err, "gosync can only manage schedules with a single rotation") + require.ErrorContains(t, err, "gosync can only manage schedules with a single rotation") }) t.Run("should add new participants to the rotation", func(t *testing.T) { @@ -236,7 +237,7 @@ func TestSchedule_Add(t *testing.T) { //nolint:funlen err := adapter.Add(ctx, []string{"example3@example.com"}) - assert.Nil(t, err) + require.NoError(t, err) }) t.Run("should not add duplicates to the rota", func(t *testing.T) { @@ -252,11 +253,11 @@ func TestSchedule_Add(t *testing.T) { //nolint:funlen err := adapter.Add(ctx, []string{"example2@example.com"}) - assert.Nil(t, err) + require.NoError(t, err) }) } -func TestSchedule_Remove(t *testing.T) { //nolint:funlen +func TestSchedule_Remove(t *testing.T) { t.Parallel() ctx := context.Background() @@ -271,7 +272,7 @@ func TestSchedule_Remove(t *testing.T) { //nolint:funlen err := adapter.Remove(ctx, []string{"example@example.com"}) - assert.ErrorContains(t, err, "an example error") + require.ErrorContains(t, err, "an example error") }) t.Run("an error should be returned if no rotations exist", func(t *testing.T) { @@ -283,7 +284,7 @@ func TestSchedule_Remove(t *testing.T) { //nolint:funlen err := adapter.Remove(ctx, []string{}) - assert.ErrorContains(t, err, "gosync cannot create rotations") + require.ErrorContains(t, err, "gosync cannot create rotations") }) t.Run("an error should be returned if the schedule has more than 1 rotation", func(t *testing.T) { @@ -295,7 +296,7 @@ func TestSchedule_Remove(t *testing.T) { //nolint:funlen err := adapter.Remove(ctx, []string{"example2@example.com"}) - assert.ErrorContains(t, err, "gosync can only manage schedules with a single rotation") + require.ErrorContains(t, err, "gosync can only manage schedules with a single rotation") }) t.Run("should remove existing participants from the rotation", func(t *testing.T) { @@ -311,7 +312,7 @@ func TestSchedule_Remove(t *testing.T) { //nolint:funlen err := adapter.Remove(ctx, []string{"example2@example.com"}) - assert.Nil(t, err) + require.NoError(t, err) }) t.Run("should ignore nonexistent participants", func(t *testing.T) { @@ -327,11 +328,10 @@ func TestSchedule_Remove(t *testing.T) { //nolint:funlen err := adapter.Remove(ctx, []string{"example3@example.com"}) - assert.Nil(t, err) + require.NoError(t, err) }) } -//nolint:funlen func TestInit(t *testing.T) { t.Parallel() @@ -345,7 +345,7 @@ func TestInit(t *testing.T) { ScheduleID: "schedule", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &Schedule{}, adapter) assert.Equal(t, "schedule", adapter.scheduleID) }) @@ -360,8 +360,8 @@ func TestInit(t *testing.T) { ScheduleID: "schedule", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, OpsgenieAPIKey) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, OpsgenieAPIKey) }) t.Run("missing schedule ID", func(t *testing.T) { @@ -371,8 +371,8 @@ func TestInit(t *testing.T) { OpsgenieAPIKey: "test", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, ScheduleID) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, ScheduleID) }) }) @@ -386,7 +386,7 @@ func TestInit(t *testing.T) { ScheduleID: "schedule", }, WithLogger(logger)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, logger, adapter.Logger) }) @@ -396,13 +396,13 @@ func TestInit(t *testing.T) { scheduleClient, err := schedule.NewClient(&client.Config{ ApiKey: "test", }) - assert.NoError(t, err) + require.NoError(t, err) adapter, err := Init(ctx, map[gosync.ConfigKey]string{ ScheduleID: "schedule", }, WithClient(scheduleClient)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, scheduleClient, adapter.client) }) } diff --git a/adapters/slack/conversation/conversation_internal_test.go b/adapters/slack/conversation/conversation_internal_test.go index cbf2d588..fe1c3f87 100644 --- a/adapters/slack/conversation/conversation_internal_test.go +++ b/adapters/slack/conversation/conversation_internal_test.go @@ -3,13 +3,14 @@ package conversation import ( "context" "errors" - "fmt" "log" "os" + "strconv" "testing" "github.com/slack-go/slack" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -63,7 +64,7 @@ func TestConversation_Get(t *testing.T) { accounts, err := adapter.Get(context.TODO()) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, accounts, []string{"foo@email", "bar@email"}) assert.Equal(t, map[string]string{"foo@email": "foo", "bar@email": "bar"}, adapter.cache) } @@ -86,17 +87,17 @@ func TestConversation_Get_Pagination(t *testing.T) { secondResponse := make([]slack.User, 30) for idx := range incrementingSlice { - incrementingSlice[idx] = fmt.Sprint(idx) + incrementingSlice[idx] = strconv.Itoa(idx) if idx < 30 { - firstPage[idx] = fmt.Sprint(idx) + firstPage[idx] = strconv.Itoa(idx) firstResponse[idx] = slack.User{ - ID: fmt.Sprint(idx), IsBot: false, Profile: slack.UserProfile{Email: fmt.Sprint(idx)}, + ID: strconv.Itoa(idx), IsBot: false, Profile: slack.UserProfile{Email: strconv.Itoa(idx)}, } } else { - secondPage[idx-30] = fmt.Sprint(idx) + secondPage[idx-30] = strconv.Itoa(idx) secondResponse[idx-30] = slack.User{ - ID: fmt.Sprint(idx), IsBot: false, Profile: slack.UserProfile{Email: fmt.Sprint(idx)}, + ID: strconv.Itoa(idx), IsBot: false, Profile: slack.UserProfile{Email: strconv.Itoa(idx)}, } } } @@ -112,7 +113,7 @@ func TestConversation_Get_Pagination(t *testing.T) { _, err := adapter.Get(context.TODO()) - assert.NoError(t, err) + require.NoError(t, err) } func TestConversation_Add(t *testing.T) { @@ -136,10 +137,9 @@ func TestConversation_Add(t *testing.T) { err := adapter.Add(context.TODO(), []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) } -//nolint:funlen func TestConversation_Remove(t *testing.T) { t.Parallel() @@ -162,7 +162,7 @@ func TestConversation_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("Restricted kick from public conversation", func(t *testing.T) { @@ -185,14 +185,14 @@ func TestConversation_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"foo@email", "bar@email"}) - assert.Error(t, err) - assert.ErrorIs(t, err, restrictedAction) + require.Error(t, err) + require.ErrorIs(t, err, restrictedAction) adapter.MuteRestrictedErrOnKickFromPublic = true err = adapter.Remove(ctx, []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("Check case sensitivity", func(t *testing.T) { @@ -226,11 +226,10 @@ func TestConversation_Remove(t *testing.T) { // Capitalise the first letter of each email. err := adapter.Remove(ctx, []string{"Foo@email", "Bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) }) } -//nolint:funlen func TestInit(t *testing.T) { t.Parallel() @@ -244,7 +243,7 @@ func TestInit(t *testing.T) { Name: "conversation", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &Conversation{}, adapter) assert.Equal(t, "conversation", adapter.conversationName) assert.False(t, adapter.MuteRestrictedErrOnKickFromPublic) @@ -260,8 +259,8 @@ func TestInit(t *testing.T) { Name: "conversation", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, SlackAPIKey) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, SlackAPIKey) }) t.Run("missing name", func(t *testing.T) { @@ -271,8 +270,8 @@ func TestInit(t *testing.T) { SlackAPIKey: "test", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, Name) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, Name) }) t.Run("MuteRestrictedErrOnKickFromPublic", func(t *testing.T) { @@ -285,7 +284,7 @@ func TestInit(t *testing.T) { MuteRestrictedErrOnKickFromPublic: test, }) - assert.NoError(t, err) + require.NoError(t, err) assert.False(t, adapter.MuteRestrictedErrOnKickFromPublic, test) } @@ -296,7 +295,7 @@ func TestInit(t *testing.T) { MuteRestrictedErrOnKickFromPublic: test, }) - assert.NoError(t, err) + require.NoError(t, err) assert.True(t, adapter.MuteRestrictedErrOnKickFromPublic, test) } }) @@ -312,7 +311,7 @@ func TestInit(t *testing.T) { Name: "conversation", }, WithLogger(logger)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, logger, adapter.Logger) }) @@ -325,7 +324,7 @@ func TestInit(t *testing.T) { Name: "conversation", }, WithClient(client)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, client, adapter.client) }) } diff --git a/adapters/slack/conversation/mock_iSlackConversation_test.go b/adapters/slack/conversation/mock_iSlackConversation_test.go index 01377446..2c217cd0 100644 --- a/adapters/slack/conversation/mock_iSlackConversation_test.go +++ b/adapters/slack/conversation/mock_iSlackConversation_test.go @@ -24,6 +24,10 @@ func (_m *mockISlackConversation) EXPECT() *mockISlackConversation_Expecter { func (_m *mockISlackConversation) GetUserByEmail(email string) (*slack.User, error) { ret := _m.Called(email) + if len(ret) == 0 { + panic("no return value specified for GetUserByEmail") + } + var r0 *slack.User var r1 error if rf, ok := ret.Get(0).(func(string) (*slack.User, error)); ok { @@ -78,6 +82,10 @@ func (_c *mockISlackConversation_GetUserByEmail_Call) RunAndReturn(run func(stri func (_m *mockISlackConversation) GetUsersInConversation(params *slack.GetUsersInConversationParameters) ([]string, string, error) { ret := _m.Called(params) + if len(ret) == 0 { + panic("no return value specified for GetUsersInConversation") + } + var r0 []string var r1 string var r2 error @@ -145,6 +153,10 @@ func (_m *mockISlackConversation) GetUsersInfo(users ...string) (*[]slack.User, _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetUsersInfo") + } + var r0 *[]slack.User var r1 error if rf, ok := ret.Get(0).(func(...string) (*[]slack.User, error)); ok { @@ -213,6 +225,10 @@ func (_m *mockISlackConversation) InviteUsersToConversation(channelID string, us _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for InviteUsersToConversation") + } + var r0 *slack.Channel var r1 error if rf, ok := ret.Get(0).(func(string, ...string) (*slack.Channel, error)); ok { @@ -275,6 +291,10 @@ func (_c *mockISlackConversation_InviteUsersToConversation_Call) RunAndReturn(ru func (_m *mockISlackConversation) KickUserFromConversation(channelID string, user string) error { ret := _m.Called(channelID, user) + if len(ret) == 0 { + panic("no return value specified for KickUserFromConversation") + } + var r0 error if rf, ok := ret.Get(0).(func(string, string) error); ok { r0 = rf(channelID, user) diff --git a/adapters/slack/go.mod b/adapters/slack/go.mod index 185d873d..68d20fee 100644 --- a/adapters/slack/go.mod +++ b/adapters/slack/go.mod @@ -3,7 +3,7 @@ module github.com/ovotech/go-sync/adapters/slack go 1.21 require ( - github.com/ovotech/go-sync v0.13.2 + github.com/ovotech/go-sync v0.14.0 github.com/slack-go/slack v0.12.3 github.com/stretchr/testify v1.8.4 ) @@ -12,6 +12,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/gorilla/websocket v1.5.0 // indirect + github.com/ovotech/go-sync/adapters/github v0.13.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/adapters/slack/go.sum b/adapters/slack/go.sum index 544ae315..7533b3b9 100644 --- a/adapters/slack/go.sum +++ b/adapters/slack/go.sum @@ -3,9 +3,15 @@ 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/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-github/v47 v47.1.0 h1:Cacm/WxQBOa9lF0FT0EMjZ2BWMetQ1TQfyurn4yF1z8= +github.com/google/go-github/v47 v47.1.0/go.mod h1:VPZBXNbFSJGjyjFRUKo9vZGawTajnWzC/YjGw/oFKi0= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -13,10 +19,16 @@ github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/ovotech/go-sync v0.13.2 h1:glAwZ3gKSVdgtZHWHYp+SuWabXCEzeqti4yMryA4lM4= -github.com/ovotech/go-sync v0.13.2/go.mod h1:mzYty1nlJJQzuT+Gv72YckTJZpUYg3WD8YlgjoRPQ7Y= +github.com/ovotech/go-sync v0.14.0 h1:u3HMaBDyJv/hHjkZtT9HteCp8B/RxIA1c1jo9szu7Vc= +github.com/ovotech/go-sync v0.14.0/go.mod h1:XPOzxy51H6Vs+1yIOKlZqjijGl4xxzqTMi96qMZWg6k= +github.com/ovotech/go-sync/adapters/github v0.13.2 h1:AoIF6z0azDznCGV2ATGO4Oz/MykgvosbYpM7JP4j6qQ= +github.com/ovotech/go-sync/adapters/github v0.13.2/go.mod h1:XIpPUilPyMWf9BFtG6Fmvl+z3SlxTiBAMEbT2KdOQYI= 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/shurcooL/githubv4 v0.0.0-20220520033151-0b4e3294ff00 h1:fiFvD4lT0aWjuuAb64LlZ/67v87m+Kc9Qsu5cMFNK0w= +github.com/shurcooL/githubv4 v0.0.0-20220520033151-0b4e3294ff00/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= +github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 h1:B1PEwpArrNp4dkQrfxh/abbBAOZBVp0ds+fBEOUOqOc= +github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29/go.mod h1:AuYgA5Kyo4c7HfUmvRGs/6rGlMMV/6B1bVnB9JxJEEg= github.com/slack-go/slack v0.12.3 h1:92/dfFU8Q5XP6Wp5rr5/T5JHLM5c5Smtn53fhToAP88= github.com/slack-go/slack v0.12.3/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -30,7 +42,17 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= +golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/adapters/slack/usergroup/mock_iSlackUserGroup_test.go b/adapters/slack/usergroup/mock_iSlackUserGroup_test.go index 6da0be1f..df88519e 100644 --- a/adapters/slack/usergroup/mock_iSlackUserGroup_test.go +++ b/adapters/slack/usergroup/mock_iSlackUserGroup_test.go @@ -26,6 +26,10 @@ func (_m *mockISlackUserGroup) EXPECT() *mockISlackUserGroup_Expecter { func (_m *mockISlackUserGroup) GetUserByEmailContext(ctx context.Context, email string) (*slack.User, error) { ret := _m.Called(ctx, email) + if len(ret) == 0 { + panic("no return value specified for GetUserByEmailContext") + } + var r0 *slack.User var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (*slack.User, error)); ok { @@ -81,6 +85,10 @@ func (_c *mockISlackUserGroup_GetUserByEmailContext_Call) RunAndReturn(run func( func (_m *mockISlackUserGroup) GetUserGroupMembersContext(ctx context.Context, userGroup string) ([]string, error) { ret := _m.Called(ctx, userGroup) + if len(ret) == 0 { + panic("no return value specified for GetUserGroupMembersContext") + } + var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]string, error)); ok { @@ -143,6 +151,10 @@ func (_m *mockISlackUserGroup) GetUsersInfoContext(ctx context.Context, users .. _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for GetUsersInfoContext") + } + var r0 *[]slack.User var r1 error if rf, ok := ret.Get(0).(func(context.Context, ...string) (*[]slack.User, error)); ok { @@ -205,6 +217,10 @@ func (_c *mockISlackUserGroup_GetUsersInfoContext_Call) RunAndReturn(run func(co func (_m *mockISlackUserGroup) UpdateUserGroupMembersContext(ctx context.Context, userGroup string, members string) (slack.UserGroup, error) { ret := _m.Called(ctx, userGroup, members) + if len(ret) == 0 { + panic("no return value specified for UpdateUserGroupMembersContext") + } + var r0 slack.UserGroup var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string) (slack.UserGroup, error)); ok { diff --git a/adapters/slack/usergroup/usergroup_internal_test.go b/adapters/slack/usergroup/usergroup_internal_test.go index effcd2f5..93abf991 100644 --- a/adapters/slack/usergroup/usergroup_internal_test.go +++ b/adapters/slack/usergroup/usergroup_internal_test.go @@ -14,6 +14,7 @@ import ( "github.com/slack-go/slack" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -43,7 +44,7 @@ func TestUserGroup_Get(t *testing.T) { users, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, []string{"foo@email", "bar@email"}, users) } @@ -90,7 +91,7 @@ func TestUserGroup_Get_Pagination(t *testing.T) { _, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) } func TestUserGroup_Add(t *testing.T) { @@ -111,8 +112,8 @@ func TestUserGroup_Add(t *testing.T) { err := adapter.Add(ctx, []string{"foo", "bar"}) - assert.Error(t, err) - assert.ErrorIs(t, err, gosync.ErrCacheEmpty) + require.Error(t, err) + require.ErrorIs(t, err, gosync.ErrCacheEmpty) }) t.Run("Add accounts", func(t *testing.T) { @@ -138,13 +139,12 @@ func TestUserGroup_Add(t *testing.T) { adapter.cache = map[string]string{"foo@email": "foo", "bar@email": "bar"} err := adapter.Add(ctx, []string{"fizz@email", "buzz@email"}) - assert.NoError(t, err) + require.NoError(t, err) assert.Contains(t, adapter.cache, "fizz@email") assert.Contains(t, adapter.cache, "buzz@email") }) } -//nolint:funlen func TestUserGroup_Remove(t *testing.T) { t.Parallel() @@ -163,8 +163,8 @@ func TestUserGroup_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"foo@email"}) - assert.Error(t, err) - assert.ErrorIs(t, err, gosync.ErrCacheEmpty) + require.Error(t, err) + require.ErrorIs(t, err, gosync.ErrCacheEmpty) }) t.Run("Remove accounts", func(t *testing.T) { @@ -183,7 +183,7 @@ func TestUserGroup_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) assert.Contains(t, adapter.cache, "foo@email") assert.NotContains(t, adapter.cache, "bar@email") }) @@ -208,18 +208,17 @@ func TestUserGroup_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"foo@email"}) - assert.ErrorIs(t, err, errInvalidArguments) + require.ErrorIs(t, err, errInvalidArguments) // Reset the cache and mute the empty group error. adapter.MuteGroupCannotBeEmpty = true err = adapter.Remove(ctx, []string{"foo@email"}) - assert.NoError(t, err) + require.NoError(t, err) }) } -//nolint:funlen func TestInit(t *testing.T) { t.Parallel() @@ -233,7 +232,7 @@ func TestInit(t *testing.T) { UserGroupID: "usergroup", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &UserGroup{}, adapter) assert.Equal(t, "usergroup", adapter.userGroupID) assert.False(t, adapter.MuteGroupCannotBeEmpty) @@ -249,8 +248,8 @@ func TestInit(t *testing.T) { UserGroupID: "usergroup", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, SlackAPIKey) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, SlackAPIKey) }) t.Run("missing name", func(t *testing.T) { @@ -260,8 +259,8 @@ func TestInit(t *testing.T) { SlackAPIKey: "test", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, UserGroupID) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, UserGroupID) }) }) @@ -275,7 +274,7 @@ func TestInit(t *testing.T) { MuteGroupCannotBeEmpty: test, }) - assert.NoError(t, err) + require.NoError(t, err) assert.False(t, adapter.MuteGroupCannotBeEmpty, test) } @@ -286,7 +285,7 @@ func TestInit(t *testing.T) { MuteGroupCannotBeEmpty: test, }) - assert.NoError(t, err) + require.NoError(t, err) assert.True(t, adapter.MuteGroupCannotBeEmpty, test) } }) @@ -301,7 +300,7 @@ func TestInit(t *testing.T) { UserGroupID: "usergroup", }, WithLogger(logger)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, logger, adapter.Logger) }) @@ -314,7 +313,7 @@ func TestInit(t *testing.T) { UserGroupID: "usergroup", }, WithClient(client)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, client, adapter.client) }) } diff --git a/adapters/terraformcloud/go.mod b/adapters/terraformcloud/go.mod index bb274b75..b3d38280 100644 --- a/adapters/terraformcloud/go.mod +++ b/adapters/terraformcloud/go.mod @@ -3,7 +3,7 @@ module github.com/ovotech/go-sync/adapters/terraformcloud go 1.21 require ( - github.com/hashicorp/go-tfe v1.34.0 + github.com/hashicorp/go-tfe v1.41.0 github.com/ovotech/go-sync v0.14.0 github.com/stretchr/testify v1.8.4 ) @@ -12,15 +12,16 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-retryablehttp v0.7.4 // indirect - github.com/hashicorp/go-slug v0.12.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.5 // indirect + github.com/hashicorp/go-slug v0.13.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d // indirect github.com/ovotech/go-sync/adapters/github v0.13.2 // indirect github.com/ovotech/go-sync/adapters/slack v0.13.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.1 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/time v0.3.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/adapters/terraformcloud/go.sum b/adapters/terraformcloud/go.sum index 79d2eb2d..4aa99368 100644 --- a/adapters/terraformcloud/go.sum +++ b/adapters/terraformcloud/go.sum @@ -16,12 +16,12 @@ 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-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA= -github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= -github.com/hashicorp/go-slug v0.12.2 h1:Gb6nxnV5GI1UVa3aLJGUj66J8AOZFnjIoYalNCp2Cbo= -github.com/hashicorp/go-slug v0.12.2/go.mod h1:JZVtycnZZbiJ4oxpJ/zfhyfBD8XxT4f0uOSyjNLCqFY= -github.com/hashicorp/go-tfe v1.34.0 h1:33xcVQ8sbkdPVhubpVH208+S72l6l5bFEi14363yOIE= -github.com/hashicorp/go-tfe v1.34.0/go.mod h1:xA+N8r81ldvS7PC/DVbL+FqGsgfrcu1Ak4+6His+51s= +github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= +github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hashicorp/go-slug v0.13.3 h1:JiYNpOkD0HmMWw/lNYiBAUD6+WIBIV7UftKiqIbpNqM= +github.com/hashicorp/go-slug v0.13.3/go.mod h1:RA4C+ezyC2nDsiPM5+1djqagveBBJdSN/fM2QCUziYQ= +github.com/hashicorp/go-tfe v1.41.0 h1:ieQrbFwH4KITMxqyBni7v5jTBkcvQqCbnPNsV2eh4TY= +github.com/hashicorp/go-tfe v1.41.0/go.mod h1:i29eWGEtI/glZaixaMTVUipNWxQFN6gw7hy3swKOC/A= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= @@ -63,10 +63,12 @@ golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -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/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= diff --git a/adapters/terraformcloud/membership/membership_integration_test.go b/adapters/terraformcloud/membership/membership_integration_test.go index f8e9b4e2..8af6297e 100644 --- a/adapters/terraformcloud/membership/membership_integration_test.go +++ b/adapters/terraformcloud/membership/membership_integration_test.go @@ -26,23 +26,23 @@ func TestIntegration(t *testing.T) { membership.Token: *token, membership.Organisation: *organisation, }) - assert.NoError(t, err) + require.NoError(t, err) // Create a membership err = adapter.Add(ctx, []string{*email}) - assert.NoError(t, err) + require.NoError(t, err) // Assert the membership has been created members, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.Contains(t, members, *email) // Delete the membership err = adapter.Remove(ctx, []string{*email}) - assert.NoError(t, err) + require.NoError(t, err) // Assert the membership has been deleted members, err = adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.NotContains(t, members, *email) } diff --git a/adapters/terraformcloud/membership/membership_internal_test.go b/adapters/terraformcloud/membership/membership_internal_test.go index c5b654d6..e2432f06 100644 --- a/adapters/terraformcloud/membership/membership_internal_test.go +++ b/adapters/terraformcloud/membership/membership_internal_test.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/go-tfe" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -58,7 +59,7 @@ func TestMembership_Get(t *testing.T) { things, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, things, []string{ "foo@email", "bar@email", @@ -89,7 +90,7 @@ func TestMembership_Add(t *testing.T) { }, nil) err := adapter.Add(ctx, []string{"foo@email"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestMembership_Remove(t *testing.T) { @@ -122,7 +123,7 @@ func TestMembership_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"foo@email"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestInit(t *testing.T) { @@ -138,7 +139,7 @@ func TestInit(t *testing.T) { Organisation: "org", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &Membership{}, adapter) }) @@ -149,7 +150,7 @@ func TestInit(t *testing.T) { Token: "token", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, Organisation) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, Organisation) }) } diff --git a/adapters/terraformcloud/membership/mock_iOrganizationMemberships_test.go b/adapters/terraformcloud/membership/mock_iOrganizationMemberships_test.go index 099ce6f5..b7785d0c 100644 --- a/adapters/terraformcloud/membership/mock_iOrganizationMemberships_test.go +++ b/adapters/terraformcloud/membership/mock_iOrganizationMemberships_test.go @@ -26,6 +26,10 @@ func (_m *mockIOrganizationMemberships) EXPECT() *mockIOrganizationMemberships_E func (_m *mockIOrganizationMemberships) Create(ctx context.Context, organization string, options tfe.OrganizationMembershipCreateOptions) (*tfe.OrganizationMembership, error) { ret := _m.Called(ctx, organization, options) + if len(ret) == 0 { + panic("no return value specified for Create") + } + var r0 *tfe.OrganizationMembership var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, tfe.OrganizationMembershipCreateOptions) (*tfe.OrganizationMembership, error)); ok { @@ -82,6 +86,10 @@ func (_c *mockIOrganizationMemberships_Create_Call) RunAndReturn(run func(contex func (_m *mockIOrganizationMemberships) Delete(ctx context.Context, organizationMembershipID string) error { ret := _m.Called(ctx, organizationMembershipID) + if len(ret) == 0 { + panic("no return value specified for Delete") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, organizationMembershipID) @@ -125,6 +133,10 @@ func (_c *mockIOrganizationMemberships_Delete_Call) RunAndReturn(run func(contex func (_m *mockIOrganizationMemberships) List(ctx context.Context, organization string, options *tfe.OrganizationMembershipListOptions) (*tfe.OrganizationMembershipList, error) { ret := _m.Called(ctx, organization, options) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 *tfe.OrganizationMembershipList var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, *tfe.OrganizationMembershipListOptions) (*tfe.OrganizationMembershipList, error)); ok { @@ -181,6 +193,10 @@ func (_c *mockIOrganizationMemberships_List_Call) RunAndReturn(run func(context. func (_m *mockIOrganizationMemberships) Read(ctx context.Context, organizationMembershipID string) (*tfe.OrganizationMembership, error) { ret := _m.Called(ctx, organizationMembershipID) + if len(ret) == 0 { + panic("no return value specified for Read") + } + var r0 *tfe.OrganizationMembership var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (*tfe.OrganizationMembership, error)); ok { diff --git a/adapters/terraformcloud/team/mock_iTeams_test.go b/adapters/terraformcloud/team/mock_iTeams_test.go index 6905ffc9..5c5f8b07 100644 --- a/adapters/terraformcloud/team/mock_iTeams_test.go +++ b/adapters/terraformcloud/team/mock_iTeams_test.go @@ -26,6 +26,10 @@ func (_m *mockITeams) EXPECT() *mockITeams_Expecter { func (_m *mockITeams) Create(ctx context.Context, organization string, options tfe.TeamCreateOptions) (*tfe.Team, error) { ret := _m.Called(ctx, organization, options) + if len(ret) == 0 { + panic("no return value specified for Create") + } + var r0 *tfe.Team var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, tfe.TeamCreateOptions) (*tfe.Team, error)); ok { @@ -82,6 +86,10 @@ func (_c *mockITeams_Create_Call) RunAndReturn(run func(context.Context, string, func (_m *mockITeams) Delete(ctx context.Context, teamID string) error { ret := _m.Called(ctx, teamID) + if len(ret) == 0 { + panic("no return value specified for Delete") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, teamID) @@ -125,6 +133,10 @@ func (_c *mockITeams_Delete_Call) RunAndReturn(run func(context.Context, string) func (_m *mockITeams) List(ctx context.Context, organization string, options *tfe.TeamListOptions) (*tfe.TeamList, error) { ret := _m.Called(ctx, organization, options) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 *tfe.TeamList var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, *tfe.TeamListOptions) (*tfe.TeamList, error)); ok { diff --git a/adapters/terraformcloud/team/team_internal_test.go b/adapters/terraformcloud/team/team_internal_test.go index 794bbae6..2aae097d 100644 --- a/adapters/terraformcloud/team/team_internal_test.go +++ b/adapters/terraformcloud/team/team_internal_test.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/go-tfe" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -49,7 +50,7 @@ func TestTeam_Get(t *testing.T) { things, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, things, []string{"foo", "bar", "fizz", "buzz"}) } @@ -72,7 +73,7 @@ func TestTeam_Add(t *testing.T) { err := adapter.Add(ctx, []string{"foo"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestTeam_Remove(t *testing.T) { @@ -93,7 +94,7 @@ func TestTeam_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"foo"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestInit(t *testing.T) { @@ -106,7 +107,7 @@ func TestInit(t *testing.T) { adapter, err := Init(ctx, map[gosync.ConfigKey]string{Token: "token", Organisation: "org"}) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &Team{}, adapter) }) @@ -115,8 +116,8 @@ func TestInit(t *testing.T) { _, err := Init(ctx, map[gosync.ConfigKey]string{Organisation: "org"}) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, Token) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, Token) }) t.Run("missing organisation", func(t *testing.T) { @@ -124,8 +125,8 @@ func TestInit(t *testing.T) { _, err := Init(ctx, map[gosync.ConfigKey]string{Token: "token"}) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, Organisation) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, Organisation) }) t.Run("with logger", func(t *testing.T) { @@ -138,7 +139,7 @@ func TestInit(t *testing.T) { Organisation: "org", }, WithLogger(logger)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, logger, adapter.Logger) }) @@ -146,13 +147,13 @@ func TestInit(t *testing.T) { t.Parallel() client, err := tfe.NewClient(&tfe.Config{Token: "test"}) - assert.NoError(t, err) + require.NoError(t, err) adapter, err := Init(ctx, map[gosync.ConfigKey]string{ Organisation: "org", }, WithClient(client)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, client.Teams, adapter.teams) }) } diff --git a/adapters/terraformcloud/user/mock_iOrganizationMemberships_test.go b/adapters/terraformcloud/user/mock_iOrganizationMemberships_test.go index 2d04ff3e..0156ee20 100644 --- a/adapters/terraformcloud/user/mock_iOrganizationMemberships_test.go +++ b/adapters/terraformcloud/user/mock_iOrganizationMemberships_test.go @@ -26,6 +26,10 @@ func (_m *mockIOrganizationMemberships) EXPECT() *mockIOrganizationMemberships_E func (_m *mockIOrganizationMemberships) List(ctx context.Context, organization string, options *tfe.OrganizationMembershipListOptions) (*tfe.OrganizationMembershipList, error) { ret := _m.Called(ctx, organization, options) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 *tfe.OrganizationMembershipList var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, *tfe.OrganizationMembershipListOptions) (*tfe.OrganizationMembershipList, error)); ok { diff --git a/adapters/terraformcloud/user/mock_iTeamMembers_test.go b/adapters/terraformcloud/user/mock_iTeamMembers_test.go index acdd03cd..38c5a332 100644 --- a/adapters/terraformcloud/user/mock_iTeamMembers_test.go +++ b/adapters/terraformcloud/user/mock_iTeamMembers_test.go @@ -26,6 +26,10 @@ func (_m *mockITeamMembers) EXPECT() *mockITeamMembers_Expecter { func (_m *mockITeamMembers) Add(ctx context.Context, teamID string, options tfe.TeamMemberAddOptions) error { ret := _m.Called(ctx, teamID, options) + if len(ret) == 0 { + panic("no return value specified for Add") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, tfe.TeamMemberAddOptions) error); ok { r0 = rf(ctx, teamID, options) @@ -70,6 +74,10 @@ func (_c *mockITeamMembers_Add_Call) RunAndReturn(run func(context.Context, stri func (_m *mockITeamMembers) List(ctx context.Context, teamID string) ([]*tfe.User, error) { ret := _m.Called(ctx, teamID) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 []*tfe.User var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]*tfe.User, error)); ok { @@ -125,6 +133,10 @@ func (_c *mockITeamMembers_List_Call) RunAndReturn(run func(context.Context, str func (_m *mockITeamMembers) Remove(ctx context.Context, teamID string, options tfe.TeamMemberRemoveOptions) error { ret := _m.Called(ctx, teamID, options) + if len(ret) == 0 { + panic("no return value specified for Remove") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, tfe.TeamMemberRemoveOptions) error); ok { r0 = rf(ctx, teamID, options) diff --git a/adapters/terraformcloud/user/mock_iTeams_test.go b/adapters/terraformcloud/user/mock_iTeams_test.go index 874554f3..d61b6fe9 100644 --- a/adapters/terraformcloud/user/mock_iTeams_test.go +++ b/adapters/terraformcloud/user/mock_iTeams_test.go @@ -26,6 +26,10 @@ func (_m *mockITeams) EXPECT() *mockITeams_Expecter { func (_m *mockITeams) List(ctx context.Context, organization string, options *tfe.TeamListOptions) (*tfe.TeamList, error) { ret := _m.Called(ctx, organization, options) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 *tfe.TeamList var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, *tfe.TeamListOptions) (*tfe.TeamList, error)); ok { diff --git a/adapters/terraformcloud/user/user_internal_test.go b/adapters/terraformcloud/user/user_internal_test.go index 90b37b0d..ed6a1fbb 100644 --- a/adapters/terraformcloud/user/user_internal_test.go +++ b/adapters/terraformcloud/user/user_internal_test.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/go-tfe" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" gosync "github.com/ovotech/go-sync" ) @@ -44,7 +45,7 @@ func TestUser_Get(t *testing.T) { things, err := adapter.Get(ctx) - assert.NoError(t, err) + require.NoError(t, err) assert.ElementsMatch(t, things, []string{"foo@email", "bar@email"}) } @@ -108,7 +109,7 @@ func TestUser_Add(t *testing.T) { err := adapter.Add(ctx, []string{"foo@email", "bar@email"}) - assert.NoError(t, err) + require.NoError(t, err) } func TestUser_Remove(t *testing.T) { @@ -155,10 +156,9 @@ func TestUser_Remove(t *testing.T) { err := adapter.Remove(ctx, []string{"foo@email"}) - assert.NoError(t, err) + require.NoError(t, err) } -//nolint:funlen func TestInit(t *testing.T) { t.Parallel() @@ -173,7 +173,7 @@ func TestInit(t *testing.T) { Team: "team", }) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &User{}, adapter) }) @@ -185,8 +185,8 @@ func TestInit(t *testing.T) { Team: "team", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, Token) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, Token) }) t.Run("missing organisation", func(t *testing.T) { @@ -197,8 +197,8 @@ func TestInit(t *testing.T) { Team: "team", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, Organisation) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, Organisation) }) t.Run("missing team", func(t *testing.T) { @@ -209,8 +209,8 @@ func TestInit(t *testing.T) { Organisation: "org", }) - assert.ErrorIs(t, err, gosync.ErrMissingConfig) - assert.ErrorContains(t, err, Team) + require.ErrorIs(t, err, gosync.ErrMissingConfig) + require.ErrorContains(t, err, Team) }) t.Run("with logger", func(t *testing.T) { @@ -224,7 +224,7 @@ func TestInit(t *testing.T) { Team: "team", }, WithLogger(logger)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, logger, adapter.Logger) }) @@ -232,14 +232,14 @@ func TestInit(t *testing.T) { t.Parallel() client, err := tfe.NewClient(&tfe.Config{Token: "test"}) - assert.NoError(t, err) + require.NoError(t, err) adapter, err := Init(ctx, map[gosync.ConfigKey]string{ Organisation: "org", Team: "team", }, WithClient(client)) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, client.Teams, adapter.teams) assert.Equal(t, client.TeamMembers, adapter.teamMembers) assert.Equal(t, client.OrganizationMemberships, adapter.organizationMemberships) diff --git a/mock_Adapter_test.go b/mock_Adapter_test.go index a441ddea..3b1a9e6a 100644 --- a/mock_Adapter_test.go +++ b/mock_Adapter_test.go @@ -25,6 +25,10 @@ func (_m *MockAdapter) EXPECT() *MockAdapter_Expecter { func (_m *MockAdapter) Add(ctx context.Context, things []string) error { ret := _m.Called(ctx, things) + if len(ret) == 0 { + panic("no return value specified for Add") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok { r0 = rf(ctx, things) @@ -68,6 +72,10 @@ func (_c *MockAdapter_Add_Call) RunAndReturn(run func(context.Context, []string) func (_m *MockAdapter) Get(ctx context.Context) ([]string, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for Get") + } + var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok { @@ -122,6 +130,10 @@ func (_c *MockAdapter_Get_Call) RunAndReturn(run func(context.Context) ([]string func (_m *MockAdapter) Remove(ctx context.Context, things []string) error { ret := _m.Called(ctx, things) + if len(ret) == 0 { + panic("no return value specified for Remove") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, []string) error); ok { r0 = rf(ctx, things) diff --git a/mock_InitFn_test.go b/mock_InitFn_test.go index 41768cba..47f50558 100644 --- a/mock_InitFn_test.go +++ b/mock_InitFn_test.go @@ -32,6 +32,10 @@ func (_m *MockInitFn[T]) Execute(_a0 context.Context, _a1 map[string]string, _a2 _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Execute") + } + var r0 T var r1 error if rf, ok := ret.Get(0).(func(context.Context, map[string]string, ...ConfigFn[T]) (T, error)); ok { diff --git a/mock_Service_test.go b/mock_Service_test.go index 51a15674..572a380d 100644 --- a/mock_Service_test.go +++ b/mock_Service_test.go @@ -25,6 +25,10 @@ func (_m *MockService) EXPECT() *MockService_Expecter { func (_m *MockService) SyncWith(ctx context.Context, adapter Adapter) error { ret := _m.Called(ctx, adapter) + if len(ret) == 0 { + panic("no return value specified for SyncWith") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, Adapter) error); ok { r0 = rf(ctx, adapter) diff --git a/sync_internal_test.go b/sync_internal_test.go index 1b49c6e1..285954d7 100644 --- a/sync_internal_test.go +++ b/sync_internal_test.go @@ -7,6 +7,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" ) func TestNew(t *testing.T) { @@ -21,7 +22,6 @@ func TestNew(t *testing.T) { assert.Zero(t, adapter.Calls) } -//nolint:funlen func TestSync_SyncWith(t *testing.T) { //nolint:maintidx t.Parallel() @@ -45,7 +45,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("Add failure", func(t *testing.T) { @@ -65,8 +65,8 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.Error(t, err) - assert.ErrorIs(t, err, testErr) + require.Error(t, err) + require.ErrorIs(t, err, testErr) }) t.Run("Add error get", func(t *testing.T) { @@ -85,7 +85,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.ErrorIs(t, err, testErr) + require.ErrorIs(t, err, testErr) }) }) @@ -107,7 +107,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("Remove failure", func(t *testing.T) { @@ -127,8 +127,8 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.Error(t, err) - assert.ErrorIs(t, err, testErr) + require.Error(t, err) + require.ErrorIs(t, err, testErr) }) t.Run("Remove error get", func(t *testing.T) { @@ -146,7 +146,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.ErrorIs(t, err, testErr) + require.ErrorIs(t, err, testErr) }) t.Run("Remove error remove", func(t *testing.T) { @@ -166,7 +166,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.ErrorIs(t, err, testErr) + require.ErrorIs(t, err, testErr) }) }) @@ -187,7 +187,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("DryRun", func(t *testing.T) { @@ -206,7 +206,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx destination.EXPECT().Get(ctx).Once().Return([]string{}, nil) err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("Remove", func(t *testing.T) { @@ -222,7 +222,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx destination.EXPECT().Get(ctx).Once().Return([]string{"foo", "bar"}, nil) err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) }) @@ -239,7 +239,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("OperatingMode", func(t *testing.T) { @@ -260,7 +260,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("RemoveOnly", func(t *testing.T) { @@ -278,7 +278,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("RemoveAdd", func(t *testing.T) { //nolint:dupl @@ -297,7 +297,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, "Get", destination.Calls[0].Method) assert.Equal(t, "Remove", destination.Calls[1].Method) assert.Equal(t, "Add", destination.Calls[2].Method) @@ -319,7 +319,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) assert.Equal(t, "Get", destination.Calls[0].Method) assert.Equal(t, "Add", destination.Calls[1].Method) assert.Equal(t, "Remove", destination.Calls[2].Method) @@ -354,7 +354,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("false", func(t *testing.T) { @@ -372,7 +372,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) }) @@ -395,7 +395,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.ErrorIs(t, err, ErrTooManyChanges) + require.ErrorIs(t, err, ErrTooManyChanges) }) t.Run("1", func(t *testing.T) { @@ -406,14 +406,14 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.ErrorIs(t, err, ErrTooManyChanges) + require.ErrorIs(t, err, ErrTooManyChanges) // Set the operating mode to Remove only (only 1 addition), which should pass successfully. syncService.OperatingMode = RemoveOnly err = syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) t.Run("2", func(t *testing.T) { @@ -424,7 +424,7 @@ func TestSync_SyncWith(t *testing.T) { //nolint:maintidx err := syncService.SyncWith(ctx, destination) - assert.NoError(t, err) + require.NoError(t, err) }) }) }