Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move new trigger tests to conformance suite #7626

Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/conformance/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ import (
"testing"

"knative.dev/pkg/system"
pkgtest "knative.dev/pkg/test"

"knative.dev/eventing/test"
testlib "knative.dev/eventing/test/lib"
"knative.dev/eventing/test/lib/setupclientoptions"
"knative.dev/pkg/test/zipkin"

"knative.dev/reconciler-test/pkg/environment"
)

const (
Expand All @@ -44,6 +47,8 @@ var sourcesTestRunner testlib.ComponentsTestRunner
var brokerTestRunner testlib.ComponentsTestRunner
var brokerClass string

var global environment.GlobalEnvironment

func TestMain(m *testing.M) {
os.Exit(func() int {
test.InitializeEventingFlags()
Expand All @@ -65,6 +70,12 @@ func TestMain(m *testing.M) {
}
brokerClass = test.BrokerClass

cfg, err := pkgtest.Flags.GetRESTConfig()
if err != nil {
panic("failed to get rest config")
}
global = environment.NewGlobalEnvironmentWithRestConfig(cfg)
Comment on lines +73 to +77
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This other conformance suite is limited and it will not evolve anymore until we can remove it


addSourcesInitializers()
// Any tests may SetupZipkinTracing, it will only actually be done once. This should be the ONLY
// place that cleans it up. If an individual test calls this instead, then it will break other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package rekt
package conformance

import (
"testing"
Expand Down
34 changes: 34 additions & 0 deletions vendor/knative.dev/reconciler-test/pkg/environment/standard.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check failure on line 1 in vendor/knative.dev/reconciler-test/pkg/environment/standard.go

View workflow job for this annotation

GitHub Actions / verify / Verify Deps and Codegen

Please run ./hack/update-codegen.sh. diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/standard.go b/vendor/knative.dev/reconciler-test/pkg/environment/standard.go index bc986b5..3db16fb 100644 --- a/vendor/knative.dev/reconciler-test/pkg/environment/standard.go +++ b/vendor/knative.dev/reconciler-test/pkg/environment/standard.go @@ -86,40 +86,6 @@ func NewStandardGlobalEnvironment(opts ...ConfigurationOption) GlobalEnvironment return NewGlobalEnvironment(ctx, startInformers) } -func NewGlobalEnvironmentWithRestConfig(cfg *rest.Config, opts ...ConfigurationOption) GlobalEnvironment { - opts = append(opts, initIstioFlags()) - config := resolveConfiguration(opts) - config.Config = cfg - ctx := testlog.NewContext(config.Context) - - InitFlags(config.Flags.Get(ctx)) - - // We get a chance to parse flags to include the framework flags for the - // framework as well as any additional flags included in the integration. - if err := config.Flags.Parse(ctx); err != nil { - logging.FromContext(ctx).Fatal(err) - } - - if ipFilePath != nil && *ipFilePath != "" { - ctx = withImageProducer(ctx, file.ImageProducer(*ipFilePath)) - } - - if testNamespace != nil && *testNamespace != "" { - ctx = withNamespace(ctx, *testNamespace) - } - - // EnableInjectionOrDie will enable client injection, this is used by the - // testing framework for namespace management, and could be leveraged by - // features to pull Kubernetes clients or the test environment out of the - // context passed in the features. - var startInformers func() - ctx, startInformers = injection.EnableInjectionOrDie(ctx, config.Config) - - // global is used to make instances of Environments, NewGlobalEnvironment - // is passing and saving the client injection enabled context for use later. - return NewGlobalEnvironment(ctx, startInformers) -} - func resolveConfiguration(opts []ConfigurationOption) Configuration { cfg := Configuration{ Flags: commandlineFlags{},
Copyright 2022 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -86,6 +86,40 @@
return NewGlobalEnvironment(ctx, startInformers)
}

func NewGlobalEnvironmentWithRestConfig(cfg *rest.Config, opts ...ConfigurationOption) GlobalEnvironment {
opts = append(opts, initIstioFlags())
config := resolveConfiguration(opts)
config.Config = cfg
ctx := testlog.NewContext(config.Context)

InitFlags(config.Flags.Get(ctx))

// We get a chance to parse flags to include the framework flags for the
// framework as well as any additional flags included in the integration.
if err := config.Flags.Parse(ctx); err != nil {
logging.FromContext(ctx).Fatal(err)
}

if ipFilePath != nil && *ipFilePath != "" {
ctx = withImageProducer(ctx, file.ImageProducer(*ipFilePath))
}

if testNamespace != nil && *testNamespace != "" {
ctx = withNamespace(ctx, *testNamespace)
}

// EnableInjectionOrDie will enable client injection, this is used by the
// testing framework for namespace management, and could be leveraged by
// features to pull Kubernetes clients or the test environment out of the
// context passed in the features.
var startInformers func()
ctx, startInformers = injection.EnableInjectionOrDie(ctx, config.Config)

// global is used to make instances of Environments, NewGlobalEnvironment
// is passing and saving the client injection enabled context for use later.
return NewGlobalEnvironment(ctx, startInformers)
}

func resolveConfiguration(opts []ConfigurationOption) Configuration {
cfg := Configuration{
Flags: commandlineFlags{},
Expand Down
Loading