Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set necessary flags for headless mode #50

Closed
wants to merge 1 commit into from
Closed

Set necessary flags for headless mode #50

wants to merge 1 commit into from

Conversation

o-liver
Copy link
Member

@o-liver o-liver commented Jan 23, 2024

Without these flags the user has to set these in their comfiguration, e.g. karma.conf.js:

    browsers: ['ChromeHeadlessCustom'],
    customLaunchers: {
      ChromeHeadlessCustom: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox', '--disable-dev-shm-usage']
      }
    },

As this image is intended for automation and will always run in headless mode, we should set these flags for a simpler setup for the users.

@o-liver o-liver self-assigned this Jan 23, 2024
@o-liver o-liver requested a review from rodibrin January 23, 2024 13:29
@srinikitha09
Copy link
Contributor

Did you test this with our service?

@o-liver
Copy link
Member Author

o-liver commented Jan 23, 2024

Did you test this with our service?

I tested changing the karma.conf.js file with our service and I tested changing the docker image and running it locally, mounting the app inside to run the test. Do you have concerns for that method?

Copy link
Member

@marcusholl marcusholl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing this with the master using a suitable node-based reference-project branch we get:

24 01 2024 11:53:10.738:INFO [karma-server]: Karma v5.2.3 server started at http://localhost:9876/
24 01 2024 11:53:10.739:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
(node:72) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:72) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
24 01 2024 11:53:10.745:INFO [launcher]: Starting browser ChromeHeadless
(node:72) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
24 01 2024 11:53:10.894:ERROR [launcher]: Cannot start ChromeHeadless
	Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
[0124/115310.889453:FATAL:zygote_host_impl_linux.cc(200)] Check failed: . : Operation not permitted (1)
...

When testing this with the HEAD of the PR-branch and the same reference-project we get:

node@ed84cd8346ad:/work$ npm run test

> [email protected] test
> karma start

24 01 2024 11:56:30.091:INFO [karma-server]: Karma v5.2.3 server started at http://localhost:9876/
24 01 2024 11:56:30.092:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
(node:193) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:193) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
24 01 2024 11:56:30.099:INFO [launcher]: Starting browser ChromeHeadless
(node:193) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
24 01 2024 11:56:30.364:INFO [Chrome Headless 120.0.6099.224 (Linux aarch64)]: Connected on socket NCbw8mEtykd943OmAAAA with id 97942650
(node:193) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
ERROR: '2024-01-24 11:56:31.709800 failed to load JavaScript resource: fioribasapp/Component-preload.js -  sap.ui.ModuleSystem'
ERROR: '2024-01-24 11:56:33.421500 Connector (LrepConnector) failed call 'loadFlexData': Error: Not Found
				Application startup continues without data from this storage. -  '
ERROR: '2024-01-24 11:56:33.569199 Connector (LrepConnector) failed call 'loadFeatures': Error: Not Found
				Application startup continues without data from this storage. -  '
Chrome Headless 120.0.6099.224 (Linux aarch64): Executed 2 of 2 SUCCESS (3.086 secs / 2.669 secs)
TOTAL: 2 SUCCESS
node@ed84cd8346ad:/work$ echo $?
0

remark: I was not able to build the project with the java-jre dependency since I was not able to resolve that dependency. Hence I removed installing openjdk-jre.

Copy link
Contributor

@srinikitha09 srinikitha09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has been tested together with Marcus and it works as desired. Thank you!

@o-liver
Copy link
Member Author

o-liver commented Jan 25, 2024

@CCFenner @anilkeshav27 I'm not sure we should take this path suggested with this PR. One can alternatively set these flags in the sources, e.g. in the karma.conf.js file. I'm leaning more towards the latter. What do you think?

@o-liver
Copy link
Member Author

o-liver commented Jan 26, 2024

We have decided to solve this for our service only. We don't want to set flags for everybody using these images, as we cannot know all use cases.

@o-liver o-liver closed this Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants