I have a project which has two folders on same level
/home/ishan/my_repo/jenkins_test/business_logic
/home/ishan/my_repo/jenkins_test/test_cases
test_cases has two files test_fib and test_fact
when I run nosetests --exe at /home/ishan/my_repo/jenkins_test/ it runs correctly showing
....
----------------------------------------------------------------------
Ran 4 tests in 0.036s
OK
I am trying to run these test cases so, I created following script at /home/ishan/my_repo
#!/bin/bash
source /home/ishan/venv/bin/activate
nosetests --exe /home/ishan/sf_shared/my_repo/jenkin_test/
deactivate
When I run it using
source /home/ishan/my_repo/test_runner.sh it shows correct output.
So, I tried to put it in jenksins build step. So, I added the same line
source /home/ishan/my_repo/test_runner.sh in command section of Execute Shell in jenkins.
Now, when I trigger the build using build now it fails saying
Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/jenkins_test
[jenkins_test] $ /bin/sh -xe /tmp/hudson5020664150857393715.sh
+ source /home/ishan/sf_shared/test_runner.sh
/tmp/hudson5020664150857393715.sh: 2: /tmp/hudson5020664150857393715.sh: source: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I think it doesn't even execute any test cases. It fails long before.
Can you suggest what am I doing wrong?
Maybe this will works:
/home/ishan/venv/bin/nosetests --exe /home/ishan/sf_shared/my_repo/jenkin_test/
Resolved it, issue was with the following line
source /home/ishan/venv/bin/activate
I replaced it source with standard . then it worked. So, my line became
. /home/ishan/venv/bin/activate
Related
I got a lambda written in Go running on a container, the image was built with alpine-golang and run with alpine.
When testing i noticed from the logs the lambda is ran twice before exiting with the following:
Error: Runtime exited without providing a reason Runtime.ExitError
From my local system this the code runs fine without errors, i earlier tried running without a container but still faced runtime issues. The only error handling and logging mechs in my code is log.Println and fmt.Printf. Anyone got an idea of what is going on?
EDIT:
I trapped the exit code, which is turns out to be 0 but lambda exits with
Runtime exited with error: exit status 1 Runtime.ExitError
I really suggest going for the "without container" path. Just pack your executable into a .zip archive. Don't forget to compile with GOOS=linux for your code to be compatible with AWS Lambda.
On Linux you can use the following commands to get your archive:
GOOS=linux go build -o executableName path/to/main.go
zip archive.zip executableName
Note that you have to set Handler to be executableName in function's Runtime settings.
For handling lambda function, you have to use github.com/aws/aws-lambda-go/lambda package and in main start the handler function like lambda.Start(handler).
Full code example:
package main
import (
"context"
"log"
"github.com/aws/aws-lambda-go/lambda"
)
func main() {
lambda.Start(handler)
}
func handler(ctx context.Context) {
log.Println("successfully executed")
}
Make sure you are following the recommended guide lines aws provide with building the container image. https://docs.aws.amazon.com/lambda/latest/dg/go-image.html
your Dockerfile should look like this to work with lambda,
FROM public.ecr.aws/lambda/provided:al2 as build
# install compiler
RUN yum install -y golang
RUN go env -w GOPROXY=direct
# cache dependencies
ADD go.mod go.sum ./
RUN go mod download
# build
ADD . .
RUN go build -o /main
# copy artifacts to a clean image
FROM public.ecr.aws/lambda/provided:al2
COPY --from=build /main /main
ENTRYPOINT [ "/main" ]
Lambda is very strange where if you have the Dockerfile like you would on a local machine then it runs it once, ends, then a second time and crashes with no reason given
I have a bash script that runs my tests:
#!/bin/bash
coverage run --source='directory_for_coverage' manage.py test
coverage report --fail-under=87
but when I run the script it only returns an error code if the coverage fails, not if one of the tests fails. I would think that because I am not using the --ignore-errors switch that coverage run should return the error code from the failing test. What am I missing?
I solved this by adding a set -e command to my script:
#!/bin/bash
set -e
coverage run --source='directory_for_coverage' manage.py test
coverage report --fail-under=87
Thank you, it worked for me !
The help set command give some details:
-e Exit immediately if a command exits with a non-zero status.
I try to learn DPDK using the following link: https://doc.dpdk.org/guides/prog_guide/build_app.html
I have downloaded DPDK 19.11.1 version in Ubuntu 16 virtual machine. Then unzipped the tar.gz file. Then I have given the following commands
~/DPDK$ cd examples/helloworld/
~/DPDK/examples/helloworld$ export RTE_SDK=/home/vijay/dpdk
~/DPDK/examples/helloworld$ export RTE_TARGET=x86_64-native-linuxapp-gcc
~/DPDK/examples/helloworld$ make
The following error is displayed:
/home/vijay/dpdk/mk/internal/rte.extvars.mk:29 cannot find .config in /home/vijay/dpdk/build. stop
If I put sudo make, the following error is displayed
Makefile:44: *** "Please define RTE_SDK environment variable". stop
When I put echo $RTE_SDK and echo $RTE_TARGET the values are printed correctly. I tried x86_64-native-linux-gcc for RTE_TARGET also.
I tried multiple times and referred to different sources. Not sure whether I miss any steps in the process. What can I try next?
Based on the error logs, it looks like you have not built dpdk libraries in the desired target folder. To do it correctly
cd dpdk-main-folder
export RTE_SDK=$PWD
export RTE_TARGET=x86_64-native-linuxapp-gcc
make config T=$RTE_TARGET O=$RTE_TARGET
cd $RTE_TARGET
make -j 10
With these done go to your desired example and execute make
I am trying to compile the Minko framework on Windows 10 targeted at HTML. However, I'm hitting an error running the build_html5.bat script.
I've followed the instructions and completed all the steps (except for moving from the main branch to the dev branch, which is listed as optional). I cloned the source, set the new Environment Variable, ran the install_emscripten.bat file, and ran the specified commands in the emscripten command prompt.
However, when I try to run the build_html5.bat script, I get the following error:
I've looked in the MINKO_HOME directory and was able to find the jsoncpp.cpp file, but the jsoncpp.o file is not where in the directory specified in the command being called. The only file in MINKO_HOME/framework/obj/html5/release is a file named 'linker.rsp'.
I tried pulling down the dev branch into a different directory and updating the MINKO_HOME variable accordingly. I couldn't find the tool directory, but I was able to run the script scripts/solution_gmake_full.bat, after my first error trying to run build_html5_full.bat. When trying to run build_html5_full.bat, however, I get a different error:
Am I missing something here? Any help would be appreciated!
Sincerely,
Alex
I'm trying to add a new test case to existing test org.codehaus.groovy.grails.web.mapping.ReverseUrlMappingTests in grails-test-suite-web submodule of grails-core project.
https://github.com/grails/grails-core/blob/master/grails-test-suite-web/src/test/groovy/org/grails/web/mapping/ReverseUrlMappingTests.groovy
I have a problem with running single test case using Gradle. When I do:
./gradlew -Dtest.single=ReverseUrlMappingTests :grails-test-suite-web:test
It ends with:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> Could not find matching test for pattern: ReverseUrlMappingTests
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
This test can be run in full test cycle ./gradlew test but it's waste of the time when we wanna red-green-refactor only one simple test case. I also noticed that the same problem occurs when I try to run in the same manner spock.lang.Specification subclass test.
Here's my question: is it possible to run single grails-core test with Gradle?
It's grails-core 2.4.x branch clone
The question has been edited to indicate that the test is on the 2.4.x branch, which affects the answer. I have made relevant changes below.
Something like this will work...
./gradlew :g-t-s-w:test --tests *ReverseUrlMappingTests*
When you do that, you are still going to be running some other tests because of the way our build is written. If you want to get rid of them you can comment out the following:
test.dependsOn execIsolatedTests
That is in grails-test-suite-web/build.gradle at https://github.com/grails/grails-core/blob/644233cfff266f391c44ef3ec56036a3b1c9bb19/grails-test-suite-web/build.gradle#L98
You could also do something like this...
./gradlew -DsingleTest.single=ReverseUrlMappingTests grails-test-suite-web:singleTest