diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7049d4fd4..6512dc79b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,8 +5,18 @@ updates: - package-ecosystem: "gomod" directory: "/" schedule: - interval: "daily" + interval: "weekly" + groups: + dev-dependencies: + dependency-type: "development" + prod-dependencies: + dependency-type: "production" - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "weekly" + groups: + dev-dependencies: + dependency-type: "development" + prod-dependencies: + dependency-type: "production" diff --git a/.github/workflows/pre-main.yml b/.github/workflows/pre-main.yml index c94c2fbea..d74fe66f2 100644 --- a/.github/workflows/pre-main.yml +++ b/.github/workflows/pre-main.yml @@ -15,21 +15,21 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up Go 1.23 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + - name: Set up Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: - go-version: 1.23.6 + go-version-file: go.mod - - uses: nosborn/github-action-markdown-cli@9b5e871c11cc0649c5ac2526af22e23525fa344d # v3.3.0 + - uses: nosborn/github-action-markdown-cli@58bcfd1af530d87a13d51b76e6713b52602e3613 # v3.4.0 with: files: README.md - uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca # master with: ignore_paths: vendor - - uses: mfinelli/setup-shfmt@031e887e39d899d773a7e9b6dd6472c2c23ff50d # v3.0.1 + - uses: mfinelli/setup-shfmt@1a143389339b48c4b48ae3cdc058f3dbe336a701 # v3.0.2 - run: shfmt -d scripts/*.sh - - uses: crate-ci/typos@9d890159570d5018df91fedfa40b4730cd4a81b1 # master + - uses: crate-ci/typos@51f257b946f503b768e522781f56e9b7b5570d48 # master - uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1 with: file_or_dir: .github/workflows/*.yml config/*.yaml @@ -45,8 +45,11 @@ jobs: empty-lines: level: warning - - name: Run lint - run: make lint + - name: Golangci-lint + uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.4.1 + with: + version: v1.64 + args: --timeout 10m0s build: runs-on: ubuntu-22.04 @@ -54,10 +57,10 @@ jobs: SHELL: /bin/bash steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up Go 1.23 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + - name: Set up Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: - go-version: 1.23.6 + go-version-file: go.mod - name: Install ginkgo run: make install-ginkgo @@ -73,10 +76,10 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Set up Go 1.23 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + - name: Set up Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: - go-version: 1.23.6 + go-version-file: go.mod - name: Checkout the certsuite repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/.github/workflows/qe.yml b/.github/workflows/qe.yml index df56b1be6..a0e193edc 100644 --- a/.github/workflows/qe.yml +++ b/.github/workflows/qe.yml @@ -35,19 +35,19 @@ jobs: touch ${PFLT_DOCKERCONFIG} echo '{ "auths": {} }' >> ${PFLT_DOCKERCONFIG} - - name: Set up Go 1.23 - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 - with: - go-version: 1.23.6 - - - name: Disable default go problem matcher - run: echo "::remove-matcher owner=go::" - - name: Check out code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ github.sha }} + - name: Set up Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + with: + go-version-file: go.mod + + - name: Disable default go problem matcher + run: echo "::remove-matcher owner=go::" + - name: Check out `certsuite-sample-workload` uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -59,34 +59,15 @@ jobs: sudo apt-get update sudo apt-get install -y python3-pip - - name: Create docker/daemon.json if it does not exist - run: | - if [ ! -f /etc/docker/daemon.json ]; then - echo '{}' | sudo tee /etc/docker/daemon.json - fi - - # Create a Kind cluster for testing. - - name: Bootstrap the Kind and OC/Kubectl binaries for the `local-test-infra` - run: make bootstrap-cluster - working-directory: certsuite-sample-workload - - # Restart docker using /mnt/docker-storage (sdb) instead of /var/lib/docker (sda). - # This step needs to be done right after the partner repo's bootstrap scripts, as they - # overwrite the docker's daemon.json. - - name: Make docker to use /mnt (sdb) for storage - run: | - df -h - lsblk - sudo mkdir /mnt/docker-storage - sudo jq '. +={"data-root" : "/mnt/docker-storage"}' < /etc/docker/daemon.json > /tmp/docker-daemon.json - sudo cp /tmp/docker-daemon.json /etc/docker/daemon.json - cat /etc/docker/daemon.json - sudo systemctl restart docker - sudo ls -la /mnt/docker-storage - - - name: Create `local-test-infra` OpenShift resources - run: make rebuild-cluster - working-directory: certsuite-sample-workload + - name: Setup up k8s cluster + uses: palmsoftware/quick-k8s@v0.0.20 + with: + disableDefaultCni: true + numControlPlaneNodes: 1 + numWorkerNodes: 2 + installOLM: true + removeDefaultStorageClass: true + removeControlPlaneTaint: true - name: Install partner resources run: python3 -m venv .venv; source .venv/bin/activate; pip install --upgrade pip; pip install jinjanator; cp .venv/bin/jinjanate .venv/bin/j2; make install-for-qe @@ -108,13 +89,13 @@ jobs: ref: main - name: Extract dependent Pull Requests - uses: depends-on/depends-on-action@77e67971a155b35424508ada365790c47286fd0f # main + uses: depends-on/depends-on-action@61cb3f4a0e2c8ae4b90c9448dc57c7ba9ca24c35 # main with: token: ${{ secrets.GITHUB_TOKEN }} extra-dirs: certsuite-sample-workload certsuite - name: Run the tests (against image) - uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 + uses: nick-fields/retry@c97818ca39074beaea45180dba704f92496a0082 # v3.0.1 with: timeout_minutes: 60 max_attempts: 3 @@ -126,7 +107,7 @@ jobs: working-directory: certsuite - name: Run the tests (against binary) - uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0 + uses: nick-fields/retry@c97818ca39074beaea45180dba704f92496a0082 # v3.0.1 with: timeout_minutes: 60 max_attempts: 3 @@ -137,7 +118,7 @@ jobs: steps: - name: Extract dependent PR - uses: depends-on/depends-on-action@77e67971a155b35424508ada365790c47286fd0f # main + uses: depends-on/depends-on-action@61cb3f4a0e2c8ae4b90c9448dc57c7ba9ca24c35 # main with: token: ${{ secrets.GITHUB_TOKEN }} check-unmerged-pr: true diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 59fee1de8..a29947a86 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -59,7 +59,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 with: name: SARIF file path: results.sarif @@ -68,6 +68,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 + uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 with: sarif_file: results.sarif diff --git a/.golangci.yml b/.golangci.yml index ef6b6e77a..e2e2194f5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,6 @@ run: - go: "1.23" - timeout: 15m0s - skip-dirs-use-default: true - fast: false + go: "1.24" + timeout: 15m linters-settings: revive: @@ -21,9 +19,6 @@ linters-settings: funlen: lines: 175 statements: 85 - unused: - check-exported: true - go: "1.23" stylecheck: dot-import-whitelist: - github.com/onsi/gomega @@ -84,9 +79,6 @@ linters: - wastedassign - wsl - nlreturn - -output: - formats: colored-line-number issues: max-issues-per-linter: 0 max-same-issues: 0 diff --git a/README.md b/README.md index 0a9c1fd90..b82484662 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ The tests are run on the OCP cluster with certain requirements that are listed b | | Conditions | Mandatory | | ------ | ------ | ------ | -| OCP Cluster | Version: >= 4.12, Node Count >= 3 with 2 cnf-worker nodes | Yes -| Installed Operators | Performance Addon, Machine-config-operator | Yes -| | Machine config pool, PTP operator, SR-IOV operator| No +| OCP Cluster | Version: >= 4.12, Node Count >= 3 with 2 cnf-worker nodes | Yes | +| Installed Operators | Performance Addon, Machine-config-operator | Yes | +| | Machine config pool, PTP operator, SR-IOV operator| No | > Bare-minimum requirements consists of a OCP cluster with 3 nodes where 2 are cnf-worker nodes and 1 worker node. @@ -52,19 +52,20 @@ Choose the variant that suits you best: ### Environment variables The following environment variables are used to configure the test setup. + | Env Variable Name | Purpose | | ------ | ------ | -| FEATURES | To select the test scenarios that you are going to test, comma separated -| CERTSUITE_REPO_PATH | Points to the absolute path to [certsuite](https://github.com/redhat-best-practices-for-k8s/certsuite) on your machine -| CERTSUITE_IMAGE | Links to the Certsuite image. Default is quay.io/redhat-best-practices-for-k8s/certsuite -| CERTSUITE_IMAGE_TAG | image tag that is going to be tested. Default is latest -| TEST_IMAGE | Test image that is going to be used for all test resources such as deployments, daemonsets and so on. Default is quay.io/testnetworkfunction/k8s-best-practices-debug -| DEBUG_CERTSUITE | Generate `Debug` folder that will contain Certsuite suites folders with Certsuite logs for each test. -| CERTSUITE_LOG_LEVEL | Log level. Default is 4 -| DISABLE_INTRUSIVE_TESTS | Turns off the intrusive tests for faster execution. Default is `false`. -| ENABLE_PARALLEL | Enable ginkgo -p parallel flags (experimental). Default is `false`. -| FORCE_DOWNLOAD_UNSTABLE | Force download the unstable image. Default is `false`. -| NON_LINUX_ENV | Allow the test suites to run in a non Linux environment. Default is `false`. +| FEATURES | To select the test scenarios that you are going to test, comma separated | +| CERTSUITE_REPO_PATH | Points to the absolute path to [certsuite](https://github.com/redhat-best-practices-for-k8s/certsuite) on your machine | +| CERTSUITE_IMAGE | Links to the Certsuite image. Default is quay.io/redhat-best-practices-for-k8s/certsuite | +| CERTSUITE_IMAGE_TAG | image tag that is going to be tested. Default is latest | +| TEST_IMAGE | Test image that is going to be used for all test resources such as deployments, daemonsets and so on. Default is quay.io/testnetworkfunction/k8s-best-practices-debug | +| DEBUG_CERTSUITE | Generate `Debug` folder that will contain Certsuite suites folders with Certsuite logs for each test. | +| CERTSUITE_LOG_LEVEL | Log level. Default is 4 | +| DISABLE_INTRUSIVE_TESTS | Turns off the intrusive tests for faster execution. Default is `false`. | +| ENABLE_PARALLEL | Enable ginkgo -p parallel flags (experimental). Default is `false`. | +| FORCE_DOWNLOAD_UNSTABLE | Force download the unstable image. Default is `false`. | +| NON_LINUX_ENV | Allow the test suites to run in a non Linux environment. Default is `false`. | ## Steps to run the tests diff --git a/go.mod b/go.mod index 1f01e7d0b..24c744095 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/redhat-best-practices-for-k8s/certsuite-qe -go 1.23.6 +go 1.24.0 require ( github.com/golang/glog v1.2.4 @@ -13,21 +13,21 @@ require ( github.com/openshift/machine-config-operator v0.0.1-0.20231024085435-7e1fb719c1ba github.com/operator-framework/api v0.29.0 github.com/operator-framework/operator-lifecycle-manager v0.0.0-00010101000000-000000000000 - github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.53 - github.com/redhat-best-practices-for-k8s/oct v0.0.33 + github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.54 + github.com/redhat-best-practices-for-k8s/oct v0.0.34 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 github.com/test-network-function/cr-scale-operator v0.0.0-20230810174010-26b23b7b446f gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.32.1 - k8s.io/apiextensions-apiserver v0.32.1 - k8s.io/apimachinery v0.32.1 + k8s.io/api v0.32.2 + k8s.io/apiextensions-apiserver v0.32.2 + k8s.io/apimachinery v0.32.2 k8s.io/client-go v12.0.0+incompatible k8s.io/utils v0.0.0-20241210054802-24370beab758 - sigs.k8s.io/controller-runtime v0.20.1 + sigs.k8s.io/controller-runtime v0.20.2 ) -require github.com/evanphx/json-patch/v5 v5.9.0 // indirect +require github.com/evanphx/json-patch/v5 v5.9.11 // indirect require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect @@ -141,12 +141,12 @@ require ( gopkg.in/k8snetworkplumbingwg/multus-cni.v4 v4.1.4 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gorm.io/gorm v1.25.12 // indirect - helm.sh/helm/v3 v3.17.0 // indirect - k8s.io/cli-runtime v0.32.0 // indirect - k8s.io/component-base v0.32.1 // indirect + helm.sh/helm/v3 v3.17.1 // indirect + k8s.io/cli-runtime v0.32.1 // indirect + k8s.io/component-base v0.32.2 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect - k8s.io/kubectl v0.32.0 // indirect + k8s.io/kubectl v0.32.1 // indirect k8s.io/kubelet v0.31.5 // indirect sigs.k8s.io/container-object-storage-interface-api v0.1.0 // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect diff --git a/go.sum b/go.sum index 0a96fbe7d..1440f3964 100644 --- a/go.sum +++ b/go.sum @@ -64,8 +64,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= -github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= +github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f h1:Wl78ApPPB2Wvf/TIe2xdyJxTlb6obmF18d8QdkxNDu4= github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f/go.mod h1:OSYXu++VVOHnXeitef/D8n/6y4QV8uLHSFXX4NeXMGc= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= @@ -410,10 +410,10 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/red-hat-storage/odf-operator v0.0.0-20241124050455-02681e6c10df h1:vVue8Ytv9xEMIC15PPh2FiL8k8YAZvtUd6E6r1xRyJk= github.com/red-hat-storage/odf-operator v0.0.0-20241124050455-02681e6c10df/go.mod h1:Qgmgk+Wa61zuvR9mRQEOjD6tcUezT7aU5GXaBup6eXM= -github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.53 h1:JpOpMuoF3vcOzFHzHbSFfpVNCRK+NzgzcLMuh9LBIC0= -github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.53/go.mod h1:rBPn/0yfImagRMIggnvy6JObVkBfsShe0gv5KaS6zIM= -github.com/redhat-best-practices-for-k8s/oct v0.0.33 h1:QYbI9xmw29xI4dyU4hTX3rqJTUybTU84c+Gbwsk41GA= -github.com/redhat-best-practices-for-k8s/oct v0.0.33/go.mod h1:LWkXbXB7OTEK28WSxwIe1SCu56KAT9OsvcZIRbEssxY= +github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.54 h1:j7NUwiAKK01FXo34kUgAhY50jJWBBxP9g3d1uMNvdRY= +github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.54/go.mod h1:EL1YEjkEAD/EV6BI1KFVS4F8a90vdJ+MyriqO3P2UCs= +github.com/redhat-best-practices-for-k8s/oct v0.0.34 h1:PbMknG8V2X7XcVQV9Z6C6vYsLI5pjc/PgknV8/XkBx4= +github.com/redhat-best-practices-for-k8s/oct v0.0.34/go.mod h1:2Nkzv6BKopRJBjlG4b2F7KaWnWwFCBcDXAKUnjEDsg0= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= @@ -799,31 +799,33 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8= gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= -helm.sh/helm/v3 v3.17.0 h1:DUD4AGdNVn7PSTYfxe1gmQG7s18QeWv/4jI9TubnhT0= -helm.sh/helm/v3 v3.17.0/go.mod h1:Mo7eGyKPPHlS0Ml67W8z/lbkox/gD9Xt1XpD6bxvZZA= +helm.sh/helm/v3 v3.17.1 h1:gzVoAD+qVuoJU6KDMSAeo0xRJ6N1znRxz3wyuXRmJDk= +helm.sh/helm/v3 v3.17.1/go.mod h1:nvreuhuR+j78NkQcLC3TYoprCKStLyw5P4T7E5itv2w= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/api v0.22.7/go.mod h1:7hejA1BgBEiSsWljUyRkIjj+AISXO16IwsaDgFjJsQE= k8s.io/api v0.23.3/go.mod h1:w258XdGyvCmnBj/vGzQMj6kzdufJZVUwEM1U2fRJwSQ= k8s.io/api v0.23.5/go.mod h1:Na4XuKng8PXJ2JsploYYrivXrINeTaycCGcYgF91Xm8= -k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc= k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k= -k8s.io/apiextensions-apiserver v0.32.1 h1:hjkALhRUeCariC8DiVmb5jj0VjIc1N0DREP32+6UXZw= -k8s.io/apiextensions-apiserver v0.32.1/go.mod h1:sxWIGuGiYov7Io1fAS2X06NjMIk5CbRHc2StSmbaQto= +k8s.io/api v0.32.2 h1:bZrMLEkgizC24G9eViHGOPbW+aRo9duEISRIJKfdJuw= +k8s.io/api v0.32.2/go.mod h1:hKlhk4x1sJyYnHENsrdCWw31FEmCijNGPJO5WzHiJ6Y= +k8s.io/apiextensions-apiserver v0.32.2 h1:2YMk285jWMk2188V2AERy5yDwBYrjgWYggscghPCvV4= +k8s.io/apiextensions-apiserver v0.32.2/go.mod h1:GPwf8sph7YlJT3H6aKUWtd0E+oyShk/YHWQHf/OOgCA= k8s.io/apimachinery v0.22.7/go.mod h1:ZvVLP5iLhwVFg2Yx9Gh5W0um0DUauExbRhe+2Z8I1EU= k8s.io/apimachinery v0.23.3/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= k8s.io/apimachinery v0.23.5/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= -k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= -k8s.io/cli-runtime v0.32.0 h1:dP+OZqs7zHPpGQMCGAhectbHU2SNCuZtIimRKTv2T1c= -k8s.io/cli-runtime v0.32.0/go.mod h1:Mai8ht2+esoDRK5hr861KRy6z0zHsSTYttNVJXgP3YQ= +k8s.io/apimachinery v0.32.2 h1:yoQBR9ZGkA6Rgmhbp/yuT9/g+4lxtsGYwW6dR6BDPLQ= +k8s.io/apimachinery v0.32.2/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= +k8s.io/cli-runtime v0.32.1 h1:19nwZPlYGJPUDbhAxDIS2/oydCikvKMHsxroKNGA2mM= +k8s.io/cli-runtime v0.32.1/go.mod h1:NJPbeadVFnV2E7B7vF+FvU09mpwYlZCu8PqjzfuOnkY= k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU= k8s.io/client-go v0.32.1/go.mod h1:aTTKZY7MdxUaJ/KiUs8D+GssR9zJZi77ZqtzcGXIiDg= k8s.io/code-generator v0.20.1/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg= k8s.io/code-generator v0.22.7/go.mod h1:iOZwYADSgFPNGWfqHFfg1V0TNJnl1t0WyZluQp4baqU= k8s.io/code-generator v0.23.3/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk= -k8s.io/component-base v0.32.1 h1:/5IfJ0dHIKBWysGV0yKTFfacZ5yNV1sulPh3ilJjRZk= -k8s.io/component-base v0.32.1/go.mod h1:j1iMMHi/sqAHeG5z+O9BFNCF698a1u0186zkjMZQ28w= +k8s.io/component-base v0.32.2 h1:1aUL5Vdmu7qNo4ZsE+569PV5zFatM9hl+lb3dEea2zU= +k8s.io/component-base v0.32.2/go.mod h1:PXJ61Vx9Lg+P5mS8TLd7bCIr+eMJRQTyXe8KvkrvJq0= k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= @@ -847,8 +849,8 @@ k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf/go.mod h1:sX9MT8g7NVZM5lV k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 h1:hcha5B1kVACrLujCKLbr8XWMxCxzQx42DY8QKYJrDLg= k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7/go.mod h1:GewRfANuJ70iYzvn+i4lezLDAFzvjxZYK1gn1lWcfas= -k8s.io/kubectl v0.32.0 h1:rpxl+ng9qeG79YA4Em9tLSfX0G8W0vfaiPVrc/WR7Xw= -k8s.io/kubectl v0.32.0/go.mod h1:qIjSX+QgPQUgdy8ps6eKsYNF+YmFOAO3WygfucIqFiE= +k8s.io/kubectl v0.32.1 h1:/btLtXLQUU1rWx8AEvX9jrb9LaI6yeezt3sFALhB8M8= +k8s.io/kubectl v0.32.1/go.mod h1:sezNuyWi1STk4ZNPVRIFfgjqMI6XMf+oCVLjZen/pFQ= k8s.io/kubelet v0.31.5 h1:AnGDd4NV1PybzffhosECiJe5dWxZJ/f6S4gtuZuHzIA= k8s.io/kubelet v0.31.5/go.mod h1:tILiNKFnjjWUg/SGIclQ6GA8ZWN653wATqIrzParnjs= k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= @@ -859,8 +861,8 @@ k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJ k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/container-object-storage-interface-api v0.1.0 h1:8tB6JFQhbQIC1hwGQ+q4+tmSSNfjKemb7bFI6C0CK/4= sigs.k8s.io/container-object-storage-interface-api v0.1.0/go.mod h1:YiB+i/UGkzqgODDhRG3u7jkbWkQcoUeLEJ7hwOT/2Qk= -sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE= -sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU= +sigs.k8s.io/controller-runtime v0.20.2 h1:/439OZVxoEc02psi1h4QO3bHzTgu49bb347Xp4gW1pc= +sigs.k8s.io/controller-runtime v0.20.2/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY= sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= diff --git a/scripts/golangci-lint.sh b/scripts/golangci-lint.sh index 013ea29ec..534d25356 100755 --- a/scripts/golangci-lint.sh +++ b/scripts/golangci-lint.sh @@ -13,7 +13,7 @@ else else DEPLOY_PATH=${GOPATH}/bin fi - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${DEPLOY_PATH}" v1.63.4 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${DEPLOY_PATH}" v1.64.2 fi PATH=${PATH}:${DEPLOY_PATH} golangci-lint run -v diff --git a/scripts/install-latest-go.sh b/scripts/install-latest-go.sh index cdd2e58c8..d9649d950 100755 --- a/scripts/install-latest-go.sh +++ b/scripts/install-latest-go.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -REQUIRED_GO_VERSION=1.23.6 +REQUIRED_GO_VERSION=1.24.0 INSTALLED_GO_VERSION="$( go version | { read -r _ _ v _ diff --git a/tests/operator/parameters/parameters.go b/tests/operator/parameters/parameters.go index ea59773e4..4e5d7030e 100644 --- a/tests/operator/parameters/parameters.go +++ b/tests/operator/parameters/parameters.go @@ -34,7 +34,7 @@ var ( "app": "test", } CertsuiteTargetOperatorLabels = fmt.Sprintf("%s: %s", "redhat-best-practices-for-k8s.com/operator", "target") - CertsuiteTargetCrdFilters = []string{"nginxingresses.charts.nginx.org"} // "anchoreengines.charts.anchore.io" + CertsuiteTargetCrdFilters = []string{"nginxingresses.charts.nginx.org"} OperatorGroupName = "operator-test-operator-group" OperatorLabel = map[string]string{"redhat-best-practices-for-k8s.com/operator": "target"} CertifiedOperatorGroup = "certified-operators" diff --git a/tests/operator/tests/operator_single_or_multi_namespaced_allowed_in_tenant_namespaces.go b/tests/operator/tests/operator_single_or_multi_namespaced_allowed_in_tenant_namespaces.go index bb0301d55..9b16a38a9 100644 --- a/tests/operator/tests/operator_single_or_multi_namespaced_allowed_in_tenant_namespaces.go +++ b/tests/operator/tests/operator_single_or_multi_namespaced_allowed_in_tenant_namespaces.go @@ -50,7 +50,8 @@ var _ = Describe("Operator single-or-multi-namespaced-allowed-in-tenant-namespac }) It("operator namespace contains only single/multi namespace operator", func() { - createTestOperatorGroup(randomNamespace, tsparams.SingleOrMultiNamespacedOperatorGroup, []string{randomNamespace + "-one", randomNamespace + "-two"}) + createTestOperatorGroup(randomNamespace, tsparams.SingleOrMultiNamespacedOperatorGroup, + []string{randomNamespace + "-one"}) installAndLabelOperator(randomNamespace) By("Start test") @@ -95,7 +96,8 @@ var _ = Describe("Operator single-or-multi-namespaced-allowed-in-tenant-namespac It("operator namespace contains single namespaced operator with cluster-wide operator installed in a different namespace", func() { installClusterWideOperator() - createTestOperatorGroup(randomNamespace, tsparams.SingleOrMultiNamespacedOperatorGroup, []string{randomNamespace + "-one", randomNamespace + "-two"}) + createTestOperatorGroup(randomNamespace, tsparams.SingleOrMultiNamespacedOperatorGroup, + []string{randomNamespace + "-one", randomNamespace + "-two"}) installAndLabelOperator(randomNamespace) By("Start test") @@ -135,8 +137,8 @@ var _ = Describe("Operator single-or-multi-namespaced-allowed-in-tenant-namespac // negative It("operator namespace contains single namespaced operator with non-operator pods", func() { - - createTestOperatorGroup(randomNamespace, tsparams.SingleOrMultiNamespacedOperatorGroup, []string{randomNamespace + "-one", randomNamespace + "-two"}) + createTestOperatorGroup(randomNamespace, tsparams.SingleOrMultiNamespacedOperatorGroup, + []string{randomNamespace + "-one", randomNamespace + "-two"}) installAndLabelOperator(randomNamespace) By("Define pod") @@ -256,8 +258,8 @@ var _ = Describe("Operator single-or-multi-namespaced-allowed-in-tenant-namespac func installClusterWideOperator() { const ( clusterLoggingOperatorName = "cluster-logging" + openshiftLoggingNamespace = "cluster-logging" ) - openshiftLoggingNamespace := clusterLoggingOperatorName By("Create openshift-logging namespace") err := globalhelper.CreateNamespace(openshiftLoggingNamespace) @@ -317,6 +319,7 @@ func createTestOperatorGroup(namespace, operatorGroupName string, targetNamespac } DeferCleanup(func() { + for _, targetNamespace := range targetNamespaces { err := globalhelper.DeleteNamespaceAndWait(targetNamespace, tsparams.Timeout) Expect(err).ToNot(HaveOccurred(), "Error deleting namespace "+targetNamespace) diff --git a/vendor/github.com/evanphx/json-patch/v5/merge.go b/vendor/github.com/evanphx/json-patch/v5/merge.go index f79caf313..d60afadcf 100644 --- a/vendor/github.com/evanphx/json-patch/v5/merge.go +++ b/vendor/github.com/evanphx/json-patch/v5/merge.go @@ -103,8 +103,8 @@ func pruneAryNulls(ary *partialArray, options *ApplyOptions) *partialArray { return ary } -var errBadJSONDoc = fmt.Errorf("Invalid JSON Document") -var errBadJSONPatch = fmt.Errorf("Invalid JSON Patch") +var ErrBadJSONDoc = fmt.Errorf("Invalid JSON Document") +var ErrBadJSONPatch = fmt.Errorf("Invalid JSON Patch") var errBadMergeTypes = fmt.Errorf("Mismatched JSON Documents") // MergeMergePatches merges two merge patches together, such that @@ -121,11 +121,11 @@ func MergePatch(docData, patchData []byte) ([]byte, error) { func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { if !json.Valid(docData) { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } if !json.Valid(patchData) { - return nil, errBadJSONPatch + return nil, ErrBadJSONPatch } options := NewApplyOptions() @@ -143,7 +143,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { patchErr := patch.UnmarshalJSON(patchData) if isSyntaxError(docErr) { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } if isSyntaxError(patchErr) { @@ -151,7 +151,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { } if docErr == nil && doc.obj == nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } if patchErr == nil && patch.obj == nil { @@ -175,7 +175,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { if json.Valid(patchData) { return patchData, nil } - return nil, errBadJSONPatch + return nil, ErrBadJSONPatch } pruneAryNulls(patchAry, options) @@ -183,7 +183,7 @@ func doMergePatch(docData, patchData []byte, mergeMerge bool) ([]byte, error) { out, patchErr := json.Marshal(patchAry.nodes) if patchErr != nil { - return nil, errBadJSONPatch + return nil, ErrBadJSONPatch } return out, nil @@ -256,12 +256,12 @@ func createObjectMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { err := unmarshal(originalJSON, &originalDoc) if err != nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } err = unmarshal(modifiedJSON, &modifiedDoc) if err != nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } dest, err := getDiff(originalDoc, modifiedDoc) @@ -286,17 +286,17 @@ func createArrayMergePatch(originalJSON, modifiedJSON []byte) ([]byte, error) { err := unmarshal(originalJSON, &originalDocs) if err != nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } err = unmarshal(modifiedJSON, &modifiedDocs) if err != nil { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } total := len(originalDocs) if len(modifiedDocs) != total { - return nil, errBadJSONDoc + return nil, ErrBadJSONDoc } result := []json.RawMessage{} diff --git a/vendor/github.com/evanphx/json-patch/v5/patch.go b/vendor/github.com/evanphx/json-patch/v5/patch.go index 7a7f71c8b..83102e557 100644 --- a/vendor/github.com/evanphx/json-patch/v5/patch.go +++ b/vendor/github.com/evanphx/json-patch/v5/patch.go @@ -2,13 +2,13 @@ package jsonpatch import ( "bytes" + "errors" "fmt" "strconv" "strings" "unicode" "github.com/evanphx/json-patch/v5/internal/json" - "github.com/pkg/errors" ) const ( @@ -461,7 +461,7 @@ func (o Operation) Path() (string, error) { return op, nil } - return "unknown", errors.Wrapf(ErrMissing, "operation missing path field") + return "unknown", fmt.Errorf("operation missing path field: %w", ErrMissing) } // From reads the "from" field of the Operation. @@ -478,7 +478,7 @@ func (o Operation) From() (string, error) { return op, nil } - return "unknown", errors.Wrapf(ErrMissing, "operation, missing from field") + return "unknown", fmt.Errorf("operation, missing from field: %w", ErrMissing) } func (o Operation) value() *lazyNode { @@ -511,7 +511,7 @@ func (o Operation) ValueInterface() (interface{}, error) { return v, nil } - return nil, errors.Wrapf(ErrMissing, "operation, missing value field") + return nil, fmt.Errorf("operation, missing value field: %w", ErrMissing) } func isArray(buf []byte) bool { @@ -610,7 +610,7 @@ func (d *partialDoc) get(key string, options *ApplyOptions) (*lazyNode, error) { v, ok := d.obj[key] if !ok { - return v, errors.Wrapf(ErrMissing, "unable to get nonexistent key: %s", key) + return v, fmt.Errorf("unable to get nonexistent key: %s: %w", key, ErrMissing) } return v, nil } @@ -625,7 +625,7 @@ func (d *partialDoc) remove(key string, options *ApplyOptions) error { if options.AllowMissingPathOnRemove { return nil } - return errors.Wrapf(ErrMissing, "unable to remove nonexistent key: %s", key) + return fmt.Errorf("unable to remove nonexistent key: %s: %w", key, ErrMissing) } idx := -1 for i, k := range d.keys { @@ -649,10 +649,10 @@ func (d *partialArray) set(key string, val *lazyNode, options *ApplyOptions) err if idx < 0 { if !options.SupportNegativeIndices { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } if idx < -len(d.nodes) { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } idx += len(d.nodes) } @@ -669,7 +669,7 @@ func (d *partialArray) add(key string, val *lazyNode, options *ApplyOptions) err idx, err := strconv.Atoi(key) if err != nil { - return errors.Wrapf(err, "value was not a proper array index: '%s'", key) + return fmt.Errorf("value was not a proper array index: '%s': %w", key, err) } sz := len(d.nodes) + 1 @@ -679,15 +679,15 @@ func (d *partialArray) add(key string, val *lazyNode, options *ApplyOptions) err cur := d if idx >= len(ary) { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } if idx < 0 { if !options.SupportNegativeIndices { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } if idx < -len(ary) { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } idx += len(ary) } @@ -713,16 +713,16 @@ func (d *partialArray) get(key string, options *ApplyOptions) (*lazyNode, error) if idx < 0 { if !options.SupportNegativeIndices { - return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return nil, fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } if idx < -len(d.nodes) { - return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return nil, fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } idx += len(d.nodes) } if idx >= len(d.nodes) { - return nil, errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return nil, fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } return d.nodes[idx], nil @@ -740,18 +740,18 @@ func (d *partialArray) remove(key string, options *ApplyOptions) error { if options.AllowMissingPathOnRemove { return nil } - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } if idx < 0 { if !options.SupportNegativeIndices { - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } if idx < -len(cur.nodes) { if options.AllowMissingPathOnRemove { return nil } - return errors.Wrapf(ErrInvalidIndex, "Unable to access invalid index: %d", idx) + return fmt.Errorf("Unable to access invalid index: %d: %w", idx, ErrInvalidIndex) } idx += len(cur.nodes) } @@ -768,7 +768,7 @@ func (d *partialArray) remove(key string, options *ApplyOptions) error { func (p Patch) add(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() if err != nil { - return errors.Wrapf(ErrMissing, "add operation failed to decode path") + return fmt.Errorf("add operation failed to decode path: %w", ErrMissing) } // special case, adding to empty means replacing the container with the value given @@ -809,12 +809,12 @@ func (p Patch) add(doc *container, op Operation, options *ApplyOptions) error { con, key := findObject(doc, path, options) if con == nil { - return errors.Wrapf(ErrMissing, "add operation does not apply: doc is missing path: \"%s\"", path) + return fmt.Errorf("add operation does not apply: doc is missing path: \"%s\": %w", path, ErrMissing) } err = con.add(key, op.value(), options) if err != nil { - return errors.Wrapf(err, "error in add for path: '%s'", path) + return fmt.Errorf("error in add for path: '%s': %w", path, err) } return nil @@ -867,11 +867,11 @@ func ensurePathExists(pd *container, path string, options *ApplyOptions) error { if arrIndex < 0 { if !options.SupportNegativeIndices { - return errors.Wrapf(ErrInvalidIndex, "Unable to ensure path for invalid index: %d", arrIndex) + return fmt.Errorf("Unable to ensure path for invalid index: %d: %w", arrIndex, ErrInvalidIndex) } if arrIndex < -1 { - return errors.Wrapf(ErrInvalidIndex, "Unable to ensure path for negative index other than -1: %d", arrIndex) + return fmt.Errorf("Unable to ensure path for negative index other than -1: %d: %w", arrIndex, ErrInvalidIndex) } arrIndex = 0 @@ -918,11 +918,11 @@ func validateOperation(op Operation) error { switch op.Kind() { case "add", "replace": if _, err := op.ValueInterface(); err != nil { - return errors.Wrapf(err, "failed to decode 'value'") + return fmt.Errorf("failed to decode 'value': %w", err) } case "move", "copy": if _, err := op.From(); err != nil { - return errors.Wrapf(err, "failed to decode 'from'") + return fmt.Errorf("failed to decode 'from': %w", err) } case "remove", "test": default: @@ -930,7 +930,7 @@ func validateOperation(op Operation) error { } if _, err := op.Path(); err != nil { - return errors.Wrapf(err, "failed to decode 'path'") + return fmt.Errorf("failed to decode 'path': %w", err) } return nil @@ -941,10 +941,10 @@ func validatePatch(p Patch) error { if err := validateOperation(op); err != nil { opData, infoErr := json.Marshal(op) if infoErr != nil { - return errors.Wrapf(err, "invalid operation") + return fmt.Errorf("invalid operation: %w", err) } - return errors.Wrapf(err, "invalid operation %s", opData) + return fmt.Errorf("invalid operation %s: %w", opData, err) } } @@ -954,7 +954,7 @@ func validatePatch(p Patch) error { func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() if err != nil { - return errors.Wrapf(ErrMissing, "remove operation failed to decode path") + return fmt.Errorf("remove operation failed to decode path: %w", ErrMissing) } con, key := findObject(doc, path, options) @@ -963,12 +963,12 @@ func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error if options.AllowMissingPathOnRemove { return nil } - return errors.Wrapf(ErrMissing, "remove operation does not apply: doc is missing path: \"%s\"", path) + return fmt.Errorf("remove operation does not apply: doc is missing path: \"%s\": %w", path, ErrMissing) } err = con.remove(key, options) if err != nil { - return errors.Wrapf(err, "error in remove for path: '%s'", path) + return fmt.Errorf("error in remove for path: '%s': %w", path, err) } return nil @@ -977,7 +977,7 @@ func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() if err != nil { - return errors.Wrapf(err, "replace operation failed to decode path") + return fmt.Errorf("replace operation failed to decode path: %w", err) } if path == "" { @@ -986,7 +986,7 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro if val.which == eRaw { if !val.tryDoc() { if !val.tryAry() { - return errors.Wrapf(err, "replace operation value must be object or array") + return fmt.Errorf("replace operation value must be object or array: %w", err) } } else { val.doc.opts = options @@ -999,7 +999,7 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro case eDoc: *doc = val.doc case eRaw: - return errors.Wrapf(err, "replace operation hit impossible case") + return fmt.Errorf("replace operation hit impossible case: %w", err) } return nil @@ -1008,17 +1008,17 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro con, key := findObject(doc, path, options) if con == nil { - return errors.Wrapf(ErrMissing, "replace operation does not apply: doc is missing path: %s", path) + return fmt.Errorf("replace operation does not apply: doc is missing path: %s: %w", path, ErrMissing) } _, ok := con.get(key, options) if ok != nil { - return errors.Wrapf(ErrMissing, "replace operation does not apply: doc is missing key: %s", path) + return fmt.Errorf("replace operation does not apply: doc is missing key: %s: %w", path, ErrMissing) } err = con.set(key, op.value(), options) if err != nil { - return errors.Wrapf(err, "error in remove for path: '%s'", path) + return fmt.Errorf("error in remove for path: '%s': %w", path, err) } return nil @@ -1027,43 +1027,43 @@ func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) erro func (p Patch) move(doc *container, op Operation, options *ApplyOptions) error { from, err := op.From() if err != nil { - return errors.Wrapf(err, "move operation failed to decode from") + return fmt.Errorf("move operation failed to decode from: %w", err) } if from == "" { - return errors.Wrapf(ErrInvalid, "unable to move entire document to another path") + return fmt.Errorf("unable to move entire document to another path: %w", ErrInvalid) } con, key := findObject(doc, from, options) if con == nil { - return errors.Wrapf(ErrMissing, "move operation does not apply: doc is missing from path: %s", from) + return fmt.Errorf("move operation does not apply: doc is missing from path: %s: %w", from, ErrMissing) } val, err := con.get(key, options) if err != nil { - return errors.Wrapf(err, "error in move for path: '%s'", key) + return fmt.Errorf("error in move for path: '%s': %w", key, err) } err = con.remove(key, options) if err != nil { - return errors.Wrapf(err, "error in move for path: '%s'", key) + return fmt.Errorf("error in move for path: '%s': %w", key, err) } path, err := op.Path() if err != nil { - return errors.Wrapf(err, "move operation failed to decode path") + return fmt.Errorf("move operation failed to decode path: %w", err) } con, key = findObject(doc, path, options) if con == nil { - return errors.Wrapf(ErrMissing, "move operation does not apply: doc is missing destination path: %s", path) + return fmt.Errorf("move operation does not apply: doc is missing destination path: %s: %w", path, ErrMissing) } err = con.add(key, val, options) if err != nil { - return errors.Wrapf(err, "error in move for path: '%s'", path) + return fmt.Errorf("error in move for path: '%s': %w", path, err) } return nil @@ -1072,7 +1072,7 @@ func (p Patch) move(doc *container, op Operation, options *ApplyOptions) error { func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() if err != nil { - return errors.Wrapf(err, "test operation failed to decode path") + return fmt.Errorf("test operation failed to decode path: %w", err) } if path == "" { @@ -1091,18 +1091,18 @@ func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error { return nil } - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed) } con, key := findObject(doc, path, options) if con == nil { - return errors.Wrapf(ErrMissing, "test operation does not apply: is missing path: %s", path) + return fmt.Errorf("test operation does not apply: is missing path: %s: %w", path, ErrMissing) } val, err := con.get(key, options) - if err != nil && errors.Cause(err) != ErrMissing { - return errors.Wrapf(err, "error in test for path: '%s'", path) + if err != nil && errors.Unwrap(err) != ErrMissing { + return fmt.Errorf("error in test for path: '%s': %w", path, err) } ov := op.value() @@ -1111,49 +1111,49 @@ func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error { if ov.isNull() { return nil } - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed) } else if ov.isNull() { - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed) } if val.equal(op.value()) { return nil } - return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + return fmt.Errorf("testing value %s failed: %w", path, ErrTestFailed) } func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, options *ApplyOptions) error { from, err := op.From() if err != nil { - return errors.Wrapf(err, "copy operation failed to decode from") + return fmt.Errorf("copy operation failed to decode from: %w", err) } con, key := findObject(doc, from, options) if con == nil { - return errors.Wrapf(ErrMissing, "copy operation does not apply: doc is missing from path: \"%s\"", from) + return fmt.Errorf("copy operation does not apply: doc is missing from path: \"%s\": %w", from, ErrMissing) } val, err := con.get(key, options) if err != nil { - return errors.Wrapf(err, "error in copy for from: '%s'", from) + return fmt.Errorf("error in copy for from: '%s': %w", from, err) } path, err := op.Path() if err != nil { - return errors.Wrapf(ErrMissing, "copy operation failed to decode path") + return fmt.Errorf("copy operation failed to decode path: %w", ErrMissing) } con, key = findObject(doc, path, options) if con == nil { - return errors.Wrapf(ErrMissing, "copy operation does not apply: doc is missing destination path: %s", path) + return fmt.Errorf("copy operation does not apply: doc is missing destination path: %s: %w", path, ErrMissing) } valCopy, sz, err := deepCopy(val, options) if err != nil { - return errors.Wrapf(err, "error while performing deep copy") + return fmt.Errorf("error while performing deep copy: %w", err) } (*accumulatedCopySize) += int64(sz) @@ -1163,7 +1163,7 @@ func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, op err = con.add(key, valCopy, options) if err != nil { - return errors.Wrapf(err, "error while adding value during copy") + return fmt.Errorf("error while adding value during copy: %w", err) } return nil diff --git a/vendor/github.com/redhat-best-practices-for-k8s/certsuite-claim/pkg/claim/schema.go b/vendor/github.com/redhat-best-practices-for-k8s/certsuite-claim/pkg/claim/schema.go index ad58daf96..385e544d9 100644 --- a/vendor/github.com/redhat-best-practices-for-k8s/certsuite-claim/pkg/claim/schema.go +++ b/vendor/github.com/redhat-best-practices-for-k8s/certsuite-claim/pkg/claim/schema.go @@ -11,9 +11,9 @@ // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // -// Code generated by `certsuite-claim/cmd/generate/generate.go` on: 2024-08-29 15:09:39.128084 +0200 CEST m=+0.001916043 +// Code generated by `certsuite-claim/cmd/generate/generate.go` on: 2025-02-14 12:23:20.245094 -0600 CST m=+0.003629959 // -// `https://github.com/a-h/generate` provides a generic set of interfaces to convert JSON schema into +// `https://github.com/sebrandon1/generate` provides a generic set of interfaces to convert JSON schema into // workable GoLang struct implementations. However, the code generator is limited and does not allow // type remapping. By default, JSON Schema "object" types are remapped to custom struct definitions. // This becomes a problem in our case, as we do not define certain facets such as "Hosts" or @@ -28,203 +28,203 @@ package claim import ( - "bytes" - "encoding/json" - "errors" - "fmt" + "fmt" + "errors" + "bytes" + "encoding/json" ) // CatalogInfo test specific information from the catalog type CatalogInfo struct { - // Link to the best practice document supporting this test case - BestPracticeReference string `json:"bestPracticeReference"` + // Link to the best practice document supporting this test case + BestPracticeReference string `json:"bestPracticeReference"` - // The test description. - Description string `json:"description"` + // The test description. + Description string `json:"description"` - // Indicates the exception process if defined - ExceptionProcess string `json:"exceptionProcess"` + // Indicates the exception process if defined + ExceptionProcess string `json:"exceptionProcess"` - // steps required to fix a failing test case - Remediation string `json:"remediation"` + // steps required to fix a failing test case + Remediation string `json:"remediation"` } // CategoryClassification categoryClassification is the classification for a single test case. type CategoryClassification struct { - // indicates whether this test case is mandatory or optional in the Extended scenario - Extended string `json:"Extended,omitempty"` + // indicates whether this test case is mandatory or optional in the Extended scenario + Extended string `json:"Extended,omitempty"` - // indicates whether this test case is mandatory or optional in the FarEdge scenario - FarEdge string `json:"FarEdge,omitempty"` + // indicates whether this test case is mandatory or optional in the FarEdge scenario + FarEdge string `json:"FarEdge,omitempty"` - // indicates whether this test case is mandatory or optional in the NonTelco scenario - NonTelco string `json:"NonTelco,omitempty"` + // indicates whether this test case is mandatory or optional in the NonTelco scenario + NonTelco string `json:"NonTelco,omitempty"` - // indicates whether this test case is mandatory or optional in the Telco scenario - Telco string `json:"Telco,omitempty"` + // indicates whether this test case is mandatory or optional in the Telco scenario + Telco string `json:"Telco,omitempty"` } -// Claim +// Claim type Claim struct { - // Tests within redhat-best-practices-for-k8s often require configuration. For example, the generic test suite requires listing all CNF containers. This information is used to derive per-container IP address information, which is then used as input to the connectivity test suite. Test suites within redhat-best-practices-for-k8s may use multiple configurations, but each with a unique name. - Configurations map[string]interface{} `json:"configurations"` - Metadata *Metadata `json:"metadata"` + // Tests within redhat-best-practices-for-k8s often require configuration. For example, the generic test suite requires listing all CNF containers. This information is used to derive per-container IP address information, which is then used as input to the connectivity test suite. Test suites within redhat-best-practices-for-k8s may use multiple configurations, but each with a unique name. + Configurations map[string]interface{} `json:"configurations"` + Metadata *Metadata `json:"metadata"` - // An OpenShift cluster is composed of an arbitrary number of Nodes used for platform and application services. Since a claim must be reproducible, a variety of per-Node information must be collected and stored in the claim. Node names are unique within a given OpenShift cluster. - Nodes map[string]interface{} `json:"nodes"` + // An OpenShift cluster is composed of an arbitrary number of Nodes used for platform and application services. Since a claim must be reproducible, a variety of per-Node information must be collected and stored in the claim. Node names are unique within a given OpenShift cluster. + Nodes map[string]interface{} `json:"nodes"` - // The results for each unique test case. - Results map[string]Result `json:"results,omitempty"` - Versions *Versions `json:"versions"` + // The results for each unique test case. + Results map[string]Result `json:"results,omitempty"` + Versions *Versions `json:"versions"` } // Identifier identifier is a per testcase unique identifier. type Identifier struct { - // id stores a unique id for the testcase. - Id string `json:"id"` + // id stores a unique id for the testcase. + Id string `json:"id"` - // suite stores the test suite name for the testcase. - Suite string `json:"suite"` + // suite stores the test suite name for the testcase. + Suite string `json:"suite"` - // tags stores the different tags applied to a test. - Tags string `json:"tags,omitempty"` + // tags stores the different tags applied to a test. + Tags string `json:"tags,omitempty"` } -// Metadata +// Metadata type Metadata struct { - // The UTC end time of a claim evaluation. This is recorded when the redhat-best-practices-for-k8s test suite completes. - EndTime string `json:"endTime"` + // The UTC end time of a claim evaluation. This is recorded when the redhat-best-practices-for-k8s test suite completes. + EndTime string `json:"endTime"` - // The UTC start time of a claim evaluation. This is recorded when the redhat-best-practices-for-k8s test suite is invoked. - StartTime string `json:"startTime"` + // The UTC start time of a claim evaluation. This is recorded when the redhat-best-practices-for-k8s test suite is invoked. + StartTime string `json:"startTime"` } // Result result is the result of running a testcase. type Result struct { - // Ginkgo writer output during the test run. - CapturedTestOutput string `json:"capturedTestOutput"` + // Ginkgo writer output during the test run. + CapturedTestOutput string `json:"capturedTestOutput"` - // Test detailed information from catalog - CatalogInfo *CatalogInfo `json:"catalogInfo"` + // Test detailed information from catalog + CatalogInfo *CatalogInfo `json:"catalogInfo"` - // Category classification for the test - CategoryClassification *CategoryClassification `json:"categoryClassification"` + // Category classification for the test + CategoryClassification *CategoryClassification `json:"categoryClassification"` - // Described the reasons for passing or failing a test - CheckDetails string `json:"checkDetails"` + // Described the reasons for passing or failing a test + CheckDetails string `json:"checkDetails"` - // The duration of the test in nanoseconds. - Duration int `json:"duration"` + // The duration of the test in nanoseconds. + Duration int `json:"duration"` - // The end time of the test. - EndTime string `json:"endTime,omitempty"` + // The end time of the test. + EndTime string `json:"endTime,omitempty"` - // The content of the line where the failure happened - FailureLineContent string `json:"failureLineContent"` + // The content of the line where the failure happened + FailureLineContent string `json:"failureLineContent"` - // The Filename and line number where the failure happened - FailureLocation string `json:"failureLocation"` + // The Filename and line number where the failure happened + FailureLocation string `json:"failureLocation"` - // Describes the reasons for not running a test (skipped, aborted, panicked, interrupted) - SkipReason string `json:"skipReason"` + // Describes the reasons for not running a test (skipped, aborted, panicked, interrupted) + SkipReason string `json:"skipReason"` - // The start time of the test. - StartTime string `json:"startTime"` + // The start time of the test. + StartTime string `json:"startTime"` - // The test result state: INVALID SPEC STATE, pending,skipped,passed,failed,aborted,panicked,interrupted - State string `json:"state"` + // The test result state: INVALID SPEC STATE, pending,skipped,passed,failed,aborted,panicked,interrupted + State string `json:"state"` - // The test identifier - TestID *Identifier `json:"testID"` + // The test identifier + TestID *Identifier `json:"testID"` } // Root A redhat-best-practices-for-k8s claim is an attestation of the tests performed, the results and the various configurations. Since a claim must be reproducible, it also includes an overview of the systems under test and their physical configurations. type Root struct { - Claim *Claim `json:"claim"` + Claim *Claim `json:"claim"` } -// Versions +// Versions type Versions struct { - // The redhat-best-practices-for-k8s (certSuite) release version. - CertSuite string `json:"certSuite"` + // The redhat-best-practices-for-k8s (certSuite) release version. + CertSuite string `json:"certSuite"` - // The redhat-best-practices-for-k8s (certSuite) Git Commit. - CertSuiteGitCommit string `json:"certSuiteGitCommit,omitempty"` + // The redhat-best-practices-for-k8s (certSuite) Git Commit. + CertSuiteGitCommit string `json:"certSuiteGitCommit,omitempty"` - // The claim file format version. - ClaimFormat string `json:"claimFormat"` + // The claim file format version. + ClaimFormat string `json:"claimFormat"` - // The Kubernetes release version. - K8s string `json:"k8s,omitempty"` + // The Kubernetes release version. + K8s string `json:"k8s,omitempty"` - // The oc client release version. - OcClient string `json:"ocClient,omitempty"` + // The oc client release version. + OcClient string `json:"ocClient,omitempty"` - // OCP cluster release version. - Ocp string `json:"ocp,omitempty"` + // OCP cluster release version. + Ocp string `json:"ocp,omitempty"` } func (strct *CatalogInfo) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") - comma := false - // "BestPracticeReference" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "bestPracticeReference" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"bestPracticeReference\": ") + comma := false + // "BestPracticeReference" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "bestPracticeReference" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"bestPracticeReference\": ") if tmp, err := json.Marshal(strct.BestPracticeReference); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "Description" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "description" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"description\": ") + // "Description" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "description" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"description\": ") if tmp, err := json.Marshal(strct.Description); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "ExceptionProcess" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "exceptionProcess" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"exceptionProcess\": ") + // "ExceptionProcess" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "exceptionProcess" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"exceptionProcess\": ") if tmp, err := json.Marshal(strct.ExceptionProcess); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "Remediation" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "remediation" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"remediation\": ") + // "Remediation" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "remediation" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"remediation\": ") if tmp, err := json.Marshal(strct.Remediation); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true @@ -234,106 +234,106 @@ func (strct *CatalogInfo) MarshalJSON() ([]byte, error) { } func (strct *CatalogInfo) UnmarshalJSON(b []byte) error { - bestPracticeReferenceReceived := false - descriptionReceived := false - exceptionProcessReceived := false - remediationReceived := false - var jsonMap map[string]json.RawMessage - if err := json.Unmarshal(b, &jsonMap); err != nil { - return err - } - // parse all the defined properties - for k, v := range jsonMap { - switch k { - case "bestPracticeReference": - if err := json.Unmarshal([]byte(v), &strct.BestPracticeReference); err != nil { - return err - } - bestPracticeReferenceReceived = true - case "description": - if err := json.Unmarshal([]byte(v), &strct.Description); err != nil { - return err - } - descriptionReceived = true - case "exceptionProcess": - if err := json.Unmarshal([]byte(v), &strct.ExceptionProcess); err != nil { - return err - } - exceptionProcessReceived = true - case "remediation": - if err := json.Unmarshal([]byte(v), &strct.Remediation); err != nil { - return err - } - remediationReceived = true - default: - return fmt.Errorf("additional property not allowed: \"" + k + "\"") - } - } - // check if bestPracticeReference (a required property) was received - if !bestPracticeReferenceReceived { - return errors.New("\"bestPracticeReference\" is required but was not present") - } - // check if description (a required property) was received - if !descriptionReceived { - return errors.New("\"description\" is required but was not present") - } - // check if exceptionProcess (a required property) was received - if !exceptionProcessReceived { - return errors.New("\"exceptionProcess\" is required but was not present") - } - // check if remediation (a required property) was received - if !remediationReceived { - return errors.New("\"remediation\" is required but was not present") - } - return nil + bestPracticeReferenceReceived := false + descriptionReceived := false + exceptionProcessReceived := false + remediationReceived := false + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "bestPracticeReference": + if err := json.Unmarshal([]byte(v), &strct.BestPracticeReference); err != nil { + return err + } + bestPracticeReferenceReceived = true + case "description": + if err := json.Unmarshal([]byte(v), &strct.Description); err != nil { + return err + } + descriptionReceived = true + case "exceptionProcess": + if err := json.Unmarshal([]byte(v), &strct.ExceptionProcess); err != nil { + return err + } + exceptionProcessReceived = true + case "remediation": + if err := json.Unmarshal([]byte(v), &strct.Remediation); err != nil { + return err + } + remediationReceived = true + default: + return fmt.Errorf("additional property not allowed: \"%s\"", k) + } + } + // check if bestPracticeReference (a required property) was received + if !bestPracticeReferenceReceived { + return errors.New("\"bestPracticeReference\" is required but was not present") + } + // check if description (a required property) was received + if !descriptionReceived { + return errors.New("\"description\" is required but was not present") + } + // check if exceptionProcess (a required property) was received + if !exceptionProcessReceived { + return errors.New("\"exceptionProcess\" is required but was not present") + } + // check if remediation (a required property) was received + if !remediationReceived { + return errors.New("\"remediation\" is required but was not present") + } + return nil } func (strct *CategoryClassification) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") - comma := false - // Marshal the "Extended" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"Extended\": ") + comma := false + // Marshal the "Extended" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"Extended\": ") if tmp, err := json.Marshal(strct.Extended); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "FarEdge" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"FarEdge\": ") + // Marshal the "FarEdge" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"FarEdge\": ") if tmp, err := json.Marshal(strct.FarEdge); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "NonTelco" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"NonTelco\": ") + // Marshal the "NonTelco" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"NonTelco\": ") if tmp, err := json.Marshal(strct.NonTelco); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "Telco" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"Telco\": ") + // Marshal the "Telco" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"Telco\": ") if tmp, err := json.Marshal(strct.Telco); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true @@ -343,105 +343,105 @@ func (strct *CategoryClassification) MarshalJSON() ([]byte, error) { } func (strct *CategoryClassification) UnmarshalJSON(b []byte) error { - var jsonMap map[string]json.RawMessage - if err := json.Unmarshal(b, &jsonMap); err != nil { - return err - } - // parse all the defined properties - for k, v := range jsonMap { - switch k { - case "Extended": - if err := json.Unmarshal([]byte(v), &strct.Extended); err != nil { - return err - } - case "FarEdge": - if err := json.Unmarshal([]byte(v), &strct.FarEdge); err != nil { - return err - } - case "NonTelco": - if err := json.Unmarshal([]byte(v), &strct.NonTelco); err != nil { - return err - } - case "Telco": - if err := json.Unmarshal([]byte(v), &strct.Telco); err != nil { - return err - } - default: - return fmt.Errorf("additional property not allowed: \"" + k + "\"") - } - } - return nil + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "Extended": + if err := json.Unmarshal([]byte(v), &strct.Extended); err != nil { + return err + } + case "FarEdge": + if err := json.Unmarshal([]byte(v), &strct.FarEdge); err != nil { + return err + } + case "NonTelco": + if err := json.Unmarshal([]byte(v), &strct.NonTelco); err != nil { + return err + } + case "Telco": + if err := json.Unmarshal([]byte(v), &strct.Telco); err != nil { + return err + } + default: + return fmt.Errorf("additional property not allowed: \"%s\"", k) + } + } + return nil } func (strct *Claim) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") - comma := false - // "Configurations" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "configurations" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"configurations\": ") + comma := false + // "Configurations" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "configurations" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"configurations\": ") if tmp, err := json.Marshal(strct.Configurations); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "Metadata" field is required - if strct.Metadata == nil { - return nil, errors.New("metadata is a required field") - } - // Marshal the "metadata" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"metadata\": ") + // "Metadata" field is required + if strct.Metadata == nil { + return nil, errors.New("metadata is a required field") + } + // Marshal the "metadata" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"metadata\": ") if tmp, err := json.Marshal(strct.Metadata); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "Nodes" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "nodes" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"nodes\": ") + // "Nodes" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "nodes" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"nodes\": ") if tmp, err := json.Marshal(strct.Nodes); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "results" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"results\": ") + // Marshal the "results" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"results\": ") if tmp, err := json.Marshal(strct.Results); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "Versions" field is required - if strct.Versions == nil { - return nil, errors.New("versions is a required field") - } - // Marshal the "versions" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"versions\": ") + // "Versions" field is required + if strct.Versions == nil { + return nil, errors.New("versions is a required field") + } + // Marshal the "versions" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"versions\": ") if tmp, err := json.Marshal(strct.Versions); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true @@ -451,103 +451,103 @@ func (strct *Claim) MarshalJSON() ([]byte, error) { } func (strct *Claim) UnmarshalJSON(b []byte) error { - configurationsReceived := false - metadataReceived := false - nodesReceived := false - versionsReceived := false - var jsonMap map[string]json.RawMessage - if err := json.Unmarshal(b, &jsonMap); err != nil { - return err - } - // parse all the defined properties - for k, v := range jsonMap { - switch k { - case "configurations": - if err := json.Unmarshal([]byte(v), &strct.Configurations); err != nil { - return err - } - configurationsReceived = true - case "metadata": - if err := json.Unmarshal([]byte(v), &strct.Metadata); err != nil { - return err - } - metadataReceived = true - case "nodes": - if err := json.Unmarshal([]byte(v), &strct.Nodes); err != nil { - return err - } - nodesReceived = true - case "results": - if err := json.Unmarshal([]byte(v), &strct.Results); err != nil { - return err - } - case "versions": - if err := json.Unmarshal([]byte(v), &strct.Versions); err != nil { - return err - } - versionsReceived = true - default: - return fmt.Errorf("additional property not allowed: \"" + k + "\"") - } - } - // check if configurations (a required property) was received - if !configurationsReceived { - return errors.New("\"configurations\" is required but was not present") - } - // check if metadata (a required property) was received - if !metadataReceived { - return errors.New("\"metadata\" is required but was not present") - } - // check if nodes (a required property) was received - if !nodesReceived { - return errors.New("\"nodes\" is required but was not present") - } - // check if versions (a required property) was received - if !versionsReceived { - return errors.New("\"versions\" is required but was not present") - } - return nil + configurationsReceived := false + metadataReceived := false + nodesReceived := false + versionsReceived := false + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "configurations": + if err := json.Unmarshal([]byte(v), &strct.Configurations); err != nil { + return err + } + configurationsReceived = true + case "metadata": + if err := json.Unmarshal([]byte(v), &strct.Metadata); err != nil { + return err + } + metadataReceived = true + case "nodes": + if err := json.Unmarshal([]byte(v), &strct.Nodes); err != nil { + return err + } + nodesReceived = true + case "results": + if err := json.Unmarshal([]byte(v), &strct.Results); err != nil { + return err + } + case "versions": + if err := json.Unmarshal([]byte(v), &strct.Versions); err != nil { + return err + } + versionsReceived = true + default: + return fmt.Errorf("additional property not allowed: \"%s\"", k) + } + } + // check if configurations (a required property) was received + if !configurationsReceived { + return errors.New("\"configurations\" is required but was not present") + } + // check if metadata (a required property) was received + if !metadataReceived { + return errors.New("\"metadata\" is required but was not present") + } + // check if nodes (a required property) was received + if !nodesReceived { + return errors.New("\"nodes\" is required but was not present") + } + // check if versions (a required property) was received + if !versionsReceived { + return errors.New("\"versions\" is required but was not present") + } + return nil } func (strct *Identifier) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") - comma := false - // "Id" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "id" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"id\": ") + comma := false + // "Id" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "id" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"id\": ") if tmp, err := json.Marshal(strct.Id); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "Suite" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "suite" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"suite\": ") + // "Suite" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "suite" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"suite\": ") if tmp, err := json.Marshal(strct.Suite); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "tags" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"tags\": ") + // Marshal the "tags" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"tags\": ") if tmp, err := json.Marshal(strct.Tags); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true @@ -557,72 +557,72 @@ func (strct *Identifier) MarshalJSON() ([]byte, error) { } func (strct *Identifier) UnmarshalJSON(b []byte) error { - idReceived := false - suiteReceived := false - var jsonMap map[string]json.RawMessage - if err := json.Unmarshal(b, &jsonMap); err != nil { - return err - } - // parse all the defined properties - for k, v := range jsonMap { - switch k { - case "id": - if err := json.Unmarshal([]byte(v), &strct.Id); err != nil { - return err - } - idReceived = true - case "suite": - if err := json.Unmarshal([]byte(v), &strct.Suite); err != nil { - return err - } - suiteReceived = true - case "tags": - if err := json.Unmarshal([]byte(v), &strct.Tags); err != nil { - return err - } - default: - return fmt.Errorf("additional property not allowed: \"" + k + "\"") - } - } - // check if id (a required property) was received - if !idReceived { - return errors.New("\"id\" is required but was not present") - } - // check if suite (a required property) was received - if !suiteReceived { - return errors.New("\"suite\" is required but was not present") - } - return nil + idReceived := false + suiteReceived := false + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "id": + if err := json.Unmarshal([]byte(v), &strct.Id); err != nil { + return err + } + idReceived = true + case "suite": + if err := json.Unmarshal([]byte(v), &strct.Suite); err != nil { + return err + } + suiteReceived = true + case "tags": + if err := json.Unmarshal([]byte(v), &strct.Tags); err != nil { + return err + } + default: + return fmt.Errorf("additional property not allowed: \"%s\"", k) + } + } + // check if id (a required property) was received + if !idReceived { + return errors.New("\"id\" is required but was not present") + } + // check if suite (a required property) was received + if !suiteReceived { + return errors.New("\"suite\" is required but was not present") + } + return nil } func (strct *Metadata) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") - comma := false - // "EndTime" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "endTime" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"endTime\": ") + comma := false + // "EndTime" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "endTime" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"endTime\": ") if tmp, err := json.Marshal(strct.EndTime); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "StartTime" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "startTime" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"startTime\": ") + // "StartTime" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "startTime" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"startTime\": ") if tmp, err := json.Marshal(strct.StartTime); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true @@ -632,202 +632,202 @@ func (strct *Metadata) MarshalJSON() ([]byte, error) { } func (strct *Metadata) UnmarshalJSON(b []byte) error { - endTimeReceived := false - startTimeReceived := false - var jsonMap map[string]json.RawMessage - if err := json.Unmarshal(b, &jsonMap); err != nil { - return err - } - // parse all the defined properties - for k, v := range jsonMap { - switch k { - case "endTime": - if err := json.Unmarshal([]byte(v), &strct.EndTime); err != nil { - return err - } - endTimeReceived = true - case "startTime": - if err := json.Unmarshal([]byte(v), &strct.StartTime); err != nil { - return err - } - startTimeReceived = true - default: - return fmt.Errorf("additional property not allowed: \"" + k + "\"") - } - } - // check if endTime (a required property) was received - if !endTimeReceived { - return errors.New("\"endTime\" is required but was not present") - } - // check if startTime (a required property) was received - if !startTimeReceived { - return errors.New("\"startTime\" is required but was not present") - } - return nil + endTimeReceived := false + startTimeReceived := false + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "endTime": + if err := json.Unmarshal([]byte(v), &strct.EndTime); err != nil { + return err + } + endTimeReceived = true + case "startTime": + if err := json.Unmarshal([]byte(v), &strct.StartTime); err != nil { + return err + } + startTimeReceived = true + default: + return fmt.Errorf("additional property not allowed: \"%s\"", k) + } + } + // check if endTime (a required property) was received + if !endTimeReceived { + return errors.New("\"endTime\" is required but was not present") + } + // check if startTime (a required property) was received + if !startTimeReceived { + return errors.New("\"startTime\" is required but was not present") + } + return nil } func (strct *Result) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") - comma := false - // "CapturedTestOutput" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "capturedTestOutput" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"capturedTestOutput\": ") + comma := false + // "CapturedTestOutput" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "capturedTestOutput" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"capturedTestOutput\": ") if tmp, err := json.Marshal(strct.CapturedTestOutput); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "CatalogInfo" field is required - if strct.CatalogInfo == nil { - return nil, errors.New("catalogInfo is a required field") - } - // Marshal the "catalogInfo" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"catalogInfo\": ") + // "CatalogInfo" field is required + if strct.CatalogInfo == nil { + return nil, errors.New("catalogInfo is a required field") + } + // Marshal the "catalogInfo" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"catalogInfo\": ") if tmp, err := json.Marshal(strct.CatalogInfo); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "CategoryClassification" field is required - if strct.CategoryClassification == nil { - return nil, errors.New("categoryClassification is a required field") - } - // Marshal the "categoryClassification" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"categoryClassification\": ") + // "CategoryClassification" field is required + if strct.CategoryClassification == nil { + return nil, errors.New("categoryClassification is a required field") + } + // Marshal the "categoryClassification" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"categoryClassification\": ") if tmp, err := json.Marshal(strct.CategoryClassification); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "CheckDetails" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "checkDetails" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"checkDetails\": ") + // "CheckDetails" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "checkDetails" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"checkDetails\": ") if tmp, err := json.Marshal(strct.CheckDetails); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "Duration" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "duration" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"duration\": ") + // "Duration" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "duration" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"duration\": ") if tmp, err := json.Marshal(strct.Duration); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "endTime" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"endTime\": ") + // Marshal the "endTime" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"endTime\": ") if tmp, err := json.Marshal(strct.EndTime); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "FailureLineContent" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "failureLineContent" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"failureLineContent\": ") + // "FailureLineContent" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "failureLineContent" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"failureLineContent\": ") if tmp, err := json.Marshal(strct.FailureLineContent); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "FailureLocation" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "failureLocation" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"failureLocation\": ") + // "FailureLocation" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "failureLocation" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"failureLocation\": ") if tmp, err := json.Marshal(strct.FailureLocation); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "SkipReason" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "skipReason" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"skipReason\": ") + // "SkipReason" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "skipReason" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"skipReason\": ") if tmp, err := json.Marshal(strct.SkipReason); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "StartTime" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "startTime" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"startTime\": ") + // "StartTime" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "startTime" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"startTime\": ") if tmp, err := json.Marshal(strct.StartTime); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "State" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "state" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"state\": ") + // "State" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "state" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"state\": ") if tmp, err := json.Marshal(strct.State); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "TestID" field is required - if strct.TestID == nil { - return nil, errors.New("testID is a required field") - } - // Marshal the "testID" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"testID\": ") + // "TestID" field is required + if strct.TestID == nil { + return nil, errors.New("testID is a required field") + } + // Marshal the "testID" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"testID\": ") if tmp, err := json.Marshal(strct.TestID); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true @@ -837,151 +837,151 @@ func (strct *Result) MarshalJSON() ([]byte, error) { } func (strct *Result) UnmarshalJSON(b []byte) error { - capturedTestOutputReceived := false - catalogInfoReceived := false - categoryClassificationReceived := false - checkDetailsReceived := false - durationReceived := false - failureLineContentReceived := false - failureLocationReceived := false - skipReasonReceived := false - startTimeReceived := false - stateReceived := false - testIDReceived := false - var jsonMap map[string]json.RawMessage - if err := json.Unmarshal(b, &jsonMap); err != nil { - return err - } - // parse all the defined properties - for k, v := range jsonMap { - switch k { - case "capturedTestOutput": - if err := json.Unmarshal([]byte(v), &strct.CapturedTestOutput); err != nil { - return err - } - capturedTestOutputReceived = true - case "catalogInfo": - if err := json.Unmarshal([]byte(v), &strct.CatalogInfo); err != nil { - return err - } - catalogInfoReceived = true - case "categoryClassification": - if err := json.Unmarshal([]byte(v), &strct.CategoryClassification); err != nil { - return err - } - categoryClassificationReceived = true - case "checkDetails": - if err := json.Unmarshal([]byte(v), &strct.CheckDetails); err != nil { - return err - } - checkDetailsReceived = true - case "duration": - if err := json.Unmarshal([]byte(v), &strct.Duration); err != nil { - return err - } - durationReceived = true - case "endTime": - if err := json.Unmarshal([]byte(v), &strct.EndTime); err != nil { - return err - } - case "failureLineContent": - if err := json.Unmarshal([]byte(v), &strct.FailureLineContent); err != nil { - return err - } - failureLineContentReceived = true - case "failureLocation": - if err := json.Unmarshal([]byte(v), &strct.FailureLocation); err != nil { - return err - } - failureLocationReceived = true - case "skipReason": - if err := json.Unmarshal([]byte(v), &strct.SkipReason); err != nil { - return err - } - skipReasonReceived = true - case "startTime": - if err := json.Unmarshal([]byte(v), &strct.StartTime); err != nil { - return err - } - startTimeReceived = true - case "state": - if err := json.Unmarshal([]byte(v), &strct.State); err != nil { - return err - } - stateReceived = true - case "testID": - if err := json.Unmarshal([]byte(v), &strct.TestID); err != nil { - return err - } - testIDReceived = true - default: - return fmt.Errorf("additional property not allowed: \"" + k + "\"") - } - } - // check if capturedTestOutput (a required property) was received - if !capturedTestOutputReceived { - return errors.New("\"capturedTestOutput\" is required but was not present") - } - // check if catalogInfo (a required property) was received - if !catalogInfoReceived { - return errors.New("\"catalogInfo\" is required but was not present") - } - // check if categoryClassification (a required property) was received - if !categoryClassificationReceived { - return errors.New("\"categoryClassification\" is required but was not present") - } - // check if checkDetails (a required property) was received - if !checkDetailsReceived { - return errors.New("\"checkDetails\" is required but was not present") - } - // check if duration (a required property) was received - if !durationReceived { - return errors.New("\"duration\" is required but was not present") - } - // check if failureLineContent (a required property) was received - if !failureLineContentReceived { - return errors.New("\"failureLineContent\" is required but was not present") - } - // check if failureLocation (a required property) was received - if !failureLocationReceived { - return errors.New("\"failureLocation\" is required but was not present") - } - // check if skipReason (a required property) was received - if !skipReasonReceived { - return errors.New("\"skipReason\" is required but was not present") - } - // check if startTime (a required property) was received - if !startTimeReceived { - return errors.New("\"startTime\" is required but was not present") - } - // check if state (a required property) was received - if !stateReceived { - return errors.New("\"state\" is required but was not present") - } - // check if testID (a required property) was received - if !testIDReceived { - return errors.New("\"testID\" is required but was not present") - } - return nil + capturedTestOutputReceived := false + catalogInfoReceived := false + categoryClassificationReceived := false + checkDetailsReceived := false + durationReceived := false + failureLineContentReceived := false + failureLocationReceived := false + skipReasonReceived := false + startTimeReceived := false + stateReceived := false + testIDReceived := false + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "capturedTestOutput": + if err := json.Unmarshal([]byte(v), &strct.CapturedTestOutput); err != nil { + return err + } + capturedTestOutputReceived = true + case "catalogInfo": + if err := json.Unmarshal([]byte(v), &strct.CatalogInfo); err != nil { + return err + } + catalogInfoReceived = true + case "categoryClassification": + if err := json.Unmarshal([]byte(v), &strct.CategoryClassification); err != nil { + return err + } + categoryClassificationReceived = true + case "checkDetails": + if err := json.Unmarshal([]byte(v), &strct.CheckDetails); err != nil { + return err + } + checkDetailsReceived = true + case "duration": + if err := json.Unmarshal([]byte(v), &strct.Duration); err != nil { + return err + } + durationReceived = true + case "endTime": + if err := json.Unmarshal([]byte(v), &strct.EndTime); err != nil { + return err + } + case "failureLineContent": + if err := json.Unmarshal([]byte(v), &strct.FailureLineContent); err != nil { + return err + } + failureLineContentReceived = true + case "failureLocation": + if err := json.Unmarshal([]byte(v), &strct.FailureLocation); err != nil { + return err + } + failureLocationReceived = true + case "skipReason": + if err := json.Unmarshal([]byte(v), &strct.SkipReason); err != nil { + return err + } + skipReasonReceived = true + case "startTime": + if err := json.Unmarshal([]byte(v), &strct.StartTime); err != nil { + return err + } + startTimeReceived = true + case "state": + if err := json.Unmarshal([]byte(v), &strct.State); err != nil { + return err + } + stateReceived = true + case "testID": + if err := json.Unmarshal([]byte(v), &strct.TestID); err != nil { + return err + } + testIDReceived = true + default: + return fmt.Errorf("additional property not allowed: \"%s\"", k) + } + } + // check if capturedTestOutput (a required property) was received + if !capturedTestOutputReceived { + return errors.New("\"capturedTestOutput\" is required but was not present") + } + // check if catalogInfo (a required property) was received + if !catalogInfoReceived { + return errors.New("\"catalogInfo\" is required but was not present") + } + // check if categoryClassification (a required property) was received + if !categoryClassificationReceived { + return errors.New("\"categoryClassification\" is required but was not present") + } + // check if checkDetails (a required property) was received + if !checkDetailsReceived { + return errors.New("\"checkDetails\" is required but was not present") + } + // check if duration (a required property) was received + if !durationReceived { + return errors.New("\"duration\" is required but was not present") + } + // check if failureLineContent (a required property) was received + if !failureLineContentReceived { + return errors.New("\"failureLineContent\" is required but was not present") + } + // check if failureLocation (a required property) was received + if !failureLocationReceived { + return errors.New("\"failureLocation\" is required but was not present") + } + // check if skipReason (a required property) was received + if !skipReasonReceived { + return errors.New("\"skipReason\" is required but was not present") + } + // check if startTime (a required property) was received + if !startTimeReceived { + return errors.New("\"startTime\" is required but was not present") + } + // check if state (a required property) was received + if !stateReceived { + return errors.New("\"state\" is required but was not present") + } + // check if testID (a required property) was received + if !testIDReceived { + return errors.New("\"testID\" is required but was not present") + } + return nil } func (strct *Root) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") - comma := false - // "Claim" field is required - if strct.Claim == nil { - return nil, errors.New("claim is a required field") - } - // Marshal the "claim" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"claim\": ") + comma := false + // "Claim" field is required + if strct.Claim == nil { + return nil, errors.New("claim is a required field") + } + // Marshal the "claim" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"claim\": ") if tmp, err := json.Marshal(strct.Claim); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true @@ -991,102 +991,102 @@ func (strct *Root) MarshalJSON() ([]byte, error) { } func (strct *Root) UnmarshalJSON(b []byte) error { - claimReceived := false - var jsonMap map[string]json.RawMessage - if err := json.Unmarshal(b, &jsonMap); err != nil { - return err - } - // parse all the defined properties - for k, v := range jsonMap { - switch k { - case "claim": - if err := json.Unmarshal([]byte(v), &strct.Claim); err != nil { - return err - } - claimReceived = true - default: - return fmt.Errorf("additional property not allowed: \"" + k + "\"") - } - } - // check if claim (a required property) was received - if !claimReceived { - return errors.New("\"claim\" is required but was not present") - } - return nil + claimReceived := false + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "claim": + if err := json.Unmarshal([]byte(v), &strct.Claim); err != nil { + return err + } + claimReceived = true + default: + return fmt.Errorf("additional property not allowed: \"%s\"", k) + } + } + // check if claim (a required property) was received + if !claimReceived { + return errors.New("\"claim\" is required but was not present") + } + return nil } func (strct *Versions) MarshalJSON() ([]byte, error) { buf := bytes.NewBuffer(make([]byte, 0)) buf.WriteString("{") - comma := false - // "CertSuite" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "certSuite" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"certSuite\": ") + comma := false + // "CertSuite" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "certSuite" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"certSuite\": ") if tmp, err := json.Marshal(strct.CertSuite); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "certSuiteGitCommit" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"certSuiteGitCommit\": ") + // Marshal the "certSuiteGitCommit" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"certSuiteGitCommit\": ") if tmp, err := json.Marshal(strct.CertSuiteGitCommit); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // "ClaimFormat" field is required - // only required object types supported for marshal checking (for now) - // Marshal the "claimFormat" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"claimFormat\": ") + // "ClaimFormat" field is required + // only required object types supported for marshal checking (for now) + // Marshal the "claimFormat" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"claimFormat\": ") if tmp, err := json.Marshal(strct.ClaimFormat); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "k8s" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"k8s\": ") + // Marshal the "k8s" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"k8s\": ") if tmp, err := json.Marshal(strct.K8s); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "ocClient" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"ocClient\": ") + // Marshal the "ocClient" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"ocClient\": ") if tmp, err := json.Marshal(strct.OcClient); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true - // Marshal the "ocp" field - if comma { - buf.WriteString(",") - } - buf.WriteString("\"ocp\": ") + // Marshal the "ocp" field + if comma { + buf.WriteString(",") + } + buf.WriteString("\"ocp\": ") if tmp, err := json.Marshal(strct.Ocp); err != nil { return nil, err - } else { - buf.Write(tmp) + } else { + buf.Write(tmp) } comma = true @@ -1096,52 +1096,52 @@ func (strct *Versions) MarshalJSON() ([]byte, error) { } func (strct *Versions) UnmarshalJSON(b []byte) error { - certSuiteReceived := false - claimFormatReceived := false - var jsonMap map[string]json.RawMessage - if err := json.Unmarshal(b, &jsonMap); err != nil { - return err - } - // parse all the defined properties - for k, v := range jsonMap { - switch k { - case "certSuite": - if err := json.Unmarshal([]byte(v), &strct.CertSuite); err != nil { - return err - } - certSuiteReceived = true - case "certSuiteGitCommit": - if err := json.Unmarshal([]byte(v), &strct.CertSuiteGitCommit); err != nil { - return err - } - case "claimFormat": - if err := json.Unmarshal([]byte(v), &strct.ClaimFormat); err != nil { - return err - } - claimFormatReceived = true - case "k8s": - if err := json.Unmarshal([]byte(v), &strct.K8s); err != nil { - return err - } - case "ocClient": - if err := json.Unmarshal([]byte(v), &strct.OcClient); err != nil { - return err - } - case "ocp": - if err := json.Unmarshal([]byte(v), &strct.Ocp); err != nil { - return err - } - default: - return fmt.Errorf("additional property not allowed: \"" + k + "\"") - } - } - // check if certSuite (a required property) was received - if !certSuiteReceived { - return errors.New("\"certSuite\" is required but was not present") - } - // check if claimFormat (a required property) was received - if !claimFormatReceived { - return errors.New("\"claimFormat\" is required but was not present") - } - return nil + certSuiteReceived := false + claimFormatReceived := false + var jsonMap map[string]json.RawMessage + if err := json.Unmarshal(b, &jsonMap); err != nil { + return err + } + // parse all the defined properties + for k, v := range jsonMap { + switch k { + case "certSuite": + if err := json.Unmarshal([]byte(v), &strct.CertSuite); err != nil { + return err + } + certSuiteReceived = true + case "certSuiteGitCommit": + if err := json.Unmarshal([]byte(v), &strct.CertSuiteGitCommit); err != nil { + return err + } + case "claimFormat": + if err := json.Unmarshal([]byte(v), &strct.ClaimFormat); err != nil { + return err + } + claimFormatReceived = true + case "k8s": + if err := json.Unmarshal([]byte(v), &strct.K8s); err != nil { + return err + } + case "ocClient": + if err := json.Unmarshal([]byte(v), &strct.OcClient); err != nil { + return err + } + case "ocp": + if err := json.Unmarshal([]byte(v), &strct.Ocp); err != nil { + return err + } + default: + return fmt.Errorf("additional property not allowed: \"%s\"", k) + } + } + // check if certSuite (a required property) was received + if !certSuiteReceived { + return errors.New("\"certSuite\" is required but was not present") + } + // check if claimFormat (a required property) was received + if !claimFormatReceived { + return errors.New("\"claimFormat\" is required but was not present") + } + return nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 4d78311a1..905caae72 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -52,7 +52,7 @@ github.com/davecgh/go-spew/spew ## explicit; go 1.13 github.com/emicklei/go-restful/v3 github.com/emicklei/go-restful/v3/log -# github.com/evanphx/json-patch/v5 v5.9.0 +# github.com/evanphx/json-patch/v5 v5.9.11 ## explicit; go 1.18 github.com/evanphx/json-patch/v5 github.com/evanphx/json-patch/v5/internal/json @@ -458,11 +458,11 @@ github.com/prometheus/procfs/internal/util # github.com/red-hat-storage/odf-operator v0.0.0-20241124050455-02681e6c10df ## explicit; go 1.22.7 github.com/red-hat-storage/odf-operator/api/v1alpha1 -# github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.53 -## explicit; go 1.23.6 +# github.com/redhat-best-practices-for-k8s/certsuite-claim v1.0.54 +## explicit; go 1.24.0 github.com/redhat-best-practices-for-k8s/certsuite-claim/pkg/claim -# github.com/redhat-best-practices-for-k8s/oct v0.0.33 -## explicit; go 1.23.6 +# github.com/redhat-best-practices-for-k8s/oct v0.0.34 +## explicit; go 1.24.0 github.com/redhat-best-practices-for-k8s/oct/pkg/certdb/config github.com/redhat-best-practices-for-k8s/oct/pkg/certdb/offlinecheck github.com/redhat-best-practices-for-k8s/oct/pkg/certdb/onlinecheck @@ -642,12 +642,12 @@ gorm.io/gorm/clause gorm.io/gorm/logger gorm.io/gorm/schema gorm.io/gorm/utils -# helm.sh/helm/v3 v3.17.0 +# helm.sh/helm/v3 v3.17.1 ## explicit; go 1.23.0 helm.sh/helm/v3/pkg/chart helm.sh/helm/v3/pkg/release helm.sh/helm/v3/pkg/time -# k8s.io/api v0.32.1 +# k8s.io/api v0.32.2 ## explicit; go 1.23.0 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -708,7 +708,7 @@ k8s.io/api/storage/v1 k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1beta1 k8s.io/api/storagemigration/v1alpha1 -# k8s.io/apiextensions-apiserver v0.32.1 +# k8s.io/apiextensions-apiserver v0.32.2 ## explicit; go 1.23.0 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 @@ -716,7 +716,7 @@ k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1 k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 -# k8s.io/apimachinery v0.32.1 +# k8s.io/apimachinery v0.32.2 ## explicit; go 1.23.0 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors @@ -780,7 +780,7 @@ k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/netutil k8s.io/apimachinery/third_party/forked/golang/reflect -# k8s.io/cli-runtime v0.32.0 +# k8s.io/cli-runtime v0.32.1 ## explicit; go 1.23.0 k8s.io/cli-runtime/pkg/genericclioptions k8s.io/cli-runtime/pkg/genericiooptions @@ -1010,7 +1010,7 @@ k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry k8s.io/client-go/util/watchlist k8s.io/client-go/util/workqueue -# k8s.io/component-base v0.32.1 +# k8s.io/component-base v0.32.2 ## explicit; go 1.23.0 k8s.io/component-base/cli/flag k8s.io/component-base/featuregate @@ -1046,7 +1046,7 @@ k8s.io/kube-openapi/pkg/spec3 k8s.io/kube-openapi/pkg/util/proto k8s.io/kube-openapi/pkg/util/proto/validation k8s.io/kube-openapi/pkg/validation/spec -# k8s.io/kubectl v0.32.0 +# k8s.io/kubectl v0.32.1 ## explicit; go 1.23.0 k8s.io/kubectl/pkg/cmd/util k8s.io/kubectl/pkg/drain @@ -1077,7 +1077,7 @@ k8s.io/utils/strings/slices sigs.k8s.io/container-object-storage-interface-api/apis sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage sigs.k8s.io/container-object-storage-interface-api/apis/objectstorage/v1alpha1 -# sigs.k8s.io/controller-runtime v0.20.1 +# sigs.k8s.io/controller-runtime v0.20.2 ## explicit; go 1.23.0 sigs.k8s.io/controller-runtime/pkg/client sigs.k8s.io/controller-runtime/pkg/client/apiutil