-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Label Selector and IP target support (#258)
- Loading branch information
1 parent
d5a31ce
commit c1bd46c
Showing
8 changed files
with
196 additions
and
41 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
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 @@ | ||
package cli | ||
|
||
import "testing" | ||
|
||
func TestOnlyOneSet(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
s string | ||
ss []string | ||
expected bool | ||
}{ | ||
{ | ||
name: "only arg emtpy", | ||
expected: false, | ||
}, | ||
{ | ||
name: "only arg non-empty", | ||
s: "s", | ||
expected: true, | ||
}, | ||
{ | ||
name: "first arg non-empty, rest empty", | ||
s: "s", | ||
ss: []string{""}, | ||
expected: true, | ||
}, | ||
{ | ||
name: "at least one other arg non-empty", | ||
s: "s", | ||
ss: []string{"", "s"}, | ||
}, | ||
{ | ||
name: "only one arg non-empty", | ||
ss: []string{"", "s"}, | ||
expected: true, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
actual := exactlyOneSet(tt.s, tt.ss...) | ||
if tt.expected != actual { | ||
t.Errorf("expected %t; got %t", tt.expected, actual) | ||
} | ||
}) | ||
} | ||
} |
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