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

feat: loosen test instance interface to support various test frameworks #316 #319

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
3 changes: 1 addition & 2 deletions openfeature/testing/testprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"runtime"
"sync"
"testing"

"github.com/open-feature/go-sdk/openfeature"
"github.com/open-feature/go-sdk/openfeature/memprovider"
Expand All @@ -29,7 +28,7 @@ type TestProvider struct {
}

// UsingFlags sets flags for the scope of a test
func (tp TestProvider) UsingFlags(test *testing.T, flags map[string]memprovider.InMemoryFlag) {
func (tp TestProvider) UsingFlags(test interface{ Name() string }, flags map[string]memprovider.InMemoryFlag) {
Copy link
Member

@thomaspoignant thomaspoignant Feb 5, 2025

Choose a reason for hiding this comment

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

Suggested change
func (tp TestProvider) UsingFlags(test interface{ Name() string }, flags map[string]memprovider.InMemoryFlag) {
type TestFramework = interface{ Name() string }
func (tp TestProvider) UsingFlags(test TestFramework, flags map[string]memprovider.InMemoryFlag) {

storeGoroutineLocal(test.Name())
tp.providers.Store(test.Name(), memprovider.NewInMemoryProvider(flags))
}
Expand Down