github.com/hernad/nomad@v1.6.112/nomad/structs/node_pool_oss_test.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 //go:build !ent 5 // +build !ent 6 7 package structs 8 9 import ( 10 "testing" 11 12 "github.com/hernad/nomad/ci" 13 "github.com/shoenig/test/must" 14 ) 15 16 func TestNodePool_Validate_OSS(t *testing.T) { 17 ci.Parallel(t) 18 19 testCases := []struct { 20 name string 21 pool *NodePool 22 expectedErr string 23 }{ 24 { 25 name: "invalid scheduling algorithm", 26 pool: &NodePool{ 27 Name: "valid", 28 SchedulerConfiguration: &NodePoolSchedulerConfiguration{ 29 SchedulerAlgorithm: SchedulerAlgorithmBinpack, 30 }, 31 }, 32 expectedErr: "unlicensed", 33 }, 34 } 35 36 for _, tc := range testCases { 37 t.Run(tc.name, func(t *testing.T) { 38 err := tc.pool.Validate() 39 40 if tc.expectedErr != "" { 41 must.ErrorContains(t, err, tc.expectedErr) 42 } else { 43 must.NoError(t, err) 44 } 45 }) 46 } 47 }