generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failing closed after maximum retry is achieved to avoid inifite recur…
…sion
- Loading branch information
Showing
2 changed files
with
42 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package volume | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestGetTarget(t *testing.T) { | ||
tests := []struct { | ||
mountpath string | ||
expectedResult string | ||
expectError bool | ||
counter int | ||
}{ | ||
{ | ||
"c:\\", | ||
"", | ||
true, | ||
1, | ||
}, | ||
} | ||
for _, test := range tests { | ||
target, err := getTarget(test.mountpath, test.counter) | ||
if test.expectError { | ||
assert.NotNil(t, err, "Expect error during getTarget(%s)", test.mountpath) | ||
} else { | ||
assert.Nil(t, err, "Expect error is nil during getTarget(%s)", test.mountpath) | ||
} | ||
assert.Equal(t, target, test.expectedResult, "Expect result not equal with getTarget(%s) return: %q, expected: %s, error: %v", | ||
test.mountpath, target, test.expectedResult, err) | ||
} | ||
} |