From 055e20f48e8e9fcf702a6972770264c7e90dc688 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 20:45:43 +0000 Subject: [PATCH 1/7] Bump docker/login-action from 2 to 3 Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docker.yml | 2 +- .github/workflows/unstable.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 76ccd05..26d648d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Login to Artifactory - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: splitio-docker.jfrog.io username: ${{ secrets.ARTIFACTORY_DOCKER_USER }} diff --git a/.github/workflows/unstable.yml b/.github/workflows/unstable.yml index f0c0c7d..d9a0090 100644 --- a/.github/workflows/unstable.yml +++ b/.github/workflows/unstable.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Login to Artifactory - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: splitio-docker-dev.jfrog.io username: ${{ secrets.ARTIFACTORY_DOCKER_USER }} From 6a8b1ca808063c5589fa86dc47d3f971546bf905 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 20:45:46 +0000 Subject: [PATCH 2/7] Bump mukunku/tag-exists-action from 1.2.0 to 1.5.0 Bumps [mukunku/tag-exists-action](https://github.com/mukunku/tag-exists-action) from 1.2.0 to 1.5.0. - [Release notes](https://github.com/mukunku/tag-exists-action/releases) - [Commits](https://github.com/mukunku/tag-exists-action/compare/v1.2.0...v1.5.0) --- updated-dependencies: - dependency-name: mukunku/tag-exists-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71b0cd4..caf074a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - name: Version validation if: ${{ github.event_name == 'pull_request' }} - uses: mukunku/tag-exists-action@v1.2.0 + uses: mukunku/tag-exists-action@v1.5.0 id: checkTag with: tag: v${{ env.VERSION }} From f278a7076e601ebef412bc7e259b8c45f67ee7da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 20:45:51 +0000 Subject: [PATCH 3/7] Bump actions/github-script from 6.4.0 to 7.0.1 Bumps [actions/github-script](https://github.com/actions/github-script) from 6.4.0 to 7.0.1. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v6.4.0...v7.0.1) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71b0cd4..7024cc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Fail workflow if tag exists if: ${{ github.event_name == 'pull_request' && steps.checkTag.outputs.exists == 'true' }} - uses: actions/github-script@v6.4.0 + uses: actions/github-script@v7.0.1 with: script: core.setFailed('[ERROR] Tag already exists.') From ce7ce6a93fd70e3f1aeff72b43d50836cfb02db1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 20:45:55 +0000 Subject: [PATCH 4/7] Bump docker/build-push-action from 4 to 5 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v4...v5) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docker.yml | 2 +- .github/workflows/unstable.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 76ccd05..35d3c7d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -24,7 +24,7 @@ jobs: run: echo "VERSION=$(cat splitio/version.go | grep 'Version =' | awk '{print $4}' | tr -d '"')" >> $GITHUB_ENV - name: Docker build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: . file: "infra/sidecar.Dockerfile" diff --git a/.github/workflows/unstable.yml b/.github/workflows/unstable.yml index f0c0c7d..c54a574 100644 --- a/.github/workflows/unstable.yml +++ b/.github/workflows/unstable.yml @@ -23,7 +23,7 @@ jobs: run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - name: Docker Build and Push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: . file: "infra/sidecar.Dockerfile" From 0356688f812924f7acf739b2221c1252810ffbb9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 20:45:59 +0000 Subject: [PATCH 5/7] Bump actions/setup-go from 4 to 5 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71b0cd4..6456ef5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: script: core.setFailed('[ERROR] Tag already exists.') - name: Setup Go version - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: '^1.20.7' From 96fdc173afe74a989bc9d065cdc415290a859a30 Mon Sep 17 00:00:00 2001 From: Matias Melograno Date: Thu, 25 Jan 2024 18:08:50 -0300 Subject: [PATCH 6/7] fixed test to map --- splitio/sdk/sdk_test.go | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/splitio/sdk/sdk_test.go b/splitio/sdk/sdk_test.go index b28750b..43a536d 100644 --- a/splitio/sdk/sdk_test.go +++ b/splitio/sdk/sdk_test.go @@ -218,27 +218,39 @@ func TestTreatmentsByFlagSet(t *testing.T) { }}). Once() - expectedImpressions := []dtos.Impression{ - {KeyName: "key1", BucketingKey: "", FeatureName: "f1", Treatment: "on", Label: "label1", ChangeNumber: 123}, - {KeyName: "key1", BucketingKey: "", FeatureName: "f2", Treatment: "on", Label: "label2", ChangeNumber: 124}, - {KeyName: "key1", BucketingKey: "", FeatureName: "f3", Treatment: "on", Label: "label3", ChangeNumber: 125}, + expectedImpressions := map[string]*dtos.Impression{ + "f1": {KeyName: "key1", BucketingKey: "", FeatureName: "f1", Treatment: "on", Label: "label1", ChangeNumber: 123}, + "f2": {KeyName: "key1", BucketingKey: "", FeatureName: "f2", Treatment: "on", Label: "label2", ChangeNumber: 124}, + "f3": {KeyName: "key1", BucketingKey: "", FeatureName: "f3", Treatment: "on", Label: "label3", ChangeNumber: 125}, } im := &mocks.ImpressionManagerMock{} im.On("ProcessSingle", mock.Anything). Run(func(args mock.Arguments) { - assertImpEq(t, &expectedImpressions[0], args.Get(0).(*dtos.Impression)) + imp, ok := args.Get(0).(*dtos.Impression) + if !ok { + t.Error("not an impression") + } + assertImpEq(t, expectedImpressions[imp.FeatureName], args.Get(0).(*dtos.Impression)) }). Return(true). Once() im.On("ProcessSingle", mock.Anything). Run(func(args mock.Arguments) { - assertImpEq(t, &expectedImpressions[1], args.Get(0).(*dtos.Impression)) + imp, ok := args.Get(0).(*dtos.Impression) + if !ok { + t.Error("not an impression") + } + assertImpEq(t, expectedImpressions[imp.FeatureName], args.Get(0).(*dtos.Impression)) }). Return(true). Once() im.On("ProcessSingle", mock.Anything). Run(func(args mock.Arguments) { - assertImpEq(t, &expectedImpressions[2], args.Get(0).(*dtos.Impression)) + imp, ok := args.Get(0).(*dtos.Impression) + if !ok { + t.Error("not an impression") + } + assertImpEq(t, expectedImpressions[imp.FeatureName], args.Get(0).(*dtos.Impression)) }). Return(true). Once() @@ -258,9 +270,9 @@ func TestTreatmentsByFlagSet(t *testing.T) { assert.Nil(t, res["f1"].Config) assert.Nil(t, res["f2"].Config) assert.Nil(t, res["f3"].Config) - assertImpEq(t, &expectedImpressions[0], res["f1"].Impression) - assertImpEq(t, &expectedImpressions[1], res["f2"].Impression) - assertImpEq(t, &expectedImpressions[2], res["f3"].Impression) + assertImpEq(t, expectedImpressions["f1"], res["f1"].Impression) + assertImpEq(t, expectedImpressions["f2"], res["f2"].Impression) + assertImpEq(t, expectedImpressions["f3"], res["f3"].Impression) err = is.RangeAndClear(func(md types.ClientMetadata, st *storage.LockingQueue[dtos.Impression]) { assert.Equal(t, types.ClientMetadata{ID: "some", SdkVersion: "go-1.2.3"}, md) @@ -271,9 +283,9 @@ func TestTreatmentsByFlagSet(t *testing.T) { assert.Nil(t, nil) assert.Equal(t, 3, n) assert.Equal(t, 3, len(imps)) - assertImpEq(t, &expectedImpressions[0], &imps[0]) - assertImpEq(t, &expectedImpressions[1], &imps[1]) - assertImpEq(t, &expectedImpressions[2], &imps[2]) + assertImpEq(t, expectedImpressions[imps[0].FeatureName], &imps[0]) + assertImpEq(t, expectedImpressions[imps[1].FeatureName], &imps[1]) + assertImpEq(t, expectedImpressions[imps[2].FeatureName], &imps[2]) n, err = st.Pop(1, &imps) assert.Equal(t, 0, n) assert.ErrorIs(t, err, storage.ErrQueueEmpty) From e7f7641380f62c50643bd858b867b72e0f8f0db5 Mon Sep 17 00:00:00 2001 From: Matias Melograno Date: Thu, 25 Jan 2024 18:14:07 -0300 Subject: [PATCH 7/7] fixed test for flagSets --- splitio/sdk/sdk_test.go | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/splitio/sdk/sdk_test.go b/splitio/sdk/sdk_test.go index 43a536d..15db214 100644 --- a/splitio/sdk/sdk_test.go +++ b/splitio/sdk/sdk_test.go @@ -307,27 +307,39 @@ func TestTreatmentsByFlagSets(t *testing.T) { }}). Once() - expectedImpressions := []dtos.Impression{ - {KeyName: "key1", BucketingKey: "", FeatureName: "f1", Treatment: "on", Label: "label1", ChangeNumber: 123}, - {KeyName: "key1", BucketingKey: "", FeatureName: "f2", Treatment: "on", Label: "label2", ChangeNumber: 124}, - {KeyName: "key1", BucketingKey: "", FeatureName: "f3", Treatment: "on", Label: "label3", ChangeNumber: 125}, + expectedImpressions := map[string]*dtos.Impression{ + "f1": {KeyName: "key1", BucketingKey: "", FeatureName: "f1", Treatment: "on", Label: "label1", ChangeNumber: 123}, + "f2": {KeyName: "key1", BucketingKey: "", FeatureName: "f2", Treatment: "on", Label: "label2", ChangeNumber: 124}, + "f3": {KeyName: "key1", BucketingKey: "", FeatureName: "f3", Treatment: "on", Label: "label3", ChangeNumber: 125}, } im := &mocks.ImpressionManagerMock{} im.On("ProcessSingle", mock.Anything). Run(func(args mock.Arguments) { - assertImpEq(t, &expectedImpressions[0], args.Get(0).(*dtos.Impression)) + imp, ok := args.Get(0).(*dtos.Impression) + if !ok { + t.Error("not an impression") + } + assertImpEq(t, expectedImpressions[imp.FeatureName], args.Get(0).(*dtos.Impression)) }). Return(true). Once() im.On("ProcessSingle", mock.Anything). Run(func(args mock.Arguments) { - assertImpEq(t, &expectedImpressions[1], args.Get(0).(*dtos.Impression)) + imp, ok := args.Get(0).(*dtos.Impression) + if !ok { + t.Error("not an impression") + } + assertImpEq(t, expectedImpressions[imp.FeatureName], args.Get(0).(*dtos.Impression)) }). Return(true). Once() im.On("ProcessSingle", mock.Anything). Run(func(args mock.Arguments) { - assertImpEq(t, &expectedImpressions[2], args.Get(0).(*dtos.Impression)) + imp, ok := args.Get(0).(*dtos.Impression) + if !ok { + t.Error("not an impression") + } + assertImpEq(t, expectedImpressions[imp.FeatureName], args.Get(0).(*dtos.Impression)) }). Return(true). Once() @@ -347,9 +359,9 @@ func TestTreatmentsByFlagSets(t *testing.T) { assert.Nil(t, res["f1"].Config) assert.Nil(t, res["f2"].Config) assert.Nil(t, res["f3"].Config) - assertImpEq(t, &expectedImpressions[0], res["f1"].Impression) - assertImpEq(t, &expectedImpressions[1], res["f2"].Impression) - assertImpEq(t, &expectedImpressions[2], res["f3"].Impression) + assertImpEq(t, expectedImpressions["f1"], res["f1"].Impression) + assertImpEq(t, expectedImpressions["f2"], res["f2"].Impression) + assertImpEq(t, expectedImpressions["f3"], res["f3"].Impression) err = is.RangeAndClear(func(md types.ClientMetadata, st *storage.LockingQueue[dtos.Impression]) { assert.Equal(t, types.ClientMetadata{ID: "some", SdkVersion: "go-1.2.3"}, md) @@ -360,9 +372,9 @@ func TestTreatmentsByFlagSets(t *testing.T) { assert.Nil(t, nil) assert.Equal(t, 3, n) assert.Equal(t, 3, len(imps)) - assertImpEq(t, &expectedImpressions[0], &imps[0]) - assertImpEq(t, &expectedImpressions[1], &imps[1]) - assertImpEq(t, &expectedImpressions[2], &imps[2]) + assertImpEq(t, expectedImpressions[imps[0].FeatureName], &imps[0]) + assertImpEq(t, expectedImpressions[imps[1].FeatureName], &imps[1]) + assertImpEq(t, expectedImpressions[imps[2].FeatureName], &imps[2]) n, err = st.Pop(1, &imps) assert.Equal(t, 0, n) assert.ErrorIs(t, err, storage.ErrQueueEmpty)