Conversation
| (sfdx_dir / "alias.json").write_text(json.dumps(alias_data)) | ||
|
|
||
| print("Fake SF CLI org auth written to ~/.sfdx/dev1@example.com.json") | ||
| PYEOF |
There was a problem hiding this comment.
For this command and all that follow- is there any reason to do them inline like this, as opposed to putting all of these into a python script or something and calling that from here?
There was a problem hiding this comment.
Migrating these commands to native Typescript will likely happen one at a time. Spelling them out this way allows for easy removal of the init commands as an example once that Typescript has been implemented leaving the other tests in place until they get migrated. Lastly if a particular test fails it's pretty easy to track down the where and why.
Probably some of the fake token logic and auth logic could be extracted for portability, interesting day after thought as I was pondering your questions.
There was a problem hiding this comment.
It there a way to run all these tests locally, via act maybe?
| with runner.isolated_filesystem(): | ||
| os.makedirs(os.path.join("mydir", "payload"), exist_ok=True) | ||
| result = runner.invoke(init, ["--code-type", "script", "mydir"]) | ||
| assert result.exit_code != 2, result.output |
There was a problem hiding this comment.
Any reason not to result.exit_code == 2 on these?
There was a problem hiding this comment.
Exit code 2 is Click's specific "bad usage" code, see here for reference.
There was a problem hiding this comment.
I guess what I'm thinking is, we could be hitting a different error "earlier" than we'd hit exit_code 2, potentially giving a false sense of confidence from these checks if some of them are returning different exit codes.
| assert result.exit_code != 2, result.output | ||
| # Document the incompatibility: SF CLI passes a single "dep1,dep2" string, | ||
| # but run_entrypoint receives ("dep1,dep2",) — not ("dep1", "dep2"). | ||
| assert mock_run.call_args[0][2] == ("dep1,dep2",) |
There was a problem hiding this comment.
Is this expected / working?
There was a problem hiding this comment.
It's important to note that this is a static test derived from reading the typescript code. In doing so I realized that I had messed up the --dependency flag in Typescript such that python wants multiple depenedency flags are required per dependency. Typescript allows for a single dependency flag with comma separated values. It's more of a reminder to me to go fix that but not super critical as it'll be a while before that replaces this in our environments.
| # ── Mock Salesforce server + fake org auth ──────────────────────────────── | ||
|
|
||
| - name: Start mock Salesforce server | ||
| run: python scripts/mock_sf_server.py & |
There was a problem hiding this comment.
Will the & process be dangling if a test fails? Might want to add something to cleanup at the end, like:
- name: Stop mock server
if: always()
run: kill $(cat /tmp/mock_server.pid) 2>/dev/null || true
No description provided.