Documentation and tests for hostlist syntax
Added this to a new top-level page for wwctl Closes #611 Signed-off-by: Jonathon Anderson <janderson@ciq.co>
This commit is contained in:
37
pkg/hostlist/hostlist_test.go
Normal file
37
pkg/hostlist/hostlist_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package hostlist
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
||||
func Test_Single(t *testing.T) {
|
||||
assert.Equal(t, []string{"node1"}, Expand([]string{"node1"}))
|
||||
}
|
||||
|
||||
func Test_Multiple(t *testing.T) {
|
||||
assert.Equal(t, []string{"node1", "node2"}, Expand([]string{"node1", "node2"}))
|
||||
}
|
||||
|
||||
|
||||
func Test_Range(t *testing.T) {
|
||||
assert.Equal(t, []string{"node1", "node2"}, Expand([]string{"node[1-2]"}))
|
||||
}
|
||||
|
||||
|
||||
func Test_Internal_Comma(t *testing.T) {
|
||||
assert.Equal(t, []string{"node1", "node2"}, Expand([]string{"node[1,2]"}))
|
||||
}
|
||||
|
||||
func Test_Mixed_Range_Comma(t *testing.T) {
|
||||
assert.Equal(t, []string{"node1", "node2", "node3"}, Expand([]string{"node[1,2-3]"}))
|
||||
}
|
||||
|
||||
|
||||
// not currently supported
|
||||
//
|
||||
// func Test_External_Comma(t *testing.T) {
|
||||
// assert.Equal(t, []string{"node1", "node2"}, Expand([]string{"node1,node2"}))
|
||||
// }
|
||||
Reference in New Issue
Block a user