星期四, 6月 20, 2019

SonarQube method-level complexity

After SonarQube 6.7, file-level complexity still calculated, but method-level complexity gone. The opinion of SonarQube team is Complexity is displayed as a Code Smell. If you still wish to investigate the complexity of your project in method-level, combine those filter:
  • Type: Code Smell
  • Severity: Critical
  • Tag: brain-overload

星期五, 5月 17, 2019

Update old OpenSSH default DH key size

For Windows 2000, setupssh371-20031015.exe sholud be a good choice for SSH Server / Client. But when connecting to Jenkins as a SSH Publisher, Jenkins complained that DH key size 2047 not valid. How to fix it? Generate by yourself:
  • cd "C:\Program Files\OpenSSH\bin"
  • ssh-keygen -G moduli-2048.candidates -b 2048
  • (wait)
  • ssh-keygen -T moduli-2048 -f moduli-2048.candidates
  • (wait)
  • move moduli-2048 ..\etc\moduli
  • del moduli-2048.candidate

星期二, 5月 14, 2019

New Selenium Node (Chrome / Firefox) on CentOS without GUI

  • Assume Selenium Hub listen on docker host 172.17.0.1:4444
  • docker (refer this)
  • docker-compose (refer this)
  • docker-compose.yml (updated from here)
    • version: "3"
    • services:
      • chrome:
        • image: selenium/node-chrome:3.141.59-neon
        • volumes:
          • - /dev/shm:/dev/shm
        • environment:
          • - HUB_HOST=172.17.0.1
          • - HUB_PORT=4444
          • - REMOTE_HOST=http://<Host_or_IP>:6666
          • - NODE_MAX_INSTANCES=5
        • ports:
          • - "6666:5555"
      • firefox:
        • image: selenium/node-firefox:3.141.59-neon
        • volumes:
          • - /dev/shm:/dev/shm
        • environment:
          • - HUB_HOST=172.17.0.1
          • - HUB_PORT=4444
          • - REMOTE_HOST=http://<Host_or_IP>:7777
          • - NODE_MAX_INSTANCES=5
        • ports:
          • - "7777:5555"

星期三, 4月 24, 2019

Quick Start: Selenium Grid

How can we create a Selenium Grid Environment quickly? If you have docker-compose already, just refer this, save as docker-compose.yml, and run "docker-compose up -d" to start it. That's all.

How to prove it worked? we need:
  • selenese-runner.jar download from here
  • check your docker host ip address like "ip addr | grep docker0"
  • any workable side file
If selenese-runner.jar and my.side in the current directory, start another docker container:
  • docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp openjdk java -jar selenese-runner.jar --driver remote --remote-url http://<DOCKER_HOST_IP>:4444/wd/hub --remote-browser <BROWSER> <WORKABLE.side>
<BROWSER> can be chrome or firefox.

星期二, 4月 16, 2019

CentOS7, Firewalld and Docker

In the past, I always stop firewalld for Docker. But it's not secured. According to this, if we update firewalld version to 0.4.3.2-9 can fix this, or running these command:
  • nmcli connection modify docker0 connection.zone trusted
  • systemctl stop NetworkManager.service
  • firewall-cmd --permanent --zone=trusted --change-interface=docker0
  • systemctl start NetworkManager.service
  • nmcli connection modify docker0 connection.zone trusted
  • systemctl restart docker.service

星期四, 4月 11, 2019

Jenkins fake warning about Subversion

If a Jenkins job correspond to Subversion, when checking config, maybe you will see this warning:
  • Unable to access the repository
Don't worry, this could be a fake warning, if you check Jenkins log and found something like:
  • SEVERE hudson.scm.SubversionSCM$ModuleLocation$DescriptorImpl checkCredentialsId
  • svn: E200015: Authentication cancelled

星期五, 3月 29, 2019

selenese runner can't nesting while end loop

Consider this code snippet:
  • execute script | return 2; | i
  • while | ${i} > 0 |
    • execute script | return 3; | j
    • while | ${j} > 0 |
      • echo | i: ${i}, j: ${j} |
      • execute script | return ${j} - 1; | j
    • end | |
    • execute script | return ${i} - 1; | i
  • end | |
It works fine in Selenium IDE with output:
  • i: 2, j: 3
  • i: 2, j: 2
  • i: 2, j: 1
  • i: 1, j: 3
  • i: 1, j: 2
  • i: 1, j: 1
But selenese runner missing some output, just:
  • i: 2, j: 3
  • i: 2, j: 2
  • i: 2, j: 1
  • i: 1, j: 3
How can we avoid this inconsistent? this code snippet should be ok:
  • execute script | return 2; | i
  • do | |
    • execute script | return 3; | j
    • do | |
      • echo | i: ${i}, j: ${j} |
      • execute script | return ${j} - 1; | j
    • repeat if | ${j} > 0 |
    • execute script | return ${i} - 1; | i
  • repeat if | ${i} > 0 |
[2019/03/30]
This bug was fixed at version 3.22.0, see here.