Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ components:
- name: runtime
container:
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
memoryLimit: 1028Mi
memoryRequest: 550Mi
cpuLimit: 700m
cpuRequest: 250m
endpoints:
- name: "3000-tcp"
targetPort: 3000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ components:
image: registry.access.redhat.com/ubi8/nodejs-12:1-36
memoryLimit: 1024Mi
memoryRequest: 512Mi
cpuLimit: '1'
cpuRequest: 200m
endpoints:
- name: "3000-tcp"
targetPort: 3000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
commands:
- exec:
commandLine: mvn clean -Dmaven.repo.local=/home/user/.m2/repository package -Dmaven.test.skip=true
workingDir: /projects
component: tools
group:
isDefault: true
kind: build
id: build
- exec:
commandLine: mvn -Dmaven.repo.local=/home/user/.m2/repository spring-boot:run
workingDir: /projects
component: tools
group:
isDefault: true
Expand All @@ -16,6 +18,7 @@ commands:
- exec:
commandLine: java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n
-jar target/*.jar
workingDir: /projects
component: tools
group:
isDefault: true
Expand All @@ -26,7 +29,7 @@ components:
endpoints:
- name: 8080-tcp
targetPort: 8080
image: quay.io/eclipse/che-java11-maven:next
image: registry.access.redhat.com/ubi8/openjdk-11:latest
memoryLimit: 768Mi
mountSources: true
volumeMounts:
Expand Down
16 changes: 16 additions & 0 deletions tests/helper/component_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"

. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

"github.com/redhat-developer/odo/pkg/labels"
)

Expand Down Expand Up @@ -58,3 +60,17 @@ func (o *ClusterComponent) GetLabels() map[string]string {

return result
}

func (o *ClusterComponent) GetPodDef() *corev1.Pod {
var podDef corev1.Pod
podName := o.cli.GetRunningPodNameByComponent(o.name, o.namespace)
bufferOutput := o.cli.Run("get", "pods", podName, "-o", "json").Out.Contents()
err := json.Unmarshal(bufferOutput, &podDef)
Expect(err).ToNot(HaveOccurred())
return &podDef
}

func (o *ClusterComponent) GetPodLogs() string {
podName := o.cli.GetRunningPodNameByComponent(o.name, o.namespace)
return string(o.cli.Run("-n", o.namespace, "logs", podName).Out.Contents())
}
5 changes: 5 additions & 0 deletions tests/helper/component_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package helper

import (
. "github.com/onsi/ginkgo/v2"
corev1 "k8s.io/api/core/v1"
)

// Component is an abstraction for a Devfile Component deployed on a specific platform
Expand All @@ -16,6 +17,10 @@ type Component interface {
GetEnvVars(container string) map[string]string
// GetLabels returns the labels defined for the component
GetLabels() map[string]string
// GetPodDef returns the definition of the pod
GetPodDef() *corev1.Pod
// GetPodLogs returns logs for the pod
GetPodLogs() string
}

func NewComponent(componentName string, app string, mode string, namespace string, cli CliRunner) Component {
Expand Down
16 changes: 15 additions & 1 deletion tests/helper/component_podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ func splitLines(str string) map[string]string {
return result
}

func GetPodDef(podname string) *corev1.Pod {
func (o *PodmanComponent) GetPodDef() *corev1.Pod {
podname := fmt.Sprintf("%s-%s", o.componentName, o.app)
serializer := jsonserializer.NewSerializerWithOptions(
jsonserializer.SimpleMetaFactory{},
scheme.Scheme,
Expand Down Expand Up @@ -119,3 +120,16 @@ func (o *PodmanComponent) GetLabels() map[string]string {

return result.Labels
}

func (o *PodmanComponent) GetPodLogs() string {
podName := fmt.Sprintf("%s-%s", o.componentName, o.app)
cmd := exec.Command("podman", "pod", "logs", podName)
stdout, err := cmd.Output()
Expect(err).ToNot(HaveOccurred(), func() {
if exiterr, ok := err.(*exec.ExitError); ok {
err = fmt.Errorf("%s: %s", err, string(exiterr.Stderr))
}
fmt.Fprintln(ginkgo.GinkgoWriter, err)
})
return string(stdout)
}
Loading