damccorm commented on PR #35473:
URL: https://github.com/apache/beam/pull/35473#issuecomment-3266474895
> > @mohamedawnallah would you mind taking a look at the failures here?
> > ```
> >
apache_beam/examples/snippets/transforms/elementwise/enrichment_test.py:203: in
sql_test_context
> > result = EnrichmentTestHelpers.pre_sql_enrichment_test(
> >
apache_beam/examples/snippets/transforms/elementwise/enrichment_test.py:246: in
pre_sql_enrichment_test
> > os.environ['GOOGLE_CLOUD_SQL_DB_PASSWORD'] = password
> > /opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/os.py:684: in
__setitem__
> > value = self.encodevalue(value)
> > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _
> >
> > value = None
> >
> > def encode(value):
> > if not isinstance(value, str):
> > > raise TypeError("str expected, not %s" %
type(value).__name__)
> > E TypeError: str expected, not NoneType
> > ```
>
> The tests are currently failing because `ALLOYDB_PASSWORD` is being
perceived as `None`, even though it's configured as a secret in the relevant
workflows `PreCommit Python Coverage` and `PreCommit Python Examples` (#36061).
>
> I've encountered this exact issue before and couldn't really figure it out
(similar problem when tried to access on beam PostCommit Python workflow in
[#34398
(comment)](https://github.com/apache/beam/pull/34398#discussion_r2279981586)).
This secret specifically seems having issues when attempting to use in other
workflows.
>
> The failure occurs at this specific line where the code attempts to read
the password environment variable:
>
> ```python
> password = os.getenv("ALLOYDB_PASSWORD")
> ```
>
>
https://github.com/mohamedawnallah/beam/blob/af8e4fe198b89a0abfd9a88fb2c1ab0303338772/sdks/python/apache_beam/examples/snippets/transforms/elementwise/enrichment_test.py#L242
>
> When the environment variable doesn't exist, `os.getenv()` returns `None`,
causing the test to fail.
>
> This appears to be an infrastructure issue related to how the
`ALLOYDB_PASSWORD` secret is accessed across different workflows. Perhaps
@Amar3tto, @A1K28 can help
>
> Probably the least resistant path would be to skip these tests when
`ALLOYDB_PASSWORD` is not accessible. However, this approach doesn't address
the root cause, perhaps not a clean solution, and at the same time allow us to
make progress on this PR and that secret access issue can be resolved later
>
> What do you think, @damccorm?
Have you tried running the gradle task that is failing locally? One idea is
that it may be that we're invoking these tests with tox and need to allow list
this variable to be passed through to the tox environment -
https://github.com/apache/beam/blob/32f5be6c36c17ae87e1b3dc11426b95c352d3584/sdks/python/tox.ini#L34
--
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]