TestProject Forum

Testproject Agent is restarting when running in CLI mode using ADO pipeline in a remote windows/linux machines

Hi Team, we are running into an issue this morning: using OpenSDK and testagent v2.0.1
Our test is working fine in pipeline on-prem agent using v2.0.1 agent which is always on but if sometime agent fails to load in remote machines(happend this morning), we added cli command ‘testproject-agent start’ command using command line to make sure testagent is up and running in remote connection for ADO pipeline agent before maven goal and its actually restarting the agent from start and taking longer time to complete and if you run the same command in local machine(assuming agent is already running) we get below output which is what we expect but this not happening in a remote connection
C:\Program Files\TestProject Agent>testproject-agent start
Agent is already running.

is there any other way we can make sure not to restart the existing running agent in remote connect or check testproject-agent status? and make sure it doesnt restart

Note: We did try cd C:\Program Files\TestProject Agent and run it as .exe even this is also same issue.

@SaiManojKumar.Rudra

You can use the testproject-agent connect command that will help to determine whether the agent is running or not.

1 Like

@marat
We did try that, an existing agent which is running state has been shut down and got this error
‘Failed connecting to Agent null’

@marat we did try using testproject-agent start -f and that is kind of better way :slight_smile: but it still restarts the existing agent
C:\Program Files\TestProject Agent> .\testproject-agent start -f
Agent is not running.
Starting Agent…
Agent started with PID: [18704]

and where as local we get
C:\Program Files\TestProject Agent> .\testproject-agent start -f
Agent is already running.

Could you please clarify a bit more on how you differentiate existing and local agent ?

@marat
sorry, I mean the existing agent which is already running in remote connection - ADO pipeline(We executed the testproject agent by running the .exe file manually by login into the machine)
and we pass this command C:\Program Files\TestProject Agent> .\testproject-agent start -f in ADO pipeline powershell task in CI/CD scripts to make sure the agent is not down before running the tests but we get the below message where the agent is not running and then it restarts
Agent is not running.
Starting Agent…
Agent started with PID: [18704]

But in local the agent meaning in personal laptops where the agent is already running and not connected to any pipeline(used for local testing). We get this expected message but this not the case for pipeline remote machines
C:\Program Files\TestProject Agent> .\testproject-agent start -f
Agent is already running.

When you login into the machine manually and then in the power-shell task in ADO, are you using the same user? Could it be that these are different users and hence the Agent stores it’s data (including the runtime information) in different folders?

I have to check with my DevOps admins team, as I do not have access to the pipeline agents. I will get back asap.

Hello Marat,
Is there a way to determine if an agent is running in the java code? using some testProject method??
Thanks a lot

You can try accessing the Agent’s API or the web page at http://localhost:8585 to see if it’s running.
Another option is using the testproject-agent connect command.

How do we bounce or restart the Agent? I keep getting message “Agent is already running”, but I would like to bounce it.

You can use the UI to quit the Agent.
If the machine is headless, you can kill the Agent process by killing a java process.

It’s a good idea to add an option to restart/quit the Agent using the CLI.
I will add it to our future enhancements list.