open-nomad/nomad/structs/node_pool_oss_test.go
2023-06-20 10:09:47 -04:00

48 lines
844 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//go:build !ent
// +build !ent
package structs
import (
"testing"
"github.com/hashicorp/nomad/ci"
"github.com/shoenig/test/must"
)
func TestNodePool_Validate_OSS(t *testing.T) {
ci.Parallel(t)
testCases := []struct {
name string
pool *NodePool
expectedErr string
}{
{
name: "invalid scheduling algorithm",
pool: &NodePool{
Name: "valid",
SchedulerConfiguration: &NodePoolSchedulerConfiguration{
SchedulerAlgorithm: SchedulerAlgorithmBinpack,
},
},
expectedErr: "unlicensed",
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
err := tc.pool.Validate()
if tc.expectedErr != "" {
must.ErrorContains(t, err, tc.expectedErr)
} else {
must.NoError(t, err)
}
})
}
}