File tree Expand file tree Collapse file tree 3 files changed +110
-0
lines changed Expand file tree Collapse file tree 3 files changed +110
-0
lines changed Original file line number Diff line number Diff line change
1
+ .PHONY : integration-build integration-docker-build integration-run integration-clean integration-docker-run integration-help all
2
+
3
+ # Variables
4
+ BINARY = integration-tes
5
+ IMAGE = lvms_integration_tes
6
+ TAG = lates
7
+ FULL_IMAGE = $(IMAGE ) :$(TAG )
8
+
9
+ # Default targe
10
+ all : integration-build
11
+
12
+ # Build Go binary for integration tests
13
+ integration-build :
14
+ go build -o $(BINARY ) .
15
+
16
+ # Build Docker image for integration tests
17
+ integration-docker-build :
18
+ docker build -t $(FULL_IMAGE ) .
19
+
20
+ # Run integration tests locally (binary)
21
+ integration-run : integration-build
22
+ ./$(BINARY )
23
+
24
+ # Run integration tests in Docker container
25
+ integration-docker-run : integration-docker-build
26
+ docker run --rm $(FULL_IMAGE )
27
+
28
+ # Clean up local binary and Docker image
29
+ integration-clean :
30
+ rm -f $(BINARY )
31
+ docker rmi -f $(FULL_IMAGE ) || true
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "fmt"
5
+ "os"
6
+
7
+ "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
8
+ "github.com/spf13/cobra"
9
+
10
+ "github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
11
+ e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
12
+ g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
13
+
14
+ // If using ginkgo, import your tests here
15
+ _ "github.com/openshift/lvm-operator/test/integration"
16
+ )
17
+
18
+ func main () {
19
+ // Extension registry
20
+ registry := e .NewRegistry ()
21
+
22
+ // You can declare multiple extensions, but most people will probably only need to create one.
23
+ ext := e .NewExtension ("openshift" , "payload" , "lvm-operator" )
24
+
25
+ // all test cases
26
+ ext .AddSuite (e.Suite {
27
+ Name : "openshift/lvm-operator/integration" ,
28
+ Parents : []string {},
29
+ })
30
+
31
+ // If using Ginkgo, build test specs automatically
32
+ specs , err := g .BuildExtensionTestSpecsFromOpenShiftGinkgoSuite ()
33
+ if err != nil {
34
+ panic (fmt .Sprintf ("couldn't build extension test specs from ginkgo: %+v" , err .Error ()))
35
+ }
36
+
37
+ ext .AddSpecs (specs )
38
+ registry .Register (ext )
39
+
40
+ root := & cobra.Command {
41
+ Long : "LVM Test Suite (OTE Based)" ,
42
+ }
43
+
44
+ root .AddCommand (
45
+ cmd .DefaultExtensionCommands (registry )... ,
46
+ )
47
+
48
+ if err := func () error {
49
+ return root .Execute ()
50
+ }(); err != nil {
51
+ os .Exit (1 )
52
+ }
53
+ }
Original file line number Diff line number Diff line change
1
+ FROM golang:1.24 AS builder
2
+
3
+ # Set working directory inside the builder container
4
+ WORKDIR /workspace
5
+
6
+ # Copy go module files and download dependencies
7
+ COPY go.mod go.sum ./
8
+ RUN go mod download
9
+
10
+ # Copy the rest of the source code
11
+ COPY . .
12
+
13
+ # Build the binary from test/integration
14
+ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o integration-test ./test/integration
15
+
16
+ # ---- Stage 2: Runtime container ----
17
+ FROM registry.access.redhat.com/ubi9/ubi-minimal:lates
18
+
19
+ # Set working directory in runtime container
20
+ WORKDIR /
21
+
22
+ # Copy the built binary from the builder stage
23
+ COPY --from=builder /workspace/integration-test .
24
+
25
+ # Run the binary
26
+ ENTRYPOINT ["./integration-test" ]
You can’t perform that action at this time.
0 commit comments