Skip to content

THREESCALE-16302 Remove cmp.Diff of openapi structs - #1192

Open
borisurbanik wants to merge 1 commit into
3scale:masterfrom
borisurbanik:bu-THREESCALE-16302
Open

borisurbanik wants to merge 1 commit into
3scale:masterfrom
borisurbanik:bu-THREESCALE-16302

Conversation

@borisurbanik

Copy link
Copy Markdown
Contributor

Fixes:

Validation

Set up minimal 3scale dev environment.

oc new-project $NAMESPACE
make cluster/create/system-mysql
make cluster/create/system-redis
make cluster/create/backend-redis
cat << EOF | oc create -f -
kind: Secret
apiVersion: v1
metadata:
  name: s3-credentials
  namespace: $NAMESPACE
data:
  AWS_ACCESS_KEY_ID: c29tZXRoaW5nCg==
  AWS_BUCKET: c29tZXRoaW5nCg==
  AWS_REGION: dXMtd2VzdC0xCg==
  AWS_SECRET_ACCESS_KEY: c29tZXRoaW5nCg==
type: Opaque
EOF

DOMAIN=$(oc get routes console -n openshift-console -o json | jq -r '.status.ingress[0].routerCanonicalHostname' | sed 's/router-default.//')
cat << EOF | oc create -f -
kind: APIManager
apiVersion: apps.3scale.net/v1alpha1
metadata:
  name: 3scale
  namespace: $NAMESPACE
spec:
  wildcardDomain: $DOMAIN
  system:
    fileStorage:
      simpleStorageService:
        configurationSecretRef:
          name: s3-credentials
  backend:
  externalComponents:
    backend:
      redis: true
    system:
      database: true
      redis: true
EOF

Run the operator locally.

make run

Wait for reconciliation. Then test the OpenApi will be created with schema with references:

cat << 'EOF' > test-activedoc.yaml
apiVersion: capabilities.3scale.net/v1beta1
kind: ActiveDoc
metadata:
  name: test-activedoc
  annotations:
    insecure_skip_verify: "true"
spec:
  name: "Test ActiveDoc"
  systemName: "test-activedoc"
  activeDocOpenAPIRef:
    url: "https://gist.githubusercontent.com/borisurbanik/5077eec278186852e2ccc1e6d790a6cf/raw/b6bbfccf6c21938ce1d7a2bd5c16fc057d44b5e2/openapi.json"
EOF
kubectl apply -f test-activedoc.yaml

Expected to not show error:

oc get activedoc test-activedoc -o json | jq -r .status
{
  "activeDocId": 3,
  "conditions": [
    {
      "lastTransitionTime": "2026-09-10T19:47:36Z",
      "status": "False",
      "type": "Failed"
    },
    {
      "lastTransitionTime": "2026-09-10T19:47:36Z",
      "status": "False",
      "type": "Invalid"
    },
    {
      "lastTransitionTime": "2026-09-10T19:47:36Z",
      "status": "False",
      "type": "Orphan"
    },
    {
      "lastTransitionTime": "2026-09-10T19:47:36Z",
      "status": "True",
      "type": "Ready"
    }
  ],
  "observedGeneration": 1,
  "providerAccountHost": "https://3scale-admin.apps.burbanik-3scale2.cp.fyre.ibm.com"
}

And the operator (make run) to not crash.

@borisurbanik
borisurbanik requested a review from a team as a code owner September 10, 2026 19:59
@briangallagher

briangallagher commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codecov-commenter

codecov-commenter commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.65%. Comparing base (c59a4c8) to head (9fde8fc).
⚠️ Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
...rs/capabilities/activedoc_threescale_reconciler.go 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1192      +/-   ##
==========================================
+ Coverage   44.03%   44.65%   +0.62%     
==========================================
  Files         204      208       +4     
  Lines       20960    21234     +274     
==========================================
+ Hits         9230     9483     +253     
- Misses      10933    10951      +18     
- Partials      797      800       +3     
Flag Coverage Δ
unit 44.65% <0.00%> (+0.62%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
apis/apps/v1alpha1 (u) 63.56% <ø> (ø)
apis/capabilities/v1alpha1 (u) 3.50% <ø> (ø)
apis/capabilities/v1beta1 (u) 20.21% <ø> (ø)
controllers (i) 12.60% <73.68%> (+0.51%) ⬆️
pkg (u) 64.26% <92.77%> (+0.56%) ⬆️
Files with missing lines Coverage Δ
...rs/capabilities/activedoc_threescale_reconciler.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tkan145 tkan145 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other cmp.Diff in the code, can we remove them all? Keep the log though, I don't see why we need to call cmp.Diff to compare string/bool/int.

@borisurbanik

Copy link
Copy Markdown
Contributor Author

There are other cmp.Diff in the code, can we remove them all? Keep the log though, I don't see why we need to call cmp.Diff to compare string/bool/int.

Removed all cmp.Diff occurrences.

@tkan145

tkan145 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Can we keep those log values please 😅

Also on PR review request replaced cmp.Diff with logging values
directly.
@borisurbanik

Copy link
Copy Markdown
Contributor Author

Can we keep those log values please 😅

Updated, added "existing" and "desired" kv entries for the logger. Please take a look again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants