I have a normal Quarkus Restassured Test working very fine locally on my workstation:
#Test
public void testHelloEndpoint() {
given()
.when().get("/ifc")
.then()
.statusCode(200)
.body(containsString("hello"));
}
however, when I run this on Gitlab CI withing a docker container from image image: maven:3.6.3-jdk-11 it hangs. I suppose, the Tests wants to connect to locahost:8081 internally of the container, which does not work.
How to solve this?
gitlab-ci:
image: maven:3.6.3-jdk-11
variables:
MAVEN_CLI_OPTS: "-s m2-settings.xml --batch-mode"
#MAVEN_CLI_OPTS: ""
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
cache:
paths:
#- .m2/repository/
#- target/
build:
stage: build
script:
- mvn $MAVEN_CLI_OPTS compile
test:
stage: test
script:
- java --version
- mvn $MAVEN_CLI_OPTS install
deploy:
stage: deploy
script:
- mvn $MAVEN_CLI_OPTS deploy
only:
- master
when: manual
When I run the same docker image locally (not gitlab) I see the following errors:
[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 61.157 s <<< FAILURE! - in ch.siemens.bt.ifc.ResourceTest
[ERROR] testGenerateEndpoint Time elapsed: 0.073 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
[ERROR] testTransformEndpoint Time elapsed: 0.001 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class io.quarkus.test.common.RestAssuredURLManager
[ERROR] testHelloEndpoint Time elapsed: 0.001 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class io.quarkus.test.common.RestAssuredURLManager
I have realised that using the image quay.io/quarkus/centos-quarkus-maven:20.0.0-java11 works. I don't see why - because I am not doing native builds.
Related
I trying to integrate my Solution based on .net6 with SonarCloud and Github actions.The problem is that the action build failed on the sonar scanner end.I tried to change working dirs but with the same effect.The project is public HERE
The SonarScanner for MSBuild integration failed: SonarCloud was unable to collect the required information about your projects.
Possible causes:
The project has not been built - the project must be built in between the begin and end steps
An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
The begin, build and end steps have not all been launched from the same folder
None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln) SonarScanner for MSBuild 5.7.2 Using
the .NET Core version of the Scanner for MSBuild Post-processing
started. 10:38:06.016 Generation of the sonar-properties file failed.
Unable to complete the analysis. 10:38:06.024 Post-processing failed.
Exit code: 1 Error: Process completed with exit code 1.
name: build-all
# Controls when the action will run.
on:
push:
branches:
- main
env:
DOTNET_VERSION: 6.0.x
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-windows:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout#v2
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- uses: actions/setup-dotnet#v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: microsoft/setup-msbuild#v1
- uses: actions/setup-java#v2
with:
distribution: 'adopt'
java-version: '11'
- name: Restore NuGet packages
run: |
cd App
nuget restore App.sln
- name: Begin Sonar scan
run: |
cd App
dotnet tool install --global dotnet-sonarscanner
dotnet sonarscanner begin /o:vladimirpetukhov /k:vladimirpetukhov_Musement_CLI /d:sonar.login=${{ secrets.SONAR_TOKEN }} /d:sonar.host.url=https://sonarcloud.io
- name: Build Api
run: |
cd ./App/App.API
dotnet build App.API.csproj --no-restore
# dotnet test App.API.csproj --no-build --no-restore --verbosity normal -p:CollectCoverage=true -p:CoverletOutputFormat=opencover
- name: Build Main
run: |
cd ./App/App.Main
dotnet build App.Main.csproj --no-restore
# dotnet test App.Main.csproj --no-build --no-restore --verbosity normal -p:CollectCoverage=true -p:CoverletOutputFormat=opencover
- name: End Sonar scan
run: |
cd App
dotnet sonarscanner end /d:sonar.login=${{ secrets.SONAR_TOKEN }}
docker-compose yml
version: "3"
services:
chrome:
image: selenium/node-chrome:4.1.3-20220327
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
edge:
image: selenium/node-edge:4.1.3-20220327
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
firefox:
image: selenium/node-firefox:4.1.3-20220327
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
selenium-hub:
image: selenium/hub:4.1.3-20220327
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
gitlab yml file
variables:
MAVEN_OPTS: -Dmaven.repo.local=.m2/repository
.base:
except:
- tags
.base_test:
extends: .base
tags:
- docker-in-docker
image: docker/compose:latest
services:
- name: docker:dind
before_script:
- docker-compose up
stages:
- build
- test
cache:
paths:
- .m2/repository
- target
build:
image: maven:latest
stage: build
script:
- mvn clean
tags:
- docker-in-docker
test:
image: maven:latest
stage: test
script:
- mvn test
tags:
- docker-in-docker
artifacts:
paths:
- ./TestReport/*
expire_in: 7 days
Remote url in test script
ChromeOptions options = new ChromeOptions();
options.setCapability("se:recordVideo", true);
driver = new RemoteWebDriver((new URL("http://docker:4444/wd/hub")), options);
Pipeline error when executing the stage : test
/root/.cache/selenium/chromedriver/linux64/100.0.4896.60/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
selectTemplateTest2 started!
selectTemplateTest2 skipped!
Extent Reports Version 3 Test Suite is ending!
[ERROR] Tests run: 3, Failures: 2, Errors: 0, Skipped: 1, Time elapsed: 1.7 s <<< FAILURE! - in TestSuite
[ERROR] init(templateTest.TemplateSelectorTest2) Time elapsed: 1.473 s <<< FAILURE!
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Caused by: org.openqa.selenium.WebDriverException:
Driver server process died prematurely.
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'runner-5ahk-ct-project-4846-concurrent-0', ip: '172.18.0.12', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-105-generic', java.version: '17.0.2'
Driver info: driver.version: ChromeDriver
[ERROR] tearDown(templateTest.TemplateSelectorTest2) Time elapsed: 0.006 s <<< FAILURE!
java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.WebDriver.quit()" because "this.driver" is null
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] TemplateSelectorTest2>WorkspaceAppTestBase.init:43->TestBase.initialize:42 » SessionNotCreated
[ERROR] TemplateSelectorTest2>WorkspaceAppTestBase.tearDown:57->TestBase.browserTearDown:57 » NullPointer
Can someone please help me fix this Gitlab pipeline issue?
I have set Gitlab pipeline to run selenium tests with grid setup using docker-compose yml file but it seems remoteWebdriver url connection is not working with grid setup
Locally it works fine when i have docker running , docker compose up and then run the testng xml file
Solution:
Update
gitlab yml file
variables:
MAVEN_OPTS: -Dmaven.repo.local=.m2/repository
stages:
- build
- test
cache:
paths:
- .m2/repository
- target
build:
image: docker/compose:latest
stage: build
services:
- name: docker:dind
script:
- docker-compose up -d
tags:
- docker-in-docker
test:
image: maven:latest
stage: test
script:
- mvn test
tags:
- docker-in-docker
artifacts:
paths:
- ./TestReport/*
expire_in: 7 days
Then for cannot create new session error, i had to provide reference to oreganization specific remote url in browser initialization file
This error message...
/root/.cache/selenium/chromedriver/linux64/100.0.4896.60/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
...implies that there was an error loading the shared library libnss3.so and possibly it is outdated or wasn't installed at all.
Solution
Install libnss as follows:
sudo apt-get install
apt install libnss
apt install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev
As an alternative you can also:
sudo apt install libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev
Update
Search for the packages:
apt-cache search libnss
apt-file search libnss3.so
Link to Packages: Package Search Results
tl; dr
[BUG] Failed to launch the browser process: error while loading shared libraries: libnss3.so: cannot open shared object file
Error: Rollup failed to resolve import "vue-router" when vite build in bitbucket
bitbucket-pipelines.yml
image: node:16
pipelines:
branches:
master:
- step:
name: install
caches:
- node
script:
- npm i
- step:
name: build
caches:
- node
script:
- npm run build
artifacts: # defining the artifacts to be passed to each future step
- dist/**
- step:
name: Deploy to Serve
deployment: Production
script:
- pipe: atlassian/sftp-deploy:0.5.5
variables:
USER: $FTP_USERNAME
SERVER: $FTP_HOST
REMOTE_PATH: $FTP_SITE_ROOT
PASSWORD: $SFTP_PASSWORD
LOCAL_PATH: $BITBUCKET_CLONE_DIR/dist/*
DEBUG: 'true'
error informations:
vite]: Rollup failed to resolve import "vue-router" from "src/router/index.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
error during build:
Error: [vite]: Rollup failed to resolve import "vue-router" from "src/router/index.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
at onRollupWarning (/opt/atlassian/pipelines/agent/build/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:43253:19)
at onwarn (/opt/atlassian/pipelines/agent/build/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:43037:13)
at Object.onwarn (/opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:23003:13)
at ModuleLoader.handleResolveId (/opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:22347:26)
at /opt/atlassian/pipelines/agent/build/node_modules/rollup/dist/shared/rollup.js:22319:26
I'm not able to execute tests using the CLI. The runner works. I'm using version 0.9.5.RC5 with maven command: " mvn test -f pom.xml exec:java -Dexec.mainClass=com.intuit.karate.cli.Main -Dexec.args='-d' -Dexec.classpathScope=test"
Here is the error:
ERROR com.intuit.karate - driver config / start failed: failed to construct class by name: karate-http.properties not found, aborting, options: {type=chrome, target=null}
I java karate-apache, karate-core and karate-junit4 as dependencies. The java version is 13
We don't yet support Java > 12: https://github.com/intuit/karate/tree/develop#getting-started
EDIT: use Karate 1.0
The branch was previously functional, then merged to master and the builds on master failed. Master was reverted, then master was merged into this branch and some fixes were made. When attempting to merge back to master, the build failed again with the following error. The push passed, the pr failed.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.squareup.leakcanary:leakcanary-android:1.5.4.
The travis.yml file:
sudo: false
language: android
android:
components:
- build-tools-27.0.2
- android-27
- sys-img-armeabi-v7a-android-27
jdk:
- oraclejdk8
before_install:
- yes | sdkmanager "platforms;android-27"
- chmod +x gradlew
#First app is built then unit tests are run
jobs:
include:
- stage: build
async: true
script: ./gradlew assemble
- stage: test
async: true
script: ./gradlew -w runUnitTests
notifications:
email:
recipients:
- email#me.com
on_success: always # default: change
on_failure: always # default: always
I felt maven repo outage today and faced the same issue. Hours later, I found that the failed Travis Job is working fine now. Do check it at your side.
Also, For any given scenario when classpath dependencies are missing one should check the build.gradle file rather than the .travis.yml file.
The failure message says that the app:debugCompileClasspath task is failing when looking for the com.squareup.leakcanary:leakcanary-android:1.5.4 (jar or AAR). Gradle allows you to define the repositories at the the root level
allProjects{
repositories {
maven() //Gradle has definition the points to https://jcenter.bintray.com/
}
}
So it will look into the following places for the class files or jar file.
Name: $ANDROID_HOME/extras/m2repository; url: file:/$ANDROID_HOME/extras/m2repository/
Name: $ANDROID_HOME/extras/google/m2repository; url: $ANDROID_HOME/extras/google/m2repository/
Name: $ANDROID_HOME/extras/android/m2repository; url: file:$ANDROID_HOME/extras/android/m2repository/
Name: BintrayJCenter; url: https://jcenter.bintray.com/
If not found the dependency resolution will fail giving the error mentioned above.