Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

ng e2e in Docker container : "Error: spawn ps ENOENT" although all tests succeed #5453

Open
matcho opened this issue Jul 8, 2020 · 4 comments

Comments

@matcho
Copy link

matcho commented Jul 8, 2020

After building a new Docker image for GitLab CI/CD, it happens that running angular e2e tests inside it triggers an unknown error regardless of the tests status, thus breaking the CI pipeline. It used to work with a previous Docker image and also works on another Linux machine without Docker.

  • Node Version: 14.5.0
  • Protractor Version: 7.0.0
  • Angular Version: 9.0.6
  • Browser(s): Chromium 83.0.4103.116
  • Operating System and Version Debian 10.4
  • Your protractor configuration file
exports.config = {
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: [ "--no-sandbox", "--headless" ]
    }
  },
  directConnect: true,
  baseUrl: 'http://localhost:4200/',
  onPrepare() {
    require('ts-node').register({
      project: 'e2e/tsconfig.e2e.json'
    });
  }
};

  • A relevant example test
import { ListPage } from "./list.po";

describe("list page", () => {
  let page: ListPage;

  beforeEach(() => {
    page = new ListPage();
  });

  it("when list is open, user should see the list of available compute nodes", async () => {
    await page.navigateTo();
    expect(page.getCalculatorsMenuLength()).toBeGreaterThan(8);
  });
});
  • Output from running the test
ng e2e --dev-server-target= --specs="e2e/list.e2e-spec.ts"
[11:43:09] I/update - chromedriver: file exists /build/nghyd/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_83.0.4103.39.zip
[11:43:09] I/update - chromedriver: unzipping chromedriver_83.0.4103.39.zip
[11:43:10] I/update - chromedriver: setting permissions to 0755 for /build/nghyd/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_83.0.4103.39
[11:43:10] I/update - chromedriver: chromedriver_83.0.4103.39 up to date
[11:43:10] I/launcher - Running 1 instances of WebDriver
[11:43:10] I/direct - Using ChromeDriver directly...
Started
.


1 spec, 0 failures
Finished in 3.296 seconds

[11:43:18] I/launcher - 0 instance(s) of WebDriver still running
[11:43:18] I/launcher - chrome #01 passed
events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: spawn ps ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:468:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12)
    at onErrorNT (internal/child_process.js:468:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn ps',
  path: 'ps',
  spawnargs: [ '-o', 'pid', '--no-headers', '--ppid', 3867 ]
}

  • Steps to reproduce the bug

Run ng e2e in a Debian 10 based Docker container, whatever the chromium / chromedriver version (tried downgrading to 80.x), whatever the nodejs version (tried downgrading to 12.x). Running only one test as in the example above or the whole test suite changes nothing.

Running the same test suite in a previous Docker container based on Debian 9 used to work. For some reason we built a new Docker image, and the issue appeared.

Running it on a Linux Mint 19 machine with the same versions of node, Protractor, chromium, chromedriver, works (and has always worked) as expected.

Thank you

@byrion
Copy link

byrion commented Aug 3, 2020

For me it turned out to be ps missing from the image as described here bahmutov/start-server-and-test#132 (comment)

@matcho
Copy link
Author

matcho commented Aug 10, 2020

Thanks a lot, it works now.
Maybe the error message should be more explicit ?

@wasiqkhan786
Copy link

Hi, i am also facing the same error .tests are being passed successfully but at the end throwing this error.
Note: I am not using the docker.

@andredesousa
Copy link

I have doubts about using Node 14.
Angular is using Node 12 and Angular CLI Node 10. For more details:

https://github.com/angular/angular/blob/master/.nvmrc
https://github.com/angular/angular-cli/blob/master/.nvmrc

I tried with Angular 10, Node 14.15.0 and Protactor 7 and sometimes I have the next error:

Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:52810

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants