-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4274 from microsoft/mandeepsplaha/cherry-pick-rpm…
…-resolution-mechanism-fix Updated toolkit's package resolution to accept installed packages. (#4211)
- Loading branch information
Showing
6 changed files
with
95 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
package sliceutils | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/microsoft/CBL-Mariner/toolkit/tools/internal/logger" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
logger.InitStderrLog() | ||
os.Exit(m.Run()) | ||
} | ||
|
||
func TestShouldCreateEmptySliceFromNil(t *testing.T) { | ||
outputSlice := StringsSetToSlice(nil) | ||
|
||
assert.NotNil(t, outputSlice) | ||
assert.Empty(t, outputSlice) | ||
} | ||
|
||
func TestShouldCreateEmptySliceFromEmptySet(t *testing.T) { | ||
outputSlice := StringsSetToSlice(map[string]bool{}) | ||
|
||
assert.NotNil(t, outputSlice) | ||
assert.Empty(t, outputSlice) | ||
} | ||
|
||
func TestShouldReturnValuesForAllTrueElementsInSet(t *testing.T) { | ||
inputSet := map[string]bool{ | ||
"A": true, | ||
"B": true, | ||
"X": false, | ||
"Y": false, | ||
} | ||
outputSlice := StringsSetToSlice(inputSet) | ||
|
||
assert.NotNil(t, outputSlice) | ||
assert.Len(t, outputSlice, 2) | ||
assert.Contains(t, outputSlice, "A") | ||
assert.Contains(t, outputSlice, "B") | ||
assert.NotContains(t, outputSlice, "X") | ||
assert.NotContains(t, outputSlice, "Y") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters