AddComponent adds a component of the specified type, with random attributes, to the devfile schema
(componentType schema.ComponentType)
| 54 | |
| 55 | // AddComponent adds a component of the specified type, with random attributes, to the devfile schema |
| 56 | func (devfile *TestDevfile) AddComponent(componentType schema.ComponentType) schema.Component { |
| 57 | LogInfoMessage(fmt.Sprintf("Create a %v component :", componentType)) |
| 58 | component := schema.Component{} |
| 59 | component.Name = GetRandomUniqueString(8, true) |
| 60 | LogInfoMessage(fmt.Sprintf("....... Name: %s", component.Name)) |
| 61 | switch componentType { |
| 62 | case schema.ContainerComponentType: |
| 63 | component.Container = &schema.ContainerComponent{} |
| 64 | devfile.SetContainerComponentValues(&component) |
| 65 | case schema.KubernetesComponentType: |
| 66 | component.Kubernetes = &schema.KubernetesComponent{} |
| 67 | devfile.SetK8sComponentValues(&component) |
| 68 | case schema.OpenshiftComponentType: |
| 69 | component.Openshift = &schema.OpenshiftComponent{} |
| 70 | devfile.SetK8sComponentValues(&component) |
| 71 | case schema.VolumeComponentType: |
| 72 | component.Volume = &schema.VolumeComponent{} |
| 73 | devfile.SetVolumeComponentValues(&component) |
| 74 | } |
| 75 | |
| 76 | devfile.componentAdded(component) |
| 77 | return component |
| 78 | } |
| 79 | |
| 80 | // GetContainer returns the name of an existing, or newly created, container. |
| 81 | func (devfile *TestDevfile) GetContainerName() string { |
no test coverage detected