James Netherton created CAMEL-27891:
---------------------------------------

             Summary: camel-salesforce: integration test setup script fails to 
deploy and stores an empty refresh token
                 Key: CAMEL-27891
                 URL: https://issues.apache.org/jira/browse/CAMEL-27891
             Project: Camel
          Issue Type: Bug
          Components: camel-salesforce
            Reporter: James Netherton
            Assignee: James Netherton


The SF CLI based integration test setup added in CAMEL-22782 
(\{{it/resources/setup-salesforce.sh}}) no longer works against current 
Salesforce orgs and SF CLI versions:

* *The metadata deploy fails.* The script generates and deploys a 
\{{CamelSalesforceIntegrationTests}} connected app, which Salesforce now 
rejects because it restricts creating connected apps. The whole deploy fails. 
The tests do not use this app: they log in with the refresh token of the SF 
CLI's own app (\{{PlatformCLI}}).
* *The stored refresh token is empty.* \{{sf org display --verbose}} now 
redacts the SFDX auth URL, so the refresh token extracted from it is empty and 
the tests cannot log in. The URL has to be read with \{{sf org auth 
show-sfdx-auth-url}}.
* *The username is not stored.* The approval and composite batch tests need it.
* *The username/password mode does not work.* It passes the credentials as an 
SFDX auth URL, which expects a refresh token, not a password.

Proposed changes:

* Stop generating and deploying the connected app, and delete the copy 
generated by earlier versions of the script, which holds a secret.
* Read the client id, client secret and refresh token with \{{sf org auth 
show-sfdx-auth-url}}, and store the username.
* Remove the username/password mode. An existing org is used by logging in with 
\{{sf org login web}} and setting it as the local \{{target-org}}.
* Fail early when there is no refresh token and nothing else provides 
credentials, or when a password is set as well, which makes the login type 
ambiguous (unless \{{salesforce.auth.type}} is set).
* Skip \{{SalesforceClientCredentialsFlowManualIT}} unless the user configures 
a client secret, as the setup no longer provides an app for that flow.
* Update \{{it/resources/README.md}}, the component README and 
\{{test-salesforce-login.sample.properties}}.

With these changes the full \{{*ManualIT}} suite runs against a scratch org 
created by the script, apart from two failures in the component which will be 
tracked separately.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to