Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions cmd/oauth-apiserver-tests-ext/main.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
package main

import (
"context"
"fmt"
"os"

"github.com/spf13/cobra"
"k8s.io/component-base/cli"
"k8s.io/klog/v2"

otecmd "github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
oteextension "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
"github.com/openshift/oauth-apiserver/pkg/version"

"k8s.io/klog/v2"
)

func main() {
command := newOperatorTestCommand(context.Background())
code := cli.Run(command)
cmd, err := newOperatorTestCommand()
if err != nil {
klog.Fatal(err)
}

code := cli.Run(cmd)
os.Exit(code)
}

func newOperatorTestCommand(ctx context.Context) *cobra.Command {
registry := prepareOperatorTestsRegistry()
func newOperatorTestCommand() (*cobra.Command, error) {
registry, err := prepareOperatorTestsRegistry()
if err != nil {
return nil, fmt.Errorf("failed to prepare test registry: %w", err)
}

cmd := &cobra.Command{
Use: "oauth-apiserver-tests-ext",
Expand All @@ -42,13 +48,16 @@ func newOperatorTestCommand(ctx context.Context) *cobra.Command {

cmd.AddCommand(otecmd.DefaultExtensionCommands(registry)...)

return cmd
return cmd, nil
}

func prepareOperatorTestsRegistry() *oteextension.Registry {
func prepareOperatorTestsRegistry() (*oteextension.Registry, error) {
registry := oteextension.NewRegistry()
extension := oteextension.NewExtension("openshift", "payload", "oauth-apiserver")

// Note: Test package imports and oteginkgo.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
// will be added in subsequent PRs when actual tests are migrated to the OTE framework.

registry.Register(extension)
return registry
return registry, nil
}