Skip to content

Commit

Permalink
fix: check folders based on os
Browse files Browse the repository at this point in the history
  • Loading branch information
MyaLongmire committed Feb 10, 2022
1 parent e6cec6e commit 829893f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/snmp/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,18 @@ func (t *TestingMibLoader) loadModule(path string) error {
}
func TestFolderLookup(t *testing.T) {
var folders []string
var givenPath []string

tests := []struct {
name string
mibPath []string
mibPath [][]string
paths [][]string
files []string
windowsFiles []string
}{
{
name: "loading folders",
mibPath: []string{"testdata/loadMibsFromPath"},
mibPath: [][]string{{"testdata", "loadMibsFromPath"}},
paths: [][]string{{"testdata", "loadMibsFromPath"}, {"testdata", "loadMibsFromPath", "linkTarget"}, {"testdata", "loadMibsFromPath", "root"}},
files: []string{"emptyFile"},
windowsFiles: []string{"emptyFile", "symlink"},
Expand All @@ -125,8 +126,11 @@ func TestFolderLookup(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
loader := TestingMibLoader{}

err := LoadMibsFromPath(tt.mibPath, testutil.Logger{}, &loader)
for _, paths := range tt.mibPath {
rootPath := filepath.Join(paths...)
givenPath = append(givenPath, rootPath)
}
err := LoadMibsFromPath(givenPath, testutil.Logger{}, &loader)
require.NoError(t, err)
for _, pathSlice := range tt.paths {
path := filepath.Join(pathSlice...)
Expand Down

0 comments on commit 829893f

Please sign in to comment.