-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r/pod+replication_controller: Add validation for file mode bits
- Loading branch information
1 parent
380e750
commit 92965c0
Showing
3 changed files
with
39 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package kubernetes | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestValidateModeBits(t *testing.T) { | ||
validCases := []int{ | ||
0, 0001, 0644, 0777, | ||
} | ||
for _, mode := range validCases { | ||
_, es := validateModeBits(mode, "mode") | ||
if len(es) > 0 { | ||
t.Fatalf("Expected %#o to be valid: %#v", mode, es) | ||
} | ||
} | ||
|
||
invalidCases := []int{ | ||
-5, -1, 512, 777, | ||
} | ||
for _, mode := range invalidCases { | ||
_, es := validateModeBits(mode, "mode") | ||
if len(es) == 0 { | ||
t.Fatalf("Expected %#o to be invalid", mode) | ||
} | ||
} | ||
} |