amoghrajesh commented on PR #39003:
URL: https://github.com/apache/airflow/pull/39003#issuecomment-2053980771

   @hussein-awala yea some test coverage would be nice. Just wanted to 
understand how the portion of interacting with a DB can be tested here. I was 
trying something along these lines:
   ```
       @pytest.mark.parametrize(
           "input",
           [
               [
                   V1EnvVar(
                       name="password",
                       value="mypassword",
                   ),
                   V1EnvVar(
                       name="normal",
                       value="normalstuff",
                   ),
                   V1EnvVar(
                       name="secret",
                       value="ok",
                   ),
                   V1EnvVar(
                       name="thisisok",
                       value="password",
                   ),
               ],
               {
                   "password": "password1",
                   "good": "thisisgood",
                   "secret": "normal_stuff",
                   "normal": "secret"
               }
           ],
       )
       def test_env_vars_redaction(self, input):
           k = KubernetesPodOperator(
               task_id="task-1",
               env_vars=input,
           )
   
           ctx = create_context(k, persist_to_db=True)
           pod = k.build_pod_request_obj(ctx)
           print(pod)
   ```
   
   But I constantly get this: 
   ```
   self = <sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite object at 
0x115594550>
   cursor = <sqlite3.Cursor object at 0x12545f030>
   statement = 'INSERT INTO dag (dag_id, root_dag_id, is_paused, is_subdag, 
is_active, last_parsed_time, last_pickled, last_expired, ... 
next_dagrun_create_after) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
   parameters = ('dag', None, 0, 0, 0, None, ...)
   context = <sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext object at 
0x1253d6d90>
   
       def do_execute(self, cursor, statement, parameters, context=None):
   >       cursor.execute(statement, parameters)
   E       sqlite3.OperationalError: table dag has no column named 
dag_display_name
   
   ```
   
   The pod object also contains the un protected env_vars, so we need a DB 
interaction for sure. Any suggestions?
   


-- 
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]

Reply via email to