bito-code-review[bot] commented on code in PR #41777:
URL: https://github.com/apache/superset/pull/41777#discussion_r3545343473


##########
helm/superset/tests/secret_env_test.yaml:
##########
@@ -0,0 +1,71 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+suite: secret-env schema + deprecation mapping
+templates:
+  - secret-env.yaml
+tests:
+  - it: emits DB_* and REDIS_* from new schema
+    set:
+      database: {host: pg.svc, port: 5432, user: su, password: pw, name: 
superset}
+      cache: {enabled: true, host: rd.svc, port: 6379, cacheDb: 1, celeryDb: 0}
+    asserts:
+      - equal: {path: 'stringData.DB_HOST', value: pg.svc}
+      - equal: {path: 'stringData.DB_PORT', value: "5432"}
+      - equal: {path: 'stringData.REDIS_HOST', value: rd.svc}
+  - it: maps ALL legacy supersetNode.connections.* keys (deprecation path, no 
fail)
+    set:
+      cache:
+        enabled: true
+      supersetNode:
+        connections:
+          db_host: legacy-pg
+          db_port: "5555"
+          db_user: legacy-user
+          db_pass: legacy-pass
+          db_name: legacy-name
+          redis_host: legacy-rd
+          redis_port: "6380"
+          redis_cache_db: "7"
+          redis_celery_db: "8"
+          redis_driver: rediss
+    asserts:
+      - equal: {path: 'stringData.DB_HOST', value: legacy-pg}
+      - equal: {path: 'stringData.DB_PORT', value: "5555"}
+      - equal: {path: 'stringData.DB_USER', value: legacy-user}
+      - equal: {path: 'stringData.DB_PASS', value: legacy-pass}
+      - equal: {path: 'stringData.DB_NAME', value: legacy-name}
+      - equal: {path: 'stringData.REDIS_HOST', value: legacy-rd}
+      - equal: {path: 'stringData.REDIS_PORT', value: "6380"}
+      - equal: {path: 'stringData.REDIS_DB', value: "7"}
+      - equal: {path: 'stringData.REDIS_CELERY_DB', value: "8"}
+      - equal: {path: 'stringData.REDIS_PROTO', value: rediss}
+  - it: new-schema values still win over legacy when both are set
+    set:
+      database: {host: new-host, port: 1234}
+      supersetNode:
+        connections: {db_host: old-host, db_port: "9999"}
+    asserts:
+      - equal: {path: 'stringData.DB_HOST', value: new-host}
+      - equal: {path: 'stringData.DB_PORT', value: "1234"}
+  - it: emits REDIS_DRIVER when cache.driver set
+    set: {cache: {enabled: true, driver: "rediss+managed"}}
+    asserts:
+      - equal: {path: 'stringData.REDIS_DRIVER', value: "rediss+managed"}
+  - it: omits redis vars when cache disabled
+    set: {cache.enabled: false}
+    asserts:
+      - notExists: {path: 'stringData.REDIS_HOST'}

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Cache schema missing user/password props</b></div>
   <div id="fix">
   
   The schema at `helm/superset/values.schema.json` does not include 
`cache.user` or `cache.password` properties, even though the template 
`secret-env.yaml` emits `REDIS_USER` and `REDIS_PASSWORD`, `_helpers.tpl` reads 
`.Values.cache.user` and `.Values.cache.password` (lines 176–183), and 
`values.yaml` explicitly defines both fields (lines 309–311). This violates 
rule [8197]: missing schema properties lead to validation gaps and user 
confusion. These keys are referenced in the implementation but absent from the 
JSON schema validation surface.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #6c62f9</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



##########
helm/superset/tests/initscript_test.yaml:
##########
@@ -0,0 +1,63 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+suite: superset_init.sh rendering
+templates:
+  - secret-superset-config.yaml
+tests:
+  - it: renders superset db upgrade in init script
+    asserts:
+      - matchRegex:
+          path: 'stringData["superset_init.sh"]'
+          pattern: 'superset db upgrade'
+  - it: renders superset init in init script
+    asserts:
+      - matchRegex:
+          path: 'stringData["superset_init.sh"]'
+          pattern: 'superset init'
+  - it: renders db upgrade before admin creation
+    set:
+      init:
+        createAdmin: true
+        adminUser:
+          username: admin
+          firstname: Admin
+          lastname: User
+          email: [email protected]
+          password: adminpass
+    asserts:
+      - matchRegex:
+          path: 'stringData["superset_init.sh"]'
+          pattern: 'superset db upgrade'
+      - matchRegex:
+          path: 'stringData["superset_init.sh"]'
+          pattern: 'superset init'
+      - matchRegex:
+          path: 'stringData["superset_init.sh"]'
+          pattern: 'fab create-admin'
+  - it: admin creation is idempotent and does not swallow real failures
+    set:
+      init:
+        createAdmin: true
+        adminUser:
+          password: "x"
+    asserts:
+      - matchRegex:
+          path: 'stringData["superset_init.sh"]'
+          pattern: 'superset fab list-users'
+      - notMatchRegex:
+          path: 'stringData["superset_init.sh"]'
+          pattern: 'create-admin.*\|\| true'

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing test coverage for loadExamples</b></div>
   <div id="fix">
   
   The `_helpers.tpl` init script template (lines 708-717) conditionally 
renders `superset load_examples` and datasource import commands, but this test 
file has no assertions covering those code paths. Per BITO.md rule [6262], 
tests must verify actual business logic — the `loadExamples` and datasource 
import logic is rendered code that warrants test coverage.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #6c62f9</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to