diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index d7a1541..91e208b 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -16,10 +16,10 @@ jobs: with: fetch-depth: 0 - - name: Set up Go 1.26.3 + - name: Set up Go 1.26.4 uses: actions/setup-go@v6 with: - go-version: '1.26.3' + go-version: '1.26.4' - name: Build run: go build -v ./... @@ -33,7 +33,7 @@ jobs: run: go test -p 1 -v ./... -coverprofile="coverage.out" - name: SonarCloud Scan - uses: sonarsource/sonarqube-scan-action@v8.1.0 + uses: sonarsource/sonarqube-scan-action@v8.2.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} if: env.SONAR_TOKEN != '' @@ -44,7 +44,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - go-version: ['1.25.10', '1.26.3'] + go-version: ['1.25.10', '1.26.4'] steps: - name: Git checkout diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 1d30c54..5903906 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Get PR details id: pr - uses: actions/github-script@v8 + uses: actions/github-script@v9 with: script: | const pr = await github.rest.pulls.get({ @@ -33,10 +33,10 @@ jobs: ref: ${{ steps.pr.outputs.head_sha }} fetch-depth: 0 - - name: Set up Go 1.26.3 + - name: Set up Go 1.26.4 uses: actions/setup-go@v6 with: - go-version: '1.26.3' + go-version: '1.26.4' - name: Build run: go build -v ./... @@ -50,7 +50,7 @@ jobs: run: go test -p 1 -v ./... -coverprofile="coverage.out" - name: SonarCloud Scan - uses: sonarsource/sonarqube-scan-action@v8.1.0 + uses: sonarsource/sonarqube-scan-action@v8.2.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} if: env.SONAR_TOKEN != '' diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 5dfc3f4..614ec7f 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -7,7 +7,7 @@ on: go: description: 'Go version' required: true - default: '1.26.3' + default: '1.26.4' os: description: 'Operating System (ubuntu-20.04, ubuntu-latest, windows-latest)' required: true diff --git a/context_test.go b/context_test.go index 997c940..df66390 100644 --- a/context_test.go +++ b/context_test.go @@ -12,14 +12,14 @@ func TestBuildContext(t *testing.T) { Domain: "My Domain", Options: ContextOptions{ Local: true, - SnapshotLocation: "./tests/snapshots", + SnapshotLocation: "./testdata/snapshots", }, }) options := client.Context().Options assert.True(t, options.Local, "expected Local option to be true") - assert.Equal(t, "./tests/snapshots", options.SnapshotLocation, "expected SnapshotLocation to be './tests/snapshots'") + assert.Equal(t, "./testdata/snapshots", options.SnapshotLocation, "expected SnapshotLocation to be './testdata/snapshots'") }) t.Run("should create fresh default options on rebuild", func(t *testing.T) { diff --git a/execution_logger_test.go b/execution_logger_test.go index b299045..28bd440 100644 --- a/execution_logger_test.go +++ b/execution_logger_test.go @@ -170,7 +170,7 @@ func TestExecutionLogger(t *testing.T) { Options: ContextOptions{ Local: true, Logger: true, - SnapshotLocation: filepath.Join("tests", "snapshots"), + SnapshotLocation: filepath.Join("testdata", "snapshots"), }, }) diff --git a/local_test.go b/local_test.go index cfe3fcb..d6b39aa 100644 --- a/local_test.go +++ b/local_test.go @@ -236,5 +236,5 @@ func useLocalSnapshotFixture(t *testing.T, environment string) { } func snapshotFixtureDir() string { - return filepath.Join("tests", "snapshots") + return filepath.Join("testdata", "snapshots") } diff --git a/testdata/snapshots/default.json b/testdata/snapshots/default.json new file mode 100644 index 0000000..b896e47 --- /dev/null +++ b/testdata/snapshots/default.json @@ -0,0 +1,163 @@ +{ + "domain": { + "name": "Business", + "description": "Business description", + "activated": true, + "version": 1, + "group": [ + { + "name": "Rollout 2020", + "description": "Changes that will be applied during the rollout", + "activated": true, + "config": [ + { + "key": "FF2FOR2020", + "description": "Feature Flag", + "activated": true, + "strategies": [ + { + "strategy": "NETWORK_VALIDATION", + "activated": true, + "operation": "EXIST", + "values": [ + "10.0.0.3/24" + ] + }, + { + "strategy": "VALUE_VALIDATION", + "activated": true, + "operation": "NOT_EXIST", + "values": [ + "USA", + "Canada", + "Australia", + "Africa" + ] + } + ], + "components": [] + }, + { + "key": "FF2FOR2021", + "description": "Strategy disabled", + "activated": true, + "strategies": [ + { + "strategy": "NETWORK_VALIDATION", + "activated": false, + "operation": "EXIST", + "values": [ + "10.0.0.3/24" + ] + } + ], + "components": [] + }, + { + "key": "FF2FOR2022", + "description": "No strategies", + "activated": true, + "components": [] + }, + { + "key": "FF2FOR2023", + "description": "Feature Flag - Payload Strategy", + "activated": true, + "strategies": [ + { + "strategy": "PAYLOAD_VALIDATION", + "activated": true, + "operation": "HAS_ALL", + "values": [ + "id", + "user", + "user.login", + "user.role" + ] + } + ], + "components": [] + }, + { + "key": "FF2FOR2024", + "description": "reDOS safe test", + "activated": true, + "strategies": [ + { + "strategy": "REGEX_VALIDATION", + "activated": true, + "operation": "EXIST", + "values": [ + "^(([a-z])+.)+[A-Z]([a-z])+$" + ] + } + ], + "components": [] + } + ] + }, + { + "name": "Rollout 2030", + "description": "Changes that will be applied during the rollout", + "activated": true, + "config": [ + { + "key": "FF2FOR2030", + "description": "Feature Flag", + "activated": true, + "strategies": [], + "components": [] + }, + { + "key": "FF2FOR2031", + "description": "Feature Flag disabled", + "activated": false, + "strategies": [], + "components": [] + } + ] + }, + { + "name": "Rollout 2040", + "description": "Project is disabled", + "activated": false, + "config": [ + { + "key": "FF2FOR2040", + "description": "Feature Flag", + "activated": true, + "strategies": [], + "components": [] + } + ] + }, + { + "name": "Relay test", + "description": "Relay group", + "activated": true, + "config": [ + { + "key": "USECASE103", + "description": "Relay enabled", + "activated": true, + "relay": { + "type": "VALIDATOR", + "activated": true + }, + "components": [] + }, + { + "key": "USECASE104", + "description": "Relay disabled", + "relay": { + "type": "VALIDATOR", + "activated": false + }, + "activated": true, + "components": [] + } + ] + } + ] + } +} diff --git a/tests/snapshots/default_disabled.json b/testdata/snapshots/default_disabled.json similarity index 100% rename from tests/snapshots/default_disabled.json rename to testdata/snapshots/default_disabled.json diff --git a/tests/snapshots/default_load_1.json b/testdata/snapshots/default_load_1.json similarity index 100% rename from tests/snapshots/default_load_1.json rename to testdata/snapshots/default_load_1.json diff --git a/tests/snapshots/default_load_2.json b/testdata/snapshots/default_load_2.json similarity index 100% rename from tests/snapshots/default_load_2.json rename to testdata/snapshots/default_load_2.json diff --git a/tests/snapshots/default_malformed.json b/testdata/snapshots/default_malformed.json similarity index 100% rename from tests/snapshots/default_malformed.json rename to testdata/snapshots/default_malformed.json diff --git a/tests/snapshots/default_network_only.json b/testdata/snapshots/default_network_only.json similarity index 100% rename from tests/snapshots/default_network_only.json rename to testdata/snapshots/default_network_only.json diff --git a/tests/snapshots/default_value_only.json b/testdata/snapshots/default_value_only.json similarity index 100% rename from tests/snapshots/default_value_only.json rename to testdata/snapshots/default_value_only.json diff --git a/tests/snapshots/default.json b/tests/snapshots/default.json index b896e47..57385e8 100644 --- a/tests/snapshots/default.json +++ b/tests/snapshots/default.json @@ -1,163 +1,9 @@ { "domain": { - "name": "Business", - "description": "Business description", - "activated": true, - "version": 1, - "group": [ - { - "name": "Rollout 2020", - "description": "Changes that will be applied during the rollout", - "activated": true, - "config": [ - { - "key": "FF2FOR2020", - "description": "Feature Flag", - "activated": true, - "strategies": [ - { - "strategy": "NETWORK_VALIDATION", - "activated": true, - "operation": "EXIST", - "values": [ - "10.0.0.3/24" - ] - }, - { - "strategy": "VALUE_VALIDATION", - "activated": true, - "operation": "NOT_EXIST", - "values": [ - "USA", - "Canada", - "Australia", - "Africa" - ] - } - ], - "components": [] - }, - { - "key": "FF2FOR2021", - "description": "Strategy disabled", - "activated": true, - "strategies": [ - { - "strategy": "NETWORK_VALIDATION", - "activated": false, - "operation": "EXIST", - "values": [ - "10.0.0.3/24" - ] - } - ], - "components": [] - }, - { - "key": "FF2FOR2022", - "description": "No strategies", - "activated": true, - "components": [] - }, - { - "key": "FF2FOR2023", - "description": "Feature Flag - Payload Strategy", - "activated": true, - "strategies": [ - { - "strategy": "PAYLOAD_VALIDATION", - "activated": true, - "operation": "HAS_ALL", - "values": [ - "id", - "user", - "user.login", - "user.role" - ] - } - ], - "components": [] - }, - { - "key": "FF2FOR2024", - "description": "reDOS safe test", - "activated": true, - "strategies": [ - { - "strategy": "REGEX_VALIDATION", - "activated": true, - "operation": "EXIST", - "values": [ - "^(([a-z])+.)+[A-Z]([a-z])+$" - ] - } - ], - "components": [] - } - ] - }, - { - "name": "Rollout 2030", - "description": "Changes that will be applied during the rollout", - "activated": true, - "config": [ - { - "key": "FF2FOR2030", - "description": "Feature Flag", - "activated": true, - "strategies": [], - "components": [] - }, - { - "key": "FF2FOR2031", - "description": "Feature Flag disabled", - "activated": false, - "strategies": [], - "components": [] - } - ] - }, - { - "name": "Rollout 2040", - "description": "Project is disabled", - "activated": false, - "config": [ - { - "key": "FF2FOR2040", - "description": "Feature Flag", - "activated": true, - "strategies": [], - "components": [] - } - ] - }, - { - "name": "Relay test", - "description": "Relay group", - "activated": true, - "config": [ - { - "key": "USECASE103", - "description": "Relay enabled", - "activated": true, - "relay": { - "type": "VALIDATOR", - "activated": true - }, - "components": [] - }, - { - "key": "USECASE104", - "description": "Relay disabled", - "relay": { - "type": "VALIDATOR", - "activated": false - }, - "activated": true, - "components": [] - } - ] - } - ] + "name": "", + "activated": false, + "version": 0, + "group": null, + "description": "" } -} +} \ No newline at end of file