Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filename to env #1945

Merged
merged 11 commits into from
Sep 2, 2024
Merged

Conversation

tokou
Copy link
Contributor

@tokou tokou commented Aug 24, 2024

Proposed changes

  • Set FILENAME env value to the flow file's name
  • This happens only in the context of the test and does not alter the system env

Testing

I updated 2 of the integration tests to use the FILENAME env var and check their correct naming

Run ./gradlew :maestro-test:test
Run ./gradlew :maestro-orchestra:test
Run ./gradlew :maestro-orchestra-models:test

Issues fixed

Fixes #1616

@tokou tokou force-pushed the add-filename-to-env branch from 33d2a54 to 810e972 Compare August 25, 2024 00:00
@bartekpacia
Copy link
Contributor

bartekpacia commented Aug 27, 2024

Hey, thanks a ton Tarek. Overall this LGTM!

Two small things:

  • let's change name to MAESTRO_FILENAME
  • how does it behave in subflows? Is the name of the root flow printed? I'd love to see a test for this case!
  • Is there any difference between JS engines?

PS In the longer term, I think we'll need to have a list of all Maestro-provided env variables, so people will not override them when they pass their own MAESTRO_FILENAME vars.

@bartekpacia
Copy link
Contributor

@tokou I rebased with master (to make github checks ✅) and renamed the variable.

If you have some free time (and will!), tests would be great to see:)

@tokou
Copy link
Contributor Author

tokou commented Aug 31, 2024

I noticed with the tests that we populate the env var with subflow file names in the subflows. I think it makes more sense for it to always be the top level flow name. So I fixed it and added some tests.

@bartekpacia
Copy link
Contributor

I think it makes more sense for it to always be the top level flow name.

Agreed, thanks a ton!

After the conflicts are resolved this is good to go.

@tokou tokou force-pushed the add-filename-to-env branch 2 times, most recently from 8757349 to d648d9c Compare September 1, 2024 17:34
@tokou tokou force-pushed the add-filename-to-env branch from d648d9c to ecf28f1 Compare September 1, 2024 17:35
@bartekpacia
Copy link
Contributor

One last ask, if I may - could we keep withEnv() the way it was before? To minimize changed lines + make code more explicit.

.withUserProvidedEnv()
.withSystemEnv(...)

makes it obvious that "system env vars" (like MAESTRO_FILENAME) take precedence – which is what we want.

Lmk what you think. You already did a lot and I don't want you to lose enthusiasm :)

@bartekpacia
Copy link
Contributor

bartekpacia commented Sep 2, 2024

On the other hand, this is good enough. Thanks a lot!

EDIT This was followed up in #2010

@bartekpacia bartekpacia merged commit 1bd6734 into mobile-dev-inc:main Sep 2, 2024
4 checks passed
@tokou tokou deleted the add-filename-to-env branch September 3, 2024 07:36
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.

Make the filename of the current test available as environment variable
2 participants