Deployment of flows and classes related to them
Flows can only be deployed inactive. This is the way the platform is designed for the deployment of flows.
From the article Special Behavior in Deployments:
Copado allows you do deploy active flows without having to deactivate them or activate them once deployed.
Copado deploys the flow inactive and activate it in the target org but, a deployment is only completed after the test classes run in the target org therefore, before we can activate the flow, the test classes must run so that the flow is considered fully deployed and we can activate it.
We cannot activate the flow before the test classes run because the deployment is not considered completed at that point.
The order of events would be:
1. Deploy the flow (it's not deployed until the test run).
2. Test classes run. If they do not pass the deployment fails and the flow is not deployed. Same behaviour as with any other component.
3. If the test run successful, the deployment is completed. The flow is now deployed inactive.
4. Copado activates the flow.
What would happen if one the test classes running in the deployment requires the flow that it's being deployed to be active?
The test class will fail since the flow will not be active by the time the test class is running. You will have to deploy the flow first and then the test class in a different deployment to make sure the flow is active when the test class runs.