THIS IS ONLY A TEST INSTANCE. DON'T DO IMPORTANT WORK HERE!

Commit db270e0b authored by Tom George's avatar Tom George Committed by Ilya Buziuk
Browse files

Add the debug port to che-host svc to expose the debug port


Signed-off-by: default avatarTom George <tg82490@gmail.com>
parent 93322332
......@@ -27,6 +27,12 @@ func NewCheService(instance *orgv1.CheCluster, cheLabels map[string]string, r Se
portNames = append(portNames, "metrics")
portPorts = append(portPorts, DefaultCheMetricsPort)
}
if instance.Spec.Server.CheDebug == "true" {
portNames = append(portNames, "debug")
portPorts = append(portPorts, DefaultCheDebugPort)
}
cheService := NewService(instance, "che-host", portNames, portPorts, cheLabels)
if err := r.CreateService(instance, cheService, true); err != nil {
return nil, err
......
......@@ -51,6 +51,28 @@ func TestCreateCheDefaultService(t *testing.T) {
checkPort(ports[0], "http", 8080, t)
}
func TestCreateCheServerDebug(t *testing.T) {
cheCluster := &orgv1.CheCluster{
Spec: orgv1.CheClusterSpec{
Server: orgv1.CheClusterSpecServer{
CheDebug: "true",
},
},
}
service, err := NewCheService(cheCluster, map[string]string{}, &DummyServiceCreator{})
if service == nil || err != nil {
t.Error("service should be created witn no error")
}
ports := service.Spec.Ports
if len(ports) != 2 {
t.Error("expected 1 default port")
}
checkPort(ports[0], "http", 8080, t)
checkPort(ports[1], "debug", 8000, t)
}
func TestCreateCheServiceEnableMetrics(t *testing.T) {
cheCluster := &orgv1.CheCluster{
Spec: orgv1.CheClusterSpec{
......@@ -108,7 +130,6 @@ func TestFailWhenCantCreateService(t *testing.T) {
}
}
func checkPort(actualPort corev1.ServicePort, expectedName string, expectedPort int32, t *testing.T) {
if actualPort.Name != expectedName || actualPort.Port != expectedPort {
t.Errorf("expected port name:`%s` port:`%d`, actual name:`%s` port:`%d`",
......
......@@ -45,6 +45,7 @@ const (
DefaultCheLogLevel = "INFO"
DefaultCheDebug = "false"
DefaultCheMetricsPort = int32(8087)
DefaultCheDebugPort = int32(8000)
defaultPvcJobsImage = "registry.redhat.io/ubi8-minimal:8.0-213"
defaultPvcJobsUpstreamImage = "registry.access.redhat.com/ubi8-minimal:8.0-213"
defaultPostgresImage = "registry.redhat.io/rhscl/postgresql-96-rhel7:1-47"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment