Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start:bugfix wrong interpretation of subversion of docker #1156

Merged
merged 5 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestLanguageDetectIgnoreFilesGithubFolder(t *testing.T) {
cfg.EnableGitHistoryAnalysis = true
cfg.EnableCommitAuthor = true
cfg.FilesOrPathsToIgnore = []string{"**/leaks/**", "**/yaml/**"}
cfg.ProjectPath = filepath.Join(testutil.RootPath, "..", "horusec-examples-vulnerabilities")
cfg.ProjectPath = testutil.RootPath

analysisID := uuid.New()

Expand Down
3 changes: 2 additions & 1 deletion internal/controllers/requirements/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"errors"
"fmt"
"strconv"
"strings"

"github.com/ZupIT/horusec-devkit/pkg/utils/logger"

Expand Down Expand Up @@ -86,7 +87,7 @@ func getVersionAndSubVersion(fullVersion string) (int, int, error) {
if err != nil {
return 0, 0, ErrDockerNotInstalled
}
subversion, err := strconv.Atoi(fullVersion[3:5])
subversion, err := strconv.Atoi(strings.Split(fullVersion[3:5], ".")[0])
if err != nil {
return 0, 0, ErrDockerNotInstalled
}
Expand Down
4 changes: 2 additions & 2 deletions internal/utils/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import (
func TestGetFilePathIntoBasePath(t *testing.T) {
t.Run("Should return path correctly", func(t *testing.T) {
filePath := filepath.Join("file", "file_test.go")
volume := testutil.RootPath
volume := filepath.Join(testutil.RootPath, "internal")
response, err := file.GetPathFromFilename(filePath, volume)
assert.NoError(t, err)
assert.NotEqual(t, response, filePath)
assert.Equal(t, filepath.Join("internal", "utils", "file", "file_test.go"), response)
assert.Equal(t, filepath.Join("utils", "file", "file_test.go"), response)
})
t.Run("Should return filePath because not found", func(t *testing.T) {
filePath := "some_other_not_existing_file.go"
Expand Down