Skip to content
Draft
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
  •  
  •  
  •  
13 changes: 0 additions & 13 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# Will be replaced in the CI
FROM golang:1.21 AS builder

WORKDIR /src

COPY ./ ./

RUN go build -o /bin/openstack-test ./cmd/openshift-tests

# Test extension builder stage (added by ote-migration)
FROM golang:1.21 AS test-extension-builder
RUN mkdir -p /go/src/github.com/openshift/openstack-test
Expand All @@ -20,12 +11,8 @@ RUN make tests-ext-build && \
# Will be replaced in the CI with registry.ci.openshift.org/ocp/4.y:tools
FROM registry.access.redhat.com/ubi8/ubi

COPY --from=builder /bin/openstack-test /usr/bin/

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

USER 1000:1000
ENV LC_ALL en_US.UTF-8

ENTRYPOINT ["/usr/bin/openstack-test"]
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

openstack-tests: test/extended/openstack/* cmd/openshift-tests/*
go build -o $@ ./cmd/openshift-tests

# Update generated artifacts.
update:
mkdir -p ./test/extented/util/annotate/generated
Expand All @@ -12,8 +9,8 @@ verify:
./hack/verify.sh
.PHONY: verify

run: openstack-tests
./$< run openshift/openstack
run: tests-ext-build
./$(TESTS_EXT_BINARY) run-suite openstack-test/all
.PHONY: run

# OTE test extension binary configuration
Expand Down
108 changes: 21 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,33 @@
# openstack-test

This repository contains tests specific to OpenShift on OpenStack, based on the [openshift/origin][1] machinery.
This repository contains tests specific to OpenShift on OpenStack, built as an [OpenShift Tests Extension (OTE)][1].

The tests sit in [`test/extended/openstack`][2]
The tests sit in [`test/extended/openstack`][2].

Run the tests by exporting both OpenShift and OpenStack credentials, then running `make run`:
1. `export OS_CLOUD=<OS_CLOUD>`
1. `export KUBECONFIG=<kubeconfig>`
1. `make run`

[1]: https://github.com/openshift/origin
[2]: test/extended/openstack
## Running the tests

---
Export both OpenShift and OpenStack credentials, then invoke `make run`:
1. `export OS_CLOUD=<OS_CLOUD>`
2. `export KUBECONFIG=<kubeconfig>`
3. `make run`

## Rebase on Origin
This builds the extension binary and runs the `openstack-test/all` suite.

### Step 1: Update Origin as a dependency
### Available suites

Identify the Origin commit you want to rebase `openstack-test` onto.
| Suite | Description |
|---|---|
| `openstack-test/conformance/parallel` | Parallel conformance tests (Level0, non-serial, non-disruptive) |
| `openstack-test/conformance/serial` | Serial conformance tests (must run sequentially) |
| `openstack-test/disruptive` | Disruptive tests (may affect cluster state) |
| `openstack-test/non-disruptive` | All non-disruptive tests (safe for development clusters) |
| `openstack-test/all` | All openstack-test tests |

Origin is referenced as a dependency in `go.mod`. Update it with:
To run a specific suite:
```sh
GONOPROXY=* GONOSUMDB=* go get -d github.com/openshift/origin@<latest-commit-sha>
make extension
./bin/openstack-test-tests-ext run-suite openstack-test/conformance/parallel
```

### Step 2: Update Origin dependencies' overrides

In `go.mod`, manually replace all the overrides ("replace") to match Origin's
`go.mod`.

### Step 3: Update Origin's code in openstack-test

We manually vendor Origin code in three packages. To ensure compatibility, manually rebase from Origin and then apply some changes:

```bash
cp ${ORIGIN}/cmd/openshift-tests/openshift-tests.go cmd/openshift-tests/openshift-tests.go
cp ${ORIGIN}/pkg/cmd/openshift-tests/run/*.go pkg/cmd/openshift-tests/run/
cp ${ORIGIN}/test/extended/util/annotate/*.go test/extended/util/annotate/
```

Apply this diff to change Origin's code to use the locally-defined tests:

```diff
diff --git a/cmd/openshift-tests/openshift-tests.go b/cmd/openshift-tests/openshift-tests.go
index 1d06b4145f..292c587263 100644
--- a/cmd/openshift-tests/openshift-tests.go
+++ b/cmd/openshift-tests/openshift-tests.go
@@ -10,6 +10,7 @@ import (
"time"

"github.com/openshift/library-go/pkg/serviceability"
+ "github.com/openshift/openstack-test/pkg/cmd/openshift-tests/run"
"github.com/openshift/origin/pkg/cmd"
collectdiskcertificates "github.com/openshift/origin/pkg/cmd/openshift-tests/collect-disk-certificates"
"github.com/openshift/origin/pkg/cmd/openshift-tests/dev"
@@ -20,7 +21,6 @@ import (
"github.com/openshift/origin/pkg/cmd/openshift-tests/monitor/timeline"
"github.com/openshift/origin/pkg/cmd/openshift-tests/render"
risk_analysis "github.com/openshift/origin/pkg/cmd/openshift-tests/risk-analysis"
- "github.com/openshift/origin/pkg/cmd/openshift-tests/run"
run_disruption "github.com/openshift/origin/pkg/cmd/openshift-tests/run-disruption"
run_test "github.com/openshift/origin/pkg/cmd/openshift-tests/run-test"
run_upgrade "github.com/openshift/origin/pkg/cmd/openshift-tests/run-upgrade"
diff --git a/pkg/cmd/openshift-tests/run/command.go b/pkg/cmd/openshift-tests/run/command.go
index 57bdd4801e..49dd02a2e4 100644
--- a/pkg/cmd/openshift-tests/run/command.go
+++ b/pkg/cmd/openshift-tests/run/command.go
@@ -4,8 +4,8 @@ import (
"context"
"fmt"

+ "github.com/openshift/openstack-test/pkg/testsuites"
"github.com/openshift/origin/pkg/clioptions/imagesetup"
- "github.com/openshift/origin/pkg/testsuites"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/util/templates"
diff --git a/test/extended/util/annotate/annotate.go b/test/extended/util/annotate/annotate.go
index 6e47a3dc17..d66399ce77 100644
--- a/test/extended/util/annotate/annotate.go
+++ b/test/extended/util/annotate/annotate.go
@@ -7,7 +7,7 @@ import (

// this ensures that all origin tests are picked by ginkgo as defined
// in test/extended/include.go
- _ "github.com/openshift/origin/test/extended"
+ _ "github.com/openshift/openstack-test/test/extended"
)

func main() {
```

### Step 4: Tidy up the dependencies

```bash
go mod tidy && go mod vendor
```
[1]: https://github.com/openshift-eng/openshift-tests-extension
[2]: test/extended/openstack
116 changes: 0 additions & 116 deletions cmd/openshift-tests/openshift-tests.go

This file was deleted.

Loading