536e3c5282
Use the new filtering and pagination capabilities of the `Eval.List` RPC to provide filtering and pagination at the command line. Also includes note that `nomad eval status -json` is deprecated and will be replaced with a single evaluation view in a future version of Nomad.
61 lines
1.4 KiB
Go
61 lines
1.4 KiB
Go
package command
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestEvalList_ArgsWithoutPageToken(t *testing.T) {
|
|
|
|
cases := []struct {
|
|
cli string
|
|
expected string
|
|
}{
|
|
{
|
|
cli: "nomad eval list -page-token=abcdef",
|
|
expected: "nomad eval list",
|
|
},
|
|
{
|
|
cli: "nomad eval list -page-token abcdef",
|
|
expected: "nomad eval list",
|
|
},
|
|
{
|
|
cli: "nomad eval list -per-page 3 -page-token abcdef",
|
|
expected: "nomad eval list -per-page 3",
|
|
},
|
|
{
|
|
cli: "nomad eval list -page-token abcdef -per-page 3",
|
|
expected: "nomad eval list -per-page 3",
|
|
},
|
|
{
|
|
cli: "nomad eval list -per-page=3 -page-token abcdef",
|
|
expected: "nomad eval list -per-page=3",
|
|
},
|
|
{
|
|
cli: "nomad eval list -verbose -page-token abcdef",
|
|
expected: "nomad eval list -verbose",
|
|
},
|
|
{
|
|
cli: "nomad eval list -page-token abcdef -verbose",
|
|
expected: "nomad eval list -verbose",
|
|
},
|
|
{
|
|
cli: "nomad eval list -verbose -page-token abcdef -per-page 3",
|
|
expected: "nomad eval list -verbose -per-page 3",
|
|
},
|
|
{
|
|
cli: "nomad eval list -page-token abcdef -verbose -per-page 3",
|
|
expected: "nomad eval list -verbose -per-page 3",
|
|
},
|
|
}
|
|
|
|
for _, tc := range cases {
|
|
args := strings.Split(tc.cli, " ")
|
|
assert.Equal(t, tc.expected, argsWithoutPageToken(args),
|
|
"for input: %s", tc.cli)
|
|
}
|
|
|
|
}
|