Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
24 changes: 24 additions & 0 deletions images/router/haproxy/Dockerfile.ocp
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Builder stage for main router binary (if needed)
FROM registry.ci.openshift.org/ocp/4.22:haproxy-router-base AS builder
RUN mkdir -p /go/src/github.com/openshift/router
WORKDIR /go/src/github.com/openshift/router
COPY . .
# Add any build steps here if needed for the main router binary

# Test extension builder stage (added by ote-migration)
# Note: Using Go 1.24 image, but GOTOOLCHAIN=auto will download Go 1.25 if needed
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.23 AS test-extension-builder
RUN mkdir -p /go/src/github.com/openshift/router
WORKDIR /go/src/github.com/openshift/router
COPY . .
RUN cd tests-extension && \
make build && \
cd bin && \
tar -czvf router-test-extension.tar.gz router-tests-ext && \
rm -f router-tests-ext

# Final runtime image
FROM registry.ci.openshift.org/ocp/4.22:haproxy-router-base
RUN INSTALL_PKGS="socat haproxy28 rsyslog procps-ng util-linux" && \
yum install -y $INSTALL_PKGS && \
Expand All @@ -11,6 +31,10 @@ RUN INSTALL_PKGS="socat haproxy28 rsyslog procps-ng util-linux" && \
chmod -R g+w /var/lib/haproxy && \
sed -i 's/SECLEVEL=2/SECLEVEL=1/g' /etc/crypto-policies/back-ends/opensslcnf.config
COPY images/router/haproxy/ /var/lib/haproxy/

# Copy test extension binary (added by ote-migration)
COPY --from=test-extension-builder /go/src/github.com/openshift/router/tests-extension/bin/router-test-extension.tar.gz /usr/bin/

LABEL io.k8s.display-name="OpenShift HAProxy Router" \
io.k8s.description="This component offers ingress to an OpenShift cluster via Ingress and Route rules." \
io.openshift.tags="openshift,router,haproxy"
Expand Down
20 changes: 20 additions & 0 deletions tests-extension/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
BINARY := bin/router-tests-ext

.PHONY: build
build:
@echo "Building extension binary..."
@cd test/e2e && $(MAKE) -f bindata.mk update-bindata
@mkdir -p bin
go build -o $(BINARY) ./cmd
@echo "βœ… Binary built: $(BINARY)"

.PHONY: clean
clean:
@rm -f $(BINARY)
@cd test/e2e && $(MAKE) -f bindata.mk clean-bindata

.PHONY: help
help:
@echo "Available targets:"
@echo " build - Build extension binary"
@echo " clean - Remove binaries and bindata"
93 changes: 93 additions & 0 deletions tests-extension/cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package main

import (
"context"
"fmt"
"os"
"regexp"
"strings"

"github.com/spf13/cobra"

"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"

"github.com/openshift/origin/test/extended/util"
"k8s.io/kubernetes/test/e2e/framework"

_ "github.com/openshift/router-tests-extension/test/e2e"
)

func main() {
util.InitStandardFlags()
if err := util.InitTest(false); err != nil {
panic(fmt.Sprintf("couldn't initialize test framework: %+v", err.Error()))
}
framework.AfterReadingAllFlags(&framework.TestContext)

registry := e.NewRegistry()
ext := e.NewExtension("openshift", "payload", "router")

ext.AddSuite(e.Suite{
Name: "openshift/router/tests",
Parents: []string{"openshift/conformance/parallel"},
})

// Build test specs - NO SIG FILTERING
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
if err != nil {
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
}

// Apply platform filters
specs.Walk(func(spec *et.ExtensionTestSpec) {
for label := range spec.Labels {
if strings.HasPrefix(label, "Platform:") {
platformName := strings.TrimPrefix(label, "Platform:")
spec.Include(et.PlatformEquals(platformName))
}
}
})

specs.Walk(func(spec *et.ExtensionTestSpec) {
re := regexp.MustCompile(`\[platform:([a-z]+)\]`)
if match := re.FindStringSubmatch(spec.Name); match != nil {
platform := match[1]
spec.Include(et.PlatformEquals(platform))
}
})

// Set lifecycle to Informing
specs.Walk(func(spec *et.ExtensionTestSpec) {
spec.Lifecycle = et.LifecycleInforming
})

// Wrap test execution
specs.Walk(func(spec *et.ExtensionTestSpec) {
originalRun := spec.Run
spec.Run = func(ctx context.Context) *et.ExtensionTestResult {
var result *et.ExtensionTestResult
util.WithCleanup(func() {
result = originalRun(ctx)
})
return result
}
})

ext.AddSpecs(specs)
registry.Register(ext)

root := &cobra.Command{
Long: "Router Tests",
}

root.AddCommand(cmd.DefaultExtensionCommands(registry)...)

if err := func() error {
return root.Execute()
}(); err != nil {
os.Exit(1)
}
}
Loading