You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I have a test to make sure the application provides a proper error if it can not access a file. To do so, the test changes the file permission, that it runs the application and checks the error.
Something like:
public void permissions() {
String file = prepareFiles(); // let's say this creates a file /tmp/myfiles/filetocheck
Path path = Paths.get(file).getParent();
Files.setPosixFilePermissions(path, PosixFilePermissions.fromString("---------"));
MyApp.main();
thenLogContains("no access to " + file + ": java.nio.file.AccessDeniedException")
}
It works locally, but when it runs in the BitBucket pipeline, it fails because permissions have not been changed. Has anybody ran into the same problem? Any solution?
Hello @stefanofornari and welcome to the Community!
Have you tried testing it locally inside a docker container ? I ask this because bitbucket pipelines run inside a docker container, so testing it locally with docker closely reproduces the pipeline environment and it can help identify if the issue is with the pipelines itself or with the code/image you are using.
If you haven't already, I would suggest following the instructions in the article below to debug it locally using the same image you are using in pipelines:
Let us know in case you have any questions.
Thank you, @stefanofornari !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.