kubernetes-sigs / e2e-framework

A Go framework for end-to-end testing of components running in Kubernetes clusters.
Apache License 2.0
522 stars 101 forks source link

Allow execution of non-feature tests #268

Open crandles opened 1 year ago

crandles commented 1 year ago

Support the execution of tests without requiring use of the features package.

To the Environment interface, I propose the addition of two new functions:

type Environment interface {
    RunTest(ctx context.Context, t *testing.T, cfg *envconf.Config) bool
    RunBenchmark(ctx context.Context, b *testing.B, cfg *envconf.Config) bool
}

I am unsure what if anything makes sense as return values, t.Run returns a bool which may fit here; additionally RunBenchmark might deserve its own issue, given the current lack of support overall for benchmarks.

Note, there is some overlap in wording with this existing function, unsure if the above naming will be confusing:

    // Run Launches the test suite from within a TestMain
    Run(*testing.M) int

The goal is to allow a more stream-lined path to writing go tests natively or otherwise with the framework of choice; don't force usage of the features package.

Potential usage:

testenv.RunTest(ctx context.Context, t *testing.T, cfg *envconf.Config) (context.Context, error){
  ...
  if err != nil {
    t.Fatal(err)
  }
  ...
   t.Run("...", func(t testing.T){
     t.Parallel()
     ...
   })

})
harshanarayana commented 1 year ago

@crandles https://github.com/kubernetes-sigs/e2e-framework/issues/133 We kind of sort of dig into the idea of running Benchmark workflows. But didn't manage to get it ahead. I would love to see that being picked up again. it would be a wonderful addition

k8s-triage-robot commented 9 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 8 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

vladimirvivien commented 8 months ago

This may still be something we need to check out cc @crandles @harshanarayana

/remove-lifecycle rotten

k8s-triage-robot commented 5 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

vladimirvivien commented 5 months ago

/remove-lifecycle stale

I like the idea of offering a light way of launching feature tests.

crandles commented 2 months ago

Started to look into this again:

vladimirvivien commented 2 months ago

@crandles this sounds awesome. Yes, this framework did not have benchmark in mind, but would be a great addition. This is exciting, can't wait to see how this turns out.