Files
odo/tests/helper/helper_configValidate.go
Parthvi Vala 80d7cfde30 Create cleanup (#5589)
* Cleanup create code

* Add missing integration tests from odo create to odo init

* Add CreateLocalEnv to create .odo/env/env.yaml file for commands that require it but cannot create it

* Remove 'odo create'  usages from integration tests

* Remove create reference from the Makefile

* REmove create doc from v3

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Remove test files

* Fix CI failure

Signed-off-by: Parthvi Vala <pvala@redhat.com>
2022-03-25 13:37:52 +01:00

37 lines
914 B
Go

package helper
import (
"fmt"
"io/ioutil"
"path/filepath"
. "github.com/onsi/gomega"
"github.com/redhat-developer/odo/pkg/envinfo"
)
const configFileDirectory = ".odo"
const envInfoFile = "env.yaml"
func LocalEnvInfo(context string) *envinfo.EnvSpecificInfo {
info, err := envinfo.NewEnvSpecificInfo(filepath.Join(context, configFileDirectory, envInfoFile))
if err != nil {
Expect(err).To(Equal(nil))
}
return info
}
// CreateLocalEnv creates a .odo/env/env.yaml file
// Useful for commands that require this file and cannot create one on their own, for e.g. url, list
func CreateLocalEnv(context, compName, projectName string) {
var config = fmt.Sprintf(`
ComponentSettings:
Name: %s
Project: %s
AppName: app
`, compName, projectName)
dir := filepath.Join(context, ".odo", "env")
MakeDir(dir)
Expect(ioutil.WriteFile(filepath.Join(dir, "env.yaml"), []byte(config), 0600)).To(BeNil())
}