SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.7k stars 8.19k forks source link

[Grid] Dynamic grid is not able to parse docker image other than default domain #8887

Closed olivia-hhe closed 3 years ago

olivia-hhe commented 3 years ago

🐛 Bug Report

[Grid] Dynamic grid is not able to parse docker image other than default domain

Node-docker console log:

15:41:29.419 INFO [Docker.getImage] - Obtaining image: artifactory.testing.com/testing/standalone-chrome:latest
15:41:29.469 INFO [LoggingOptions$1.lambda$export$1] - {"traceId": "f52e2227ede30c212444ffdd477e2749","spanId": "24e819850ebe54dd","spanKind": "INTERNAL","eventTime": 1605570089466920600,"eventName": "HTTP request received response","attributes": {"http.status_code": 200,"http.client_class": "org.openqa.selenium.remote.http.netty.NettyClient","http.url": "\u002fversion","http.method": "GET"}}

Exception in thread "main" java.lang.IllegalArgumentException: Unable to find class: org.openqa.selenium.grid.node.local.LocalNodeFactory
    at org.openqa.selenium.grid.config.Config.getClass(Config.java:74)
    at org.openqa.selenium.grid.config.MemoizedConfig.lambda$getClass$4(MemoizedConfig.java:99)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1688)
    at org.openqa.selenium.grid.config.MemoizedConfig.getClass(MemoizedConfig.java:95)
    at org.openqa.selenium.grid.node.config.NodeOptions.getNode(NodeOptions.java:72)
    at org.openqa.selenium.grid.node.httpd.NodeServer.execute(NodeServer.java:118)
    at org.openqa.selenium.grid.TemplateGridCommand.lambda$configure$2(TemplateGridCommand.java:98)
    at org.openqa.selenium.grid.Main.launch(Main.java:154)
    at org.openqa.selenium.grid.Main.go(Main.java:88)
    at org.openqa.selenium.grid.Main.main(Main.java:54)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.openqa.selenium.grid.config.Config.getClass(Config.java:69)
    ... 9 more
Caused by: org.openqa.selenium.docker.DockerException: Unable to parse: artifactory.testing.com/testing/standalone-chrome:latest
    at org.openqa.selenium.docker.internal.Reference.parse(Reference.java:133)
    at org.openqa.selenium.docker.v1_40.V140Docker.getImage(V140Docker.java:66)
    at org.openqa.selenium.docker.Docker.lambda$getImage$0(Docker.java:51)
    at java.util.Optional.map(Optional.java:215)
    at org.openqa.selenium.docker.Docker.getImage(Docker.java:51)
    at org.openqa.selenium.grid.docker.DockerOptions.lambda$loadImages$2(DockerOptions.java:156)
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1596)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:163)

To Reproduce

Steps to reproduce the behavior (including the command to start the containers):

Use standalone-chrome image(not in default domain) in config.yaml file:

# Configs have a mapping between the Docker image to use and the capabilities that need to be matched to
# start a container with the given image.
configs = [
    "artifactory.testing.com/testing/standalone-chrome:latest", "{\"browserName\": \"chrome\"}"
    ]

# URL for connecting to the docker daemon
# host.docker.internal works for macOS and Windows.
# Linux could use --net=host in the `docker run` instruction or 172.17.0.1 in the URI below.
# To have Docker listening through tcp on macOS, install socat and run the following command
# socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
host = "tcp://host.docker.internal:2375"

Start the hub and node-docker using the below code: execution-with-hub--node-roles

Expected behavior

node-docker should successfully register in hub.

Environment

OS: OSX 10.15.7 Docker-Selenium image version: 4.0.0-alpha-7-prerelease-20201009

Docker version: 19.03.8, build afacb8b Docker-Compose version (if applicable): N/A Exact Docker command to start the containers (if using docker-compose, provide the docker-compose file as well): $ docker network create grid $ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.0.0-alpha-7-20201009 $ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \ -e SE_EVENT_BUS_PUBLISH_PORT=4442 \ -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \ -v ${PWD}/config.toml:/opt/bin/config.toml \ selenium/node-docker:4.0.0-alpha-7-20201009

diemol commented 3 years ago

Thank you for reporting this, @olivia-hhe. I will close the docker-selenium issue when we do a new prerelease over there, should be in 1-2 weeks.

olivia-hhe commented 3 years ago

Thank you for the fix! @diemol