GetContainer returns the name of an existing, or newly created, container.
()
| 79 | |
| 80 | // GetContainer returns the name of an existing, or newly created, container. |
| 81 | func (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 |
| 103 | func (devfile *TestDevfile) SetContainerComponentValues(component *schema.Component) { |
no test coverage detected