mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Add compiler utils test.
This commit is contained in:
26
api/internal/plugins/compiler/utils_test.go
Normal file
26
api/internal/plugins/compiler/utils_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2020 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package compiler
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/filesys"
|
||||
)
|
||||
|
||||
func TestDeterminePluginSrcRoot(t *testing.T) {
|
||||
actual, err := DeterminePluginSrcRoot(filesys.MakeFsOnDisk())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !filepath.IsAbs(actual) {
|
||||
t.Errorf("expected absolute path, but got '%s'", actual)
|
||||
}
|
||||
expectedSuffix := filepath.Join("sigs.k8s.io", "kustomize", "plugin")
|
||||
if !strings.HasSuffix(actual, expectedSuffix) {
|
||||
t.Errorf("expected suffix '%s' in '%s'", expectedSuffix, actual)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user