MCPcopy Create free account
hub / github.com/devfile/api / GetContainerName

Method GetContainerName

test/v200/utils/common/component_test_utils.go:81–100  ·  view source on GitHub ↗

GetContainer returns the name of an existing, or newly created, container.

()

Source from the content-addressed store, hash-verified

79
80// GetContainer returns the name of an existing, or newly created, container.
81func (devfile *TestDevfile) GetContainerName() string {
82
83 componentName := ""
84 for _, currentComponent := range devfile.SchemaDevFile.Components {
85 if currentComponent.Container != nil {
86 componentName = currentComponent.Name
87 LogInfoMessage(fmt.Sprintf("return existing container from GetContainerName : %s", componentName))
88 break
89 }
90 }
91
92 if componentName == "" {
93 component := devfile.AddComponent(schema.ContainerComponentType)
94 component.Container.Image = GetRandomUniqueString(GetRandomNumber(8, 18), false)
95 componentName = component.Name
96 LogInfoMessage(fmt.Sprintf("retrun new container from GetContainerName : %s", componentName))
97 }
98
99 return componentName
100}
101
102// SetContainerComponentValues randomly sets/updates container component attributes to random values
103func (devfile *TestDevfile) SetContainerComponentValues(component *schema.Component) {

Callers 2

SetExecCommandValuesMethod · 0.95
SetApplyCommandValuesMethod · 0.95

Calls 4

AddComponentMethod · 0.95
LogInfoMessageFunction · 0.85
GetRandomUniqueStringFunction · 0.85
GetRandomNumberFunction · 0.85

Tested by

no test coverage detected