Skip to content
Open
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.
104 changes: 71 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,93 @@ This repository contains tests specific to OpenShift on OpenStack, based on the
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`

---

## Implementation details
## Rebase on Origin

### Step 1: Update Origin as a dependency

Origin is referenced as a dependency in `go.mod`. Identify the commit
that you want to rebase onto and update it with:

Origin is referenced as a dependency in `go.mod`. Regularly update it with:
```sh
GONOPROXY=* GONOSUMDB=* go get -d github.com/openshift/origin@<latest-commit-sha>
GONOPROXY=* GONOSUMDB=* go get -d github.com/openshift/origin@<commit-sha>
```

Two Origin packages remain vendored and require manual update:
### Step 2: Update go.mod replacements

In `go.mod`, manually update the `replace` directive to match Origin's
`go.mod`

### Step 3: Update openstack-test's main package

* the `main` package under `cmd/openshift-tests`;
* the code needed to `go generate` the test list in `test/extended/util/annotate`.
We manually vendor Origin code into our tree. To ensure compatibility,
manually copy these files:

These two are vendored with these changes:
```bash
cp ${ORIGIN}/cmd/openshift-tests/openshift-tests.go cmd/openshift-tests/
cp ${ORIGIN}/test/extended/util/annotate/*.go test/extended/util/annotate/
```

Then apply these diffs to the recently copied Origin's files to use the
locally-defined tests:

```diff
diff --git a/cmd/openshift-tests/e2e.go b/cmd/openshift-tests/e2e.go
index 2b99f9e7e7..c74c279169 100644
--- a/cmd/openshift-tests/e2e.go
+++ b/cmd/openshift-tests/e2e.go
@@ -10,8 +10,8 @@ import (
exutil "github.com/openshift/origin/test/extended/util"
"k8s.io/kubectl/pkg/util/templates"

- _ "github.com/openshift/origin/test/extended"
- _ "github.com/openshift/origin/test/extended/util/annotate/generated"
+ _ "github.com/openshift/openstack-test/test/extended"
+ _ "github.com/openshift/openstack-test/test/extended/util/annotate/generated"
)

func isDisabled(name string) bool {
diff --git a/test/extended/util/annotate/annotate.go b/test/extended/util/annotate/annotate.go
index ab002b730e..dc244b5574 100644
diff --git a/cmd/openshift-tests/openshift-tests.go b/../openstack-test/cmd/openshift-tests/openshift-tests.go
index 6121886935..e599cac199 100644
--- a/cmd/openshift-tests/openshift-tests.go
+++ b/../openstack-test/cmd/openshift-tests/openshift-tests.go
@@ -19,7 +19,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"
@@ -76,7 +75,7 @@ func main() {
}

root.AddCommand(
- run.NewRunCommand(ioStreams),
+ NewRunCommand(ioStreams),
run_upgrade.NewRunUpgradeCommand(ioStreams),
images.NewImagesCommand(),
run_test.NewRunTestCommand(ioStreams),
```

```diff
diff --git a/test/extended/util/annotate/annotate.go b/../openstack-test/test/extended/util/annotate/annotate.go
index 6e47a3dc17..d66399ce77 100644
--- a/test/extended/util/annotate/annotate.go
+++ b/test/extended/util/annotate/annotate.go
@@ -6,7 +6,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/openshift-hack/e2e/annotate"

- _ "github.com/openshift/origin/test/extended"
+ _ "github.com/openshift/openstack-test/test/extended"
+++ b/../openstack-test/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"
)

// mergeMaps updates an existing map of string slices with the
```

### Step 4: Tidy up dependencies

```bash
GONOPROXY=* GONOSUMDB=* go mod tidy && go mod vendor
```

### Step 5: Check the building

To make sure there is no dependency conflict, try building
`openstack-test` and correct any error that eventually appears.

```bash
make
```

[1]: https://github.com/openshift/origin
Expand Down
54 changes: 54 additions & 0 deletions cmd/openshift-tests/command.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package main

import (
"context"
"fmt"

"github.com/openshift/origin/pkg/clioptions/imagesetup"
"github.com/openshift/origin/pkg/cmd/openshift-tests/run"
"github.com/openshift/origin/pkg/testsuites"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/util/templates"
)

func NewRunCommand(streams genericclioptions.IOStreams) *cobra.Command {
f := run.NewRunSuiteFlags(streams, imagesetup.DefaultTestImageMirrorLocation, StandardTestSuites())

cmd := &cobra.Command{
Use: "run SUITE",
Short: "Run a test suite",
Long: templates.LongDesc(`
Run a test suite against an OpenShift server

This command will run one of the following suites against a cluster identified by the current
KUBECONFIG file. See the suite description for more on what actions the suite will take.

If you specify the --dry-run argument, the names of each individual test that is part of the
suite will be printed, one per line. You may filter this list and pass it back to the run
command with the --file argument. You may also pipe a list of test names, one per line, on
standard input by passing "-f -".

`) + testsuites.SuitesString(StandardTestSuites(), "\n\nAvailable test suites:\n\n"),

SilenceUsage: true,
SilenceErrors: true,
RunE: func(cmd *cobra.Command, args []string) error {
o, err := f.ToOptions(args)
if err != nil {
fmt.Fprintf(f.IOStreams.ErrOut, "error converting to options: %v", err)
return err
}

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if err := o.Run(ctx); err != nil {
fmt.Fprintf(f.IOStreams.ErrOut, "error running options: %v", err)
return err
}
return nil
},
}
f.BindFlags(cmd.Flags())
return cmd
}
Loading