Skip to content

Commit

Permalink
Fixing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelWMS committed Oct 4, 2024
1 parent fafcc8f commit bb2134c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion toolkit/tools/internal/rpm/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ var (
// - release: 4.azl3
// - architecture: x86_64
// - extension: .rpm
packageFQNRegex = regexp.MustCompile(`^\s*(\S+[^-])-(?:(\d+):)?(\d[^-:_]*)-(\d+(?:\.[^-.\s]+)+?)(?:\.(noarch|x86_64|aarch64))?(?:\.(rpm))?\s*$`)
packageFQNRegex = regexp.MustCompile(`^\s*(\S+[^-])-(?:(\d+):)?(\d[^-:_]*)-(\d+(?:[^-\s]*?))(?:\.(noarch|x86_64|aarch64|src))?(?:\.(rpm))?\s*$`)

// Output from 'rpm' prints installed RPMs in a line with the following format:
//
Expand Down
9 changes: 5 additions & 4 deletions toolkit/tools/internal/rpm/rpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,11 @@ func TestPackageFQNRegexWithValidInput(t *testing.T) {
input: "nvidia-container-toolkit-1.15.0-1.azl3.x86_64.rpm",
expectedGroups: []string{"nvidia-container-toolkit", "", "1.15.0", "1.azl3", "x86_64", "rpm"},
},
{
name: "package with underscore in release",
input: "nvidia-container-toolkit-550.54.15-2_5.15.162.2.1.azl3.x86_64.rpm",
expectedGroups: []string{"nvidia-container-toolkit", "", "550.54.15", "2_5.15.162.2.1.azl3", "x86_64", "rpm"},
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -601,10 +606,6 @@ func TestPackageFQNRegexWithInvalidInput(t *testing.T) {
name: "package with release not beginning with a digit",
input: "pkg-name-0:1.2.3-D4.azl3.x86_64.rpm",
},
{
name: "package with release not beginning with a number followed by a '.'",
input: "pkg-name-0:1.2.3-4_1.azl3.x86_64.rpm",
},
{
name: "package with epoch not beginning with a digit",
input: "pkg-name-0:1.2.3-D4.azl3.x86_64.rpm",
Expand Down

0 comments on commit bb2134c

Please sign in to comment.