diff --git a/cmd/oauth-apiserver-tests-ext/main.go b/cmd/oauth-apiserver-tests-ext/main.go index ba4ba599c..59818b404 100644 --- a/cmd/oauth-apiserver-tests-ext/main.go +++ b/cmd/oauth-apiserver-tests-ext/main.go @@ -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", @@ -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 }