microsoft / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
1.72k stars 865 forks source link

VSCode extension, which includes a local server, tests #2059

Closed peni4142 closed 5 years ago

peni4142 commented 5 years ago

Having an issue with software on Hosted Agent?

VSCode extension tests as described in the docs https://code.visualstudio.com/api/working-with-extensions/testing-extension.

That means among other things Electron and NodeJs are included.

Agent Version and Platform

I don't know how to get information about the versions but that is the yml definition for the agents I tried:

jobs:

- template: ./test.yml  
  parameters:
    name: Linux
    pool: Hosted Ubuntu 1604
#     # pool: Hosted Linux Preview seems not available

- template: ./test.yml  
  parameters:
    name: macOS
    pool: Hosted macOS

- template: ./test.yml  
  parameters:
    name: Windows1
    pool: Hosted VS2017

- template: ./test.yml  
  parameters:
    name: Windows2
    pool: Hosted

- template: ./test.yml  
  parameters:
    name: Windows3
    pool: Hosted Windows Container

(last run today 16.01.2019)

What's not working?

Send a request to a local server :

this.configServer = createServer((req: IncomingMessage, res: ServerResponse) => {
                // do some 
            }).listen(6123);

Error Message

connect ECONNREFUSED 127.0.0.1:6123
Error: connect ECONNREFUSED 127.0.0.1:6123
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)

And Ubuntu is not working at all. I tried that on my own private Linux(arch) machine. There was the package "libgconf2-4" missing. Maybe that is the same error on the hosted agent, but I don't know, because it returns only the error message "##[error]Bash exited with code '1'."

Agent and Worker's Diagnostic Logs

Yeah, I don't know where looking for them for a hosted agent... The only logs I find are not that information rich.

An example of the build logs. Not that information-rich 8_Run tests.txt

peni4142 commented 5 years ago

Ok, maybe that is not a Problem with the agents... SRY! I think you can close that...

TingluoHuang commented 5 years ago

:)

peni4142 commented 5 years ago

Ok, there was a wrong line of code crept in. As a result, I thought the problem would be elsewhere, but after the line is out again, it can be assumed that the problem is in the agents.

I am sorry for this confusion.

Is it possible to reopen that thread?

TingluoHuang commented 5 years ago

@peni4142 can you provider more detail information, like a build log?

peni4142 commented 5 years ago

I have updated the issue, but as you can see, no further information can be found. I had to write more unit tests to be able to specify the problem. The possible problem with the Linux machine, I could only guess by readjusting on a local machine.

TingluoHuang commented 5 years ago

@peni4142 looks like the agent correctly execute the cmd script you defined node test.js, and the step failed correctly since your test failed and cmd return non-zero code. To me, the agent behaves correct, you might need to debug your test script to figure out what's causing the test failure.

peni4142 commented 5 years ago

The test fails because it is not possible to make a request on a local Nodejs server. Or should the agents not support this?

connect ECONNREFUSED 127.0.0.1:6123
Error: connect ECONNREFUSED 127.0.0.1:6123
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)

That's why I listed it under the point "Having an issue with software on Hosted Agent". I think a Nodejs server is really common.

TingluoHuang commented 5 years ago

@peni4142 that's sounds like Hosted VM environment issue, the agent is just a process get launched on the machine. :)

peni4142 commented 5 years ago

Does that mean I opened the thread in the wrong place? Do you know "Passierschein A38"? In English, it is "permit number A38" I think.

TingluoHuang commented 5 years ago

this repository might not be the right place for your problem and i don't know where to redirect you. :( i have no idea about Passierschein A38 :(

peni4142 commented 5 years ago

What is about:

And Ubuntu is not working at all. I tried that on my own private Linux(arch) machine. There was the package "libgconf2-4" missing. Maybe that is the same error on the hosted agent, but I don't know, because it returns only the error message "##[error]Bash exited with code '1'."

?

TingluoHuang commented 5 years ago

the log you attached shows you are trying to run node test.js. are you able to make your workflow working in your local box? (completed outside the Azure DevOps system)

peni4142 commented 5 years ago

Yes, and it works.

My file calls this file:

https://github.com/Microsoft/vscode-extension-vscode/blob/master/bin/test

I set some environment variables and for stdio I use "inherit". You also see everything, was to return the file of the vscode module.

But now I have a new scenario. Only the test I have defined to be able to specify the problem fails. Not the real one anymore. Now, the test no longer fails with "ECONNREFUSED", but with a timeout. So for me it says, I can take out the test first and hope that it stays that way.

bryanmacfarlane commented 5 years ago

This is the agent application.

I would suggest logging an issue in the vscode extension repo about how to run their tests in hosted. I know they currently run their tests in hosted so they may have specific feedback on their tests.