mirror of
https://github.com/openshift/image-registry.git
synced 2026-02-05 09:45:55 +01:00
added OTE infrastructure code changes only
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.15 AS builder
|
||||
WORKDIR /go/src/github.com/openshift/image-registry
|
||||
COPY . .
|
||||
RUN hack/build-go.sh
|
||||
RUN hack/build-go.sh \
|
||||
&& gzip _output/local/bin/dockerregistry-tests-ext
|
||||
|
||||
FROM registry.svc.ci.openshift.org/openshift/origin-v4.0:base
|
||||
RUN yum install -y rsync && yum clean all && rm -rf /var/cache/yum
|
||||
COPY --from=builder /go/src/github.com/openshift/image-registry/_output/local/bin/dockerregistry /usr/bin/
|
||||
COPY --from=builder /go/src/github.com/openshift/image-registry/_output/local/bin/dockerregistry-tests-ext.gz /usr/bin/
|
||||
COPY images/dockerregistry/config.yml /
|
||||
ADD images/dockerregistry/writable-extracted.tar.gz /etc/pki/ca-trust/extracted
|
||||
USER 1001
|
||||
|
||||
1
Makefile
1
Makefile
@@ -107,6 +107,7 @@ test-integration:
|
||||
# Example:
|
||||
# make clean
|
||||
clean:
|
||||
chmod -R u+w $(OUT_DIR) 2>/dev/null || true
|
||||
rm -rf $(OUT_DIR)
|
||||
.PHONY: clean
|
||||
|
||||
|
||||
33
README.md
33
README.md
@@ -18,3 +18,36 @@ Installation and configuration instructions can be found in the
|
||||
* Role-based access control (RBAC).
|
||||
* Audit log.
|
||||
* Prometheus metrics.
|
||||
|
||||
## Tests
|
||||
|
||||
This repository is compatible with the [OpenShift Tests Extension (OTE)](https://github.com/openshift-eng/openshift-tests-extension) framework.
|
||||
|
||||
### Building the test binary
|
||||
|
||||
```bash
|
||||
make build
|
||||
```
|
||||
|
||||
### Running test suites and tests
|
||||
|
||||
```bash
|
||||
# Run a specific test suite or test
|
||||
./dockerregistry-tests-ext run-suite openshift/image-registry/all
|
||||
./dockerregistry-tests-ext run-test "test-name"
|
||||
|
||||
# Run with JUnit output
|
||||
./dockerregistry-tests-ext run-suite openshift/image-registry/all --junit-path /tmp/junit.xml
|
||||
```
|
||||
|
||||
### Listing available tests and suites
|
||||
|
||||
```bash
|
||||
# List all test suites
|
||||
./dockerregistry-tests-ext list suites
|
||||
|
||||
# List tests in a suite
|
||||
./dockerregistry-tests-ext list tests --suite=openshift/image-registry/all
|
||||
```
|
||||
|
||||
For more information about the OTE framework, see the [openshift-tests-extension documentation](https://github.com/openshift-eng/openshift-tests-extension).
|
||||
|
||||
67
cmd/dockerregistry-tests-ext/main.go
Normal file
67
cmd/dockerregistry-tests-ext/main.go
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
This command is used to run the Image Registry tests extension for OpenShift.
|
||||
It registers the image-registry tests with the OpenShift Tests Extension framework
|
||||
and provides a command-line interface to execute them.
|
||||
For further information, please refer to the documentation at:
|
||||
https://github.com/openshift-eng/openshift-tests-extension/blob/main/cmd/example-tests/main.go
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"k8s.io/component-base/cli"
|
||||
|
||||
otecmd "github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
|
||||
oteextension "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
|
||||
"github.com/openshift/image-registry/pkg/version"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
command := newOperatorTestCommand(context.Background())
|
||||
code := cli.Run(command)
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
func newOperatorTestCommand(ctx context.Context) *cobra.Command {
|
||||
registry := prepareOperatorTestsRegistry()
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "dockerregistry-tests-ext",
|
||||
Short: "A binary used to run image-registry tests as part of OTE.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// no-op, logic is provided by the OTE framework
|
||||
if err := cmd.Help(); err != nil {
|
||||
klog.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
v := version.Get()
|
||||
if len(v.GitVersion) == 0 {
|
||||
cmd.Version = "<unknown>"
|
||||
} else {
|
||||
cmd.Version = v.GitVersion
|
||||
}
|
||||
|
||||
cmd.AddCommand(otecmd.DefaultExtensionCommands(registry)...)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// prepareOperatorTestsRegistry creates the OTE registry for this operator.
|
||||
//
|
||||
// Note:
|
||||
//
|
||||
// This method must be called before adding the registry to the OTE framework.
|
||||
func prepareOperatorTestsRegistry() *oteextension.Registry {
|
||||
registry := oteextension.NewRegistry()
|
||||
extension := oteextension.NewExtension("openshift", "payload", "image-registry")
|
||||
|
||||
registry.Register(extension)
|
||||
return registry
|
||||
}
|
||||
@@ -27,6 +27,7 @@ readonly OS_IMAGE_COMPILE_BINARIES=( )
|
||||
readonly OS_CROSS_COMPILE_TARGETS=(
|
||||
cmd/dockerregistry
|
||||
cmd/distribution
|
||||
cmd/dockerregistry-tests-ext
|
||||
)
|
||||
readonly OS_CROSS_COMPILE_BINARIES=("${OS_CROSS_COMPILE_TARGETS[@]##*/}")
|
||||
|
||||
|
||||
11
test/OWNERS
11
test/OWNERS
@@ -1,6 +1,9 @@
|
||||
reviewers:
|
||||
- dmage
|
||||
- legionus
|
||||
- flavianmissi
|
||||
- ricardomaraschini
|
||||
- xiuwang
|
||||
approvers:
|
||||
- dmage
|
||||
- legionus
|
||||
- ricardomaraschini
|
||||
- flavianmissi
|
||||
- xiuwang
|
||||
component: "Image Registry"
|
||||
|
||||
Reference in New Issue
Block a user