2023-04-10 15:36:59 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2023-02-02 18:59:14 +00:00
|
|
|
package structs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/nomad/ci"
|
|
|
|
"github.com/shoenig/test/must"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestWorkloadIdentity_Equal(t *testing.T) {
|
|
|
|
ci.Parallel(t)
|
|
|
|
|
|
|
|
var orig *WorkloadIdentity
|
|
|
|
|
|
|
|
newWI := orig.Copy()
|
|
|
|
must.Equal(t, orig, newWI)
|
|
|
|
|
|
|
|
orig = &WorkloadIdentity{}
|
|
|
|
must.NotEqual(t, orig, newWI)
|
|
|
|
|
|
|
|
newWI = &WorkloadIdentity{}
|
|
|
|
must.Equal(t, orig, newWI)
|
|
|
|
|
|
|
|
orig.Env = true
|
|
|
|
must.NotEqual(t, orig, newWI)
|
|
|
|
|
|
|
|
newWI.Env = true
|
|
|
|
must.Equal(t, orig, newWI)
|
|
|
|
|
|
|
|
newWI.File = true
|
|
|
|
must.NotEqual(t, orig, newWI)
|
|
|
|
}
|