Skip to content

Commit

Permalink
[builder] fix the TestGenerateInvalidOutputPath (#10595)
Browse files Browse the repository at this point in the history
If the test is executed with the `root` user, the
`TestGenerateInvalidOutputPath` test fails.
The behaviour was noticed with a GitLab runner that was executed with
root rights.

An attempt is made to create the directory `/:invalid` during the test.
A user without root rights receives the message `cannot create directory
'/:invalid': Permission denied`.
In contrast, the `root` user can create the directory without any
problems because this is a valid path.

To correct the behaviour of the test, the path to `:/invalid` was
adjusted.
This is not a valid path under Windows or Linux.

Signed-off-by: Andrej Giesbrecht <[email protected]>
  • Loading branch information
giesan authored Aug 8, 2024
1 parent 2c9229d commit b521ed4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/builder/internal/builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestGenerateDefault(t *testing.T) {

func TestGenerateInvalidOutputPath(t *testing.T) {
cfg := newInitializedConfig(t)
cfg.Distribution.OutputPath = "/:invalid"
cfg.Distribution.OutputPath = ":/invalid"
err := Generate(cfg)
require.Error(t, err)
require.Contains(t, err.Error(), "failed to create output path")
Expand Down

0 comments on commit b521ed4

Please sign in to comment.