github.com/hernad/nomad@v1.6.112/nomad/structs/structs_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 TestNamespace_Validate_Oss(t *testing.T) { 17 ci.Parallel(t) 18 19 cases := []struct { 20 name string 21 namespace *Namespace 22 expectedErr string 23 }{ 24 { 25 name: "node pool config not allowed", 26 namespace: &Namespace{ 27 Name: "test", 28 NodePoolConfiguration: &NamespaceNodePoolConfiguration{ 29 Default: "dev", 30 }, 31 }, 32 expectedErr: "unlicensed", 33 }, 34 } 35 36 for _, tc := range cases { 37 t.Run(tc.name, func(t *testing.T) { 38 err := tc.namespace.Validate() 39 if tc.expectedErr != "" { 40 must.ErrorContains(t, err, tc.expectedErr) 41 } else { 42 must.NoError(t, err) 43 } 44 }) 45 } 46 }