chore(terraform): use a util func to build internal terraform id (#869)
This commit is contained in:
parent
801ef6033d
commit
b313ef6a39
72 changed files with 205 additions and 538 deletions
|
|
@ -2,6 +2,7 @@ package utils
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
|
@ -344,3 +345,36 @@ func TestIsUndefined(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildInternalTerraformId(t *testing.T) {
|
||||
type args struct {
|
||||
idParts []string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want types.String
|
||||
}{
|
||||
{
|
||||
name: "no id parts",
|
||||
args: args{
|
||||
idParts: []string{},
|
||||
},
|
||||
want: types.StringValue(""),
|
||||
},
|
||||
{
|
||||
name: "multiple id parts",
|
||||
args: args{
|
||||
idParts: []string{"abc", "foo", "bar", "xyz"},
|
||||
},
|
||||
want: types.StringValue("abc,foo,bar,xyz"),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := BuildInternalTerraformId(tt.args.idParts...); !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("BuildInternalTerraformId() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue