I want to run a simple test that remote on a local docker container:
$docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e559bc98ae9c selenium/standalone-chrome-debug:latest "/opt/bin/entry_poin…" 10 seconds ago Up 6 seconds 0.0.0.0:4444->4444/tcp, 0.0.0.0:5900->5900/tcp new_selenium
I can run it successfully with selenium config:
driverWeb = new RemoteWebDriver(new URL(url), chromeBrowserCapabilities();
But when I try to let Serenity control the webdriver life cycle, have an error:
Dec 06, 2019 5:31:15 PM org.openqa.selenium.remote.DesiredCapabilities chrome INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()` [main] INFO net.thucydides.core.steps.ConsoleLoggingListener - STEP ERROR: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate class org.openqa.selenium.chrome.ChromeDriver F[main] INFO net.thucydides.core.steps.ConsoleLoggingListener - STEP ERROR: net.thucydides.core.webdriver.DriverConfigurationError: Could not instantiate new WebDriver instance of type class org.openqa.selenium.chrome.ChromeDriver (session not created: No matching capabilities found Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'a77e0051b738', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.184-linuxkit', java.version: '1.8.0_222' Driver info: driver.version: unknown remote stacktrace: #0 0x55d7b005a7e9 <unknown>
This is serenity.conf:
webdriver { driver = chrome
timeouts {
implicitlywait = 7000
fluentwait = 10000
}
}
headless.mode = false
chrome.capabilities.acceptSslCerts = true
chrome.capabilities.handlesAlerts = true
#
# Chrome options can be defined using the chrome.switches property
#
chrome.switches="""--start-maximized;--test-type;--no-sandbox;--ignore-certificate-errors;
--disable-popup-blocking;--disable-default-apps;--disable-extensions-file-access-check;
--incognito;--homepage=about:blank;--disable-infobars;--disable-gpu"""
webdriver.chrome.driver = "drivers/chromedriver"
webdriver.gecko.driver = "drivers/geckodriver"
I do not know why have this error and how to fix it.
Please help me!
Thanks!
If your node is running in docker then try to configure the drive as remote one.
Here is an example taken directly from serenity documentation (https://serenity-bdd.github.io/theserenitybook/latest/serenity-grid.html#_configuring_your_serenity_tests)
webdriver {
driver = remote
remote {
url="http://localhost:4444/wd/hub"
driver=chrome
}
}
You dont need to set capability for that. You can distinguish between local and remote before running the tests, as given below.
And run as;
mvn clean install verify -Dmaven.test.failure.ignore=true
# Remote
webdriver {
driver = remote
remote {
url="http://YOUR_IP:YOUR_PORT/wd/hub"
driver=chrome
}
}
#Local
#webdriver {
# driver = chrome
#}
zalenium {
screenResolution = "1280x720"
idleTimeout = 150
}
headless.mode=false
serenity {
tag.failures = "true"
linked.tags = "issue"
restart.browser.for.each = scenario
}
drivers {
windows {
webdriver.chrome.driver = src/test/resources/webdriver/windows/chromedriver.exe
}
mac {
webdriver.chrome.driver = src/test/resources/webdriver/mac/chromedriver
}
linux {
webdriver.chrome.driver = src/test/resources/webdriver/linux/chromedriver
}
}
Related
The docs says I can set the kernel parameters using sysctl for a docker task like so:
config {
sysctl = {
"net.core.somaxconn" = "16384"
}
}
This indeed works. But when I tried,
sysctl = {
"net.core.somaxconn" = "16384"
"net.core.rmem_default" = 134217728
"net.core.rmem_max" = 134217728
"net.core.wmem_default" = 134217728
"net.core.wmem_max" = 134217728
"vm.max_map_count" = 1000000
}
I'm getting the following error.
Sep 28, '22 19:30:22 +0530
Driver Failure
Failed to start container fa2179c3fbfe0a216e457449cfb72a78e08c0be45f10ba9596004fbfc51e5cac: API error (400):
failed to create shim task: OCI runtime create failed:
runc create failed:
unable to start container process:
error during container init:
open /proc/sys/net/core/rmem_default:
no such file or directory: unknown
I couldn't find anywhere in the docs what are the allowed parameters to set using this config.
I spent the whole day banging my head on this issue.
Please let me know if any more info is needed.
In case you are curious I'm trying to run Solana devnet validator as a container in Nomad.
open /proc/sys/net/core/rmem_default: no such file or directory: unknown
There is just no such sysctl parameter inside docker container when it is running inside network namespace. That's unrelated to nomad. See https://github.com/moby/moby/issues/42282 follow https://github.com/moby/moby/issues/30778 etc.
It is possible to run processes for the Nomad raw_exec driver inside a task as non-root users? Ideally want to run nomad as root and then do drop privileges to run a command as the target user:
job "show_id_job" {
datacenters = ["dc1"]
priority = 100
type = "batch"
constraint {
attribute = "${attr.unique.hostname}"
value = "myhost.company.com"
}
group "show_id_group" {
network {
mode = "host"
}
task "show_id" {
driver = "raw_exec"
config {
command = "/usr/bin/su"
args = ["--login", "regularuser", "/usr/bin/id"]
}
}
}
}
But when I run this job it fails:
Oct 23 19:51:03 myhost.company.com nomad[300160]: client: allocation updates applied: added=0 removed=0 updated=4 ignored=4 errors=0
Oct 23 19:51:03 myhost.company.com su[385531]: pam_unix(su-l:session): session closed for user regularuser
Oct 23 19:51:03 myhost.company.com nomad[300160]: 2020-10-23T19:51:03.822-0400 [ERROR] client.driver_mgr.raw_exec: error receiving stream from Stats executor RPC, closing stream: alloc_id=fbe2e6d9-930e-acff-83c7-9d0f83b2e085 driver=raw_exec task_name=show_id error="rpc error: code = Unavailable desc = transport is closing"
Oct 23 19:51:03 myhost.company.com nomad[300160]: 2020-10-23T19:51:03.822-0400 [ERROR] client.alloc_runner.task_runner.task_hook.stats_hook: failed to start stats collection for task: alloc_id=fbe2e6d9-930e-acff-83c7-9d0f83b2e085 task=show_id error="rpc error: code = Canceled desc = grpc: the client connection is closing"
I could not find in the documentation any parameters that could allow me to do the same
Has anyone run into this issue?
Thanks!
It is not possible with raw_exec (documentation says it is supported with driver=docker or driver=exec). You can also run nomad as a non-privileged user.
library(IBrokers)
tws <- twsConnect(port=7496)
Error in socketConnection(host = host, port = port, open = "ab", blocking = blocking) :
cannot open the connection
In addition: Warning message:
In socketConnection(host = host, port = port, open = "ab", blocking = blocking) :
localhost:7496 cannot be opened
I have checked my Global Configurations in the TWS. The port is in fact 7496.
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] IBrokers_0.9-12 xts_0.12-0 zoo_1.8-8
loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3 grid_3.6.3 lattice_0.20-40
I am using the latest of Linux Mint. My IB account has been approved and funded.
I'm trying to write a stand alone jython JMX client to monitor WebSphere Application Server. It connects to the DMGR using SOAP and SSL.
The code works when running it w/ WSADMIN, but fails when trying to run it as a stand alone jython client. This makes me believe the code is correct and that I'm missing a JAR or configuration file when trying to run it as a stand alone client. Also, this works w/ SSL disabled.
I have the following questions:
How can I establish the connection with security enabled (so with SSL)?
How can I make my client run from another machine? (which jars are needed?)
WAS Version:
7.0.0.21 ND on Solaris
import java.util.Properties as Properties
import javax.management.ObjectName as ObjectName
import com.ibm.websphere.management.AdminClient as AdminClient
import com.ibm.websphere.management.AdminClientFactory as AdminClientFactory
class DeploymentManager:
def __init__(self, host, soapport, user, password):
self.host = host
self.soapport = soapport
self.user = user
self.password = password
def create_admin_client(dmgrhost, dmgrsoapport, user, password):
props = Properties()
props.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP)
props.setProperty(AdminClient.CONNECTOR_HOST, dmgrhost)
props.setProperty(AdminClient.CONNECTOR_PORT, dmgrsoapport)
props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
props.setProperty(AdminClient.USERNAME, user);
props.setProperty(AdminClient.PASSWORD, password);
props.setProperty("javax.net.ssl.trustStore",
"/opt/IBM/Profiles/dmgr01/etc/DummyClientTrustFile.jks");
props.setProperty("javax.net.ssl.keyStore",
"/opt/IBM/Profiles/dmgr01/etc/DummyClientKeyFile.jks");
adminClient = AdminClientFactory.createAdminClient(props)
return adminClient
def get_servers():
servers = [s for s in adminClient.queryNames(queryName, None).toArray()]
return servers
def get_server_states(servers):
serverstates = {}
for server in servers:
name = adminClient.getAttribute(server, "name")
pid = adminClient.getAttribute(server, "pid")
state = adminClient.getAttribute(server, "state")
serverstates[name] = {'name' : name, 'state' : state, 'pid' : pid}
return serverstates
DMGRs = []
DMGRs.append(DeploymentManager('dmgr1_host', 'dmgr1_soap_port', 'dmgr1_user', 'dmgr1_pw'))
DMGRs.append(DeploymentManager('dmgr2_host', 'dmgr2_soap_port', 'dmgr2_user', 'dmgr2_pw'))
DMGRs.append(DeploymentManager('dmgr3_host', 'dmgr3_soap_port', 'dmgr3_user', 'dmgr3_pw'))
for DMGR in DMGRs:
adminClient = create_admin_client(DMGR.host, DMGR.soapport, DMGR.user, DMGR.password)
queryName = ObjectName("WebSphere:*,node=*,type=Server,name=srv*")
servers = get_servers()
serverstates = get_server_states(servers)
print '## %s ##' % DMGR.host
keys = serverstates.keys()
keys.sort()
for key in keys:
print '%s %s: %s' % (serverstates[key]['name'],
serverstates[key]['pid'],
serverstates[key]['state'])
print
Here's the error I see when I run it:
jython -Dpython.path=/opt/IBM/WebSphere/AppServer/runtimes/com.ibm.ws.admin.client_7.0.0.jar:/opt/IBM/WebSphere/AppServer/plugins/com.ibm.ws.security.crypto.jar:/opt/IBM/WebSphere/AppServer/plugins/com.ibm.ws.runtime.jar -Dcom.ibm.SOAP.ConfigURL=/opt/IBM/Profiles/dmgr01/properties/soap.client.props was_common.py
Apr 16, 2012 3:07:39 PM com.ibm.ws.management.connector.interop.JMXClassLoader
WARNING: Could not find tmx4jTransform.jar in null/etc/tmx4jTransform.jar - Interoperability to older versions of WebSphere is disabled
Apr 16, 2012 3:07:40 PM com.ibm.ws.ssl.config.SSLConfigManager
INFO: ssl.disable.url.hostname.verification.CWPKI0027I
Apr 16, 2012 3:07:40 PM com.ibm.ws.security.config.SecurityObjectLocator
INFO: Client code attempting to load security configuration
Traceback (most recent call last):
File "was_common.py", line 56, in <module>
adminClient = create_admin_client(DMGR.host, DMGR.soapport, DMGR.user, DMGR.password)
File "was_common.py", line 30, in create_admin_client
adminClient = AdminClientFactory.createAdminClient(props)
at com.ibm.websphere.management.AdminClientFactory.createAdminClientPrivileged(AdminClientFactory.java:632)
at com.ibm.websphere.management.AdminClientFactory.access$000(AdminClientFactory.java:123)
at com.ibm.websphere.management.AdminClientFactory$1.run(AdminClientFactory.java:206)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
at com.ibm.websphere.management.AdminClientFactory.createAdminClient(AdminClientFactory.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
com.ibm.websphere.management.exception.ConnectorException: com.ibm.websphere.management.exception.ConnectorException: ADMC0016E: The system cannot create a SOAP connector to connect to host dmgr1_host at port dmgr1_soap_port
Note: I changed some values in this example to generic values.
I have no idea what I do wrong. I would like to use selenium-RC plugin for Grails to do some functional testing. I have created sample test using build-in script (i guess add-selenium-test), which generated (i modified it slighty):
import grails.plugins.selenium.*
import org.junit.*
import static org.junit.Assert.*
import static org.hamcrest.Matchers.*
#Mixin(SeleniumAware)
class FirstTestTests {
#Before void setUp() {
}
#After void tearDown() {
super.tearDown()
}
#Test void something() {
selenium.open "/activate"
assertTrue selenium.isTextPresent("activate")
}
}
I configured SeleniumConfig
selenium {
slow = false // true to run tests in slow resources mode
singleWindow = true // true for single window mode, false for multi-window mode
browser = "*firefox" // can include full path to executable, default value is *firefox or *iexplore on Windows
url = "http://localhost:8080" // the base URL for tests, defaults to Grails server url
defaultTimeout = 3000 // the timeout after which selenium commands will fail
windowMaximize = true // true to maximize browser on startup
screenshot {
dir = "./target/test-reports/screenshots" // directory where screenshots are placed relative to project root
onFail = true // true to capture screenshots on test failures
}
server {
host = "localhost" // the host the selenium server will run on
port = 4444 // the port the selenium server will run on
}
userExtensions = "" // path to user extensions javascript file
}
and I then I typed
grails test-app :selenium
and it seems that everything is done correctly:
INFO 19:30:08,304 RemoteWebDriver instances should connect to: http://127.0.0.1:
4444/wd/hub org.openqa.selenium.server.SeleniumServer
Starting Selenium server on port 4444 ...
INFO 19:30:08,312 Version Jetty/5.1.x org.openqa.jetty.http.HttpServer
INFO 19:30:08,315 Started HttpContext[/selenium-server/driver,/selenium-server/d
river] org.openqa.jetty.util.Container
INFO 19:30:08,318 Started HttpContext[/selenium-server,/selenium-server] org.ope
nqa.jetty.util.Container
INFO 19:30:08,321 Started HttpContext[/,/] org.openqa.jetty.util.Container
INFO 19:30:08,326 Started org.openqa.jetty.jetty.servlet.ServletHandler#55881a8f
org.openqa.jetty.util.Container
INFO 19:30:08,328 Started HttpContext[/wd,/wd] org.openqa.jetty.util.Container
INFO 19:30:08,338 Started SocketListener on 0.0.0.0:4444 org.openqa.jetty.http.S
ocketListener
INFO 19:30:08,340 Started org.openqa.jetty.jetty.Server#42aefb01 org.openqa.jett
y.util.Container
Starting Selenium session for http://localhost:8080 ...
INFO 19:30:08,502 Checking Resource aliases org.openqa.jetty.util.Credential
INFO 19:30:08,510 Command request: getNewBrowserSession[*firefox, http://localho
st:8080, ] on session null org.openqa.selenium.server.SeleniumDriverResourceHand
ler
INFO 19:30:08,512 creating new remote session org.openqa.selenium.server.Browser
SessionFactory
INFO 19:30:08,586 Allocated session 9250557308cc4886a25100eb6c5f3d7e for http://
localhost:8080, launching... org.openqa.selenium.server.BrowserSessionFactory
INFO 19:30:08,717 Preparing Firefox profile... org.openqa.selenium.server.browse
rlaunchers.FirefoxChromeLauncher
INFO 19:30:11,726 Launching Firefox... org.openqa.selenium.server.browserlaunche
rs.FirefoxChromeLauncher
The firefox window is opened, but nothing loads and nothing seems to proceed. Do I miss something?
Sounds to me like an incompatibility between the Selenium RC plugin and the current version of your web browser. You might want to dig into the plugin's dependencies and update everything to the latest versions if you're using a newer version of the browser.
We see this with Geb ( http://www.gebish.org ) when trying to run a webdriver version that is not compatible with the driver version.
Just to add, if you use Chrome and your OS is Ubuntu, then make sure you put the full path to Chrome and make sure that the executable path references chromium-browser and NOT google-chrome.
So your SeleniumConfig should look like this with the relevant line in double asterisks:
selenium {
slow = false
singleWindow = true
**browser = "*googlechrome /usr/bin/chromium-browser"**
url = null
defaultTimeout = 60000
windowMaximize = false
screenshot {
dir = "./target/test-reports/screenshots"
onFail = false
}
server {
host = "localhost"
port = 4444
}
userExtensions = ""
}