feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
36
pkg/controller/controllertest/testing.go
Normal file
36
pkg/controller/controllertest/testing.go
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Please refer to the LICENSE file in the root directory of the project.
|
||||
* https://github.com/kubesphere/kubesphere/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package controllertest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func LoadCrdPath() ([]string, error) {
|
||||
_, filename, _, ok := runtime.Caller(0)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("could not determine path")
|
||||
}
|
||||
curDir, _ := filepath.Split(filename)
|
||||
crdDirPaths := make([]string, 0, 1)
|
||||
projectRoot := filepath.Join(curDir, "..", "..", "..")
|
||||
configRoot := filepath.Join(projectRoot, "config")
|
||||
if err := filepath.WalkDir(configRoot, func(path string, d fs.DirEntry, err error) error {
|
||||
if d.IsDir() {
|
||||
_, file := filepath.Split(path)
|
||||
if file == "crds" {
|
||||
crdDirPaths = append(crdDirPaths, path)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return crdDirPaths, nil
|
||||
}
|
||||
Reference in New Issue
Block a user